Skip to main content

minecraft-launcher-lib

PyPI PyPI - Downloads PyPI - Python Version PyPI - License PyPI - Implementation Read the Docs

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

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, cwd=minecraft_directory)

Features:

  • Easy installing
  • Get command to run Minecraft
  • Login to Microsoft account
  • Supports Forge, Fabric, Quilt, NeoForge and Liteloader
  • Old versions like alpha or beta supported
  • All functions have type annotations and docstrings
  • Only depents on requests
  • Supports PyPy
  • Full Documention with tutorial online available
  • Supports reading and writing profiles of the Vanilla Launcher
  • Install of mrpack modpacks
  • All public APIs are static typed
  • Examples available
  • OpenSource

View more examples

Read the documentation

Thanks to tomsik68 who documented how a minecraft launcher works

Buy me a coffe

Metadata

Release files for minecraft-launcher-lib 8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minecraft-launcher-lib 8.0
File Size Uploaded
minecraft_launcher_lib-8.0.tar.gz 43.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for minecraft-launcher-lib 8.0
File Interpreter ABI Platform
minecraft_launcher_lib-8.0-py3-none-any.whl Python 3 none any Details

Total release size: 104.8 kB

Release files / minecraft_launcher_lib-8.0.tar.gz

Download URL minecraft_launcher_lib-8.0.tar.gz
Size 43.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4ce173f2e1885c0d5bdf5ecebaa2f1ffc63140663c77699696689f3807b6bdb0
BLAKE2b-256 checksum
How to use checksums
1e68fdd869aea9f04fe1dc7f243df084a7e30843bed5776890f29ac0b85f213b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / minecraft_launcher_lib-8.0-py3-none-any.whl

Download URL minecraft_launcher_lib-8.0-py3-none-any.whl
Size 61.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff17960c62e21ca7e21329303ae56bdefc0246de3bc9a5e1578dfa8df6604746
BLAKE2b-256 checksum
How to use checksums
4dffac903044f43558af87999dda35e7a3c31d278f766e83e484b24d572fdffe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

8.0 This release

2 release files

7.1

2 release files

7.0

2 release files

6.5

2 release files

6.4

2 release files

6.3

2 release files

6.2

2 release files

6.1

2 release files

6.0

2 release files

5.3

2 release files

5.2

2 release files

5.1

2 release files

5.0

2 release files

4.6

2 release files

4.5

2 release files

4.4

2 release files

4.3

2 release files

4.2

2 release files

4.1

2 release files

4.0

2 release files

3.6

2 release files

3.5

2 release files

3.4

2 release files

3.3

2 release files

3.2

2 release files

3.1

2 release files

3.0

2 release files

2.1

2 release files

2.0

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page