minecraft-launcher-lib


Nameminecraft-launcher-lib JSON
Version 6.4 PyPI version JSON
download
home_page
SummaryA library for creating a custom Minecraft launcher
upload_time2023-12-09 18:33:55
maintainer
docs_urlNone
author
requires_python>=3.8
licenseBSD-2-Clause
keywords jakobdev minecraft mojang launcher minecraft-launcher java
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # minecraft-launcher-lib

![PyPI](https://img.shields.io/pypi/v/minecraft-launcher-lib)
![PyPI - Downloads](https://img.shields.io/pypi/dm/minecraft-launcher-lib)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/minecraft-launcher-lib)
![PyPI - License](https://img.shields.io/pypi/l/minecraft-launcher-lib)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/minecraft-launcher-lib)
![Read the Docs](https://img.shields.io/readthedocs/minecraft-launcher-lib)

A Python library for creating a custom minecraft launcher. This library containts functions to install and execute minecraft and interacting with mojang accounts.

```python
import minecraft_launcher_lib
import subprocess
import sys

# Set the data for your Azure Application here. For more information look at the documentation.
CLIENT_ID = "YOUR CLIENT ID"
REDIRECT_URL = "YOUR REDIRECT URL"

# Get latest version
latest_version = minecraft_launcher_lib.utils.get_latest_version()["release"]

# Get Minecraft directory
minecraft_directory = minecraft_launcher_lib.utils.get_minecraft_directory()

# Make sure, the latest version of Minecraft is installed
minecraft_launcher_lib.install.install_minecraft_version(latest_version, minecraft_directory)

# Login
login_url, state, code_verifier = minecraft_launcher_lib.microsoft_account.get_secure_login_data(CLIENT_ID, REDIRECT_URL)
print(f"Please open {login_url} in your browser and copy the url you are redirected into the prompt below.")
code_url = input()

# Get the code from the url
try:
    auth_code = minecraft_launcher_lib.microsoft_account.parse_auth_code_url(code_url, state)
except AssertionError:
    print("States do not match!")
    sys.exit(1)
except KeyError:
    print("Url not valid")
    sys.exit(1)

# Get the login data
login_data = minecraft_launcher_lib.microsoft_account.complete_login(CLIENT_ID, None, REDIRECT_URL, auth_code, code_verifier)

# Get Minecraft command
options = {
    "username": login_data["name"],
    "uuid": login_data["id"],
    "token": login_data["access_token"]
}
minecraft_command = minecraft_launcher_lib.command.get_minecraft_command(latest_version, minecraft_directory, options)

# Start Minecraft
subprocess.run(minecraft_command)
```

Features:
- Easy installing
- Get command to run Minecraft
- Login to Microsoft account
- Supports [Forge](https://minecraftforge.net), [Fabric](https://fabricmc.net), [Quilt](https://quiltmc.org) and Liteloader
- Old versions like alpha or beta supported
- All functions have type annotations and docstrings
- Only depents on [requests](https://pypi.org/project/requests)
- Supports [PyPy](https://www.pypy.org)
- Full Documention with tutorial online available
- Supports reading and writing profiles of the Vanilla Launcher
- Install of [mrpack modpacks](https://docs.modrinth.com/docs/modpacks/format_definition)
- All public APIs are static typed
- Examples available
- OpenSource

[View more examples](https://codeberg.org/JakobDev/minecraft-launcher-lib/src/branch/master/examples)

[Read the documentation](https://minecraft-launcher-lib.readthedocs.io)

[Thanks to tomsik68 who documented how a minecraft launcher works](https://github.com/tomsik68/mclauncher-api/wiki)

[Buy me a coffe](https://ko-fi.com/jakobdev)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "minecraft-launcher-lib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "JakobDev,Minecraft,Mojang,launcher,minecraft-launcher,java",
    "author": "",
    "author_email": "JakobDev <jakobdev@gmx.de>",
    "download_url": "https://files.pythonhosted.org/packages/73/46/665d4843246e4ae76dafbd0385dc55ecb2a27d5bbcfc0a47d4c3a96d12ac/minecraft-launcher-lib-6.4.tar.gz",
    "platform": null,
    "description": "# minecraft-launcher-lib\n\n![PyPI](https://img.shields.io/pypi/v/minecraft-launcher-lib)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/minecraft-launcher-lib)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/minecraft-launcher-lib)\n![PyPI - License](https://img.shields.io/pypi/l/minecraft-launcher-lib)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/minecraft-launcher-lib)\n![Read the Docs](https://img.shields.io/readthedocs/minecraft-launcher-lib)\n\nA Python library for creating a custom minecraft launcher. This library containts functions to install and execute minecraft and interacting with mojang accounts.\n\n```python\nimport minecraft_launcher_lib\nimport subprocess\nimport sys\n\n# Set the data for your Azure Application here. For more information look at the documentation.\nCLIENT_ID = \"YOUR CLIENT ID\"\nREDIRECT_URL = \"YOUR REDIRECT URL\"\n\n# Get latest version\nlatest_version = minecraft_launcher_lib.utils.get_latest_version()[\"release\"]\n\n# Get Minecraft directory\nminecraft_directory = minecraft_launcher_lib.utils.get_minecraft_directory()\n\n# Make sure, the latest version of Minecraft is installed\nminecraft_launcher_lib.install.install_minecraft_version(latest_version, minecraft_directory)\n\n# Login\nlogin_url, state, code_verifier = minecraft_launcher_lib.microsoft_account.get_secure_login_data(CLIENT_ID, REDIRECT_URL)\nprint(f\"Please open {login_url} in your browser and copy the url you are redirected into the prompt below.\")\ncode_url = input()\n\n# Get the code from the url\ntry:\n    auth_code = minecraft_launcher_lib.microsoft_account.parse_auth_code_url(code_url, state)\nexcept AssertionError:\n    print(\"States do not match!\")\n    sys.exit(1)\nexcept KeyError:\n    print(\"Url not valid\")\n    sys.exit(1)\n\n# Get the login data\nlogin_data = minecraft_launcher_lib.microsoft_account.complete_login(CLIENT_ID, None, REDIRECT_URL, auth_code, code_verifier)\n\n# Get Minecraft command\noptions = {\n    \"username\": login_data[\"name\"],\n    \"uuid\": login_data[\"id\"],\n    \"token\": login_data[\"access_token\"]\n}\nminecraft_command = minecraft_launcher_lib.command.get_minecraft_command(latest_version, minecraft_directory, options)\n\n# Start Minecraft\nsubprocess.run(minecraft_command)\n```\n\nFeatures:\n- Easy installing\n- Get command to run Minecraft\n- Login to Microsoft account\n- Supports [Forge](https://minecraftforge.net), [Fabric](https://fabricmc.net), [Quilt](https://quiltmc.org) and Liteloader\n- Old versions like alpha or beta supported\n- All functions have type annotations and docstrings\n- Only depents on [requests](https://pypi.org/project/requests)\n- Supports [PyPy](https://www.pypy.org)\n- Full Documention with tutorial online available\n- Supports reading and writing profiles of the Vanilla Launcher\n- Install of [mrpack modpacks](https://docs.modrinth.com/docs/modpacks/format_definition)\n- All public APIs are static typed\n- Examples available\n- OpenSource\n\n[View more examples](https://codeberg.org/JakobDev/minecraft-launcher-lib/src/branch/master/examples)\n\n[Read the documentation](https://minecraft-launcher-lib.readthedocs.io)\n\n[Thanks to tomsik68 who documented how a minecraft launcher works](https://github.com/tomsik68/mclauncher-api/wiki)\n\n[Buy me a coffe](https://ko-fi.com/jakobdev)\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "A library for creating a custom Minecraft launcher",
    "version": "6.4",
    "project_urls": {
        "Changelog": "https://minecraft-launcher-lib.readthedocs.io/en/stable/changelog.html",
        "Documentation": "https://minecraft-launcher-lib.readthedocs.io/en/stable/index.html",
        "Donation": "https://ko-fi.com/jakobdev",
        "Issues": "https://codeberg.org/JakobDev/minecraft-launcher-lib/issues",
        "Source": "https://codeberg.org/JakobDev/minecraft-launcher-lib"
    },
    "split_keywords": [
        "jakobdev",
        "minecraft",
        "mojang",
        "launcher",
        "minecraft-launcher",
        "java"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "20e3180347037ab90e49b037606e85fa32a2326546417d60caae73e92b5c1e1c",
                "md5": "f60c50947325feb580df9d3e73cda337",
                "sha256": "08b762a8bb47ceafd1fdea9056d86fa72bebb37b5548d9038a3bbbda4619551f"
            },
            "downloads": -1,
            "filename": "minecraft_launcher_lib-6.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f60c50947325feb580df9d3e73cda337",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 43278,
            "upload_time": "2023-12-09T18:33:52",
            "upload_time_iso_8601": "2023-12-09T18:33:52.362350Z",
            "url": "https://files.pythonhosted.org/packages/20/e3/180347037ab90e49b037606e85fa32a2326546417d60caae73e92b5c1e1c/minecraft_launcher_lib-6.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7346665d4843246e4ae76dafbd0385dc55ecb2a27d5bbcfc0a47d4c3a96d12ac",
                "md5": "d7be5ea4e8c065b4e097c8a86d49b7f5",
                "sha256": "8874e5a979c55fc875431523d840870ab59d09dad0b8c1ebc97d3eaca5dbbcf2"
            },
            "downloads": -1,
            "filename": "minecraft-launcher-lib-6.4.tar.gz",
            "has_sig": false,
            "md5_digest": "d7be5ea4e8c065b4e097c8a86d49b7f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 45601,
            "upload_time": "2023-12-09T18:33:55",
            "upload_time_iso_8601": "2023-12-09T18:33:55.350372Z",
            "url": "https://files.pythonhosted.org/packages/73/46/665d4843246e4ae76dafbd0385dc55ecb2a27d5bbcfc0a47d4c3a96d12ac/minecraft-launcher-lib-6.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-09 18:33:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": true,
    "codeberg_user": "JakobDev",
    "codeberg_project": "minecraft-launcher-lib",
    "lcname": "minecraft-launcher-lib"
}
        
Elapsed time: 0.15700s