Skip to main content

The Minecraft pack development kit

Project description

logo

Beet

GitHub Actions PyPI PyPI - Python Version Code style: black Discord

The Minecraft pack development kit.

Introduction

Minecraft resource packs and data packs work well as distribution formats but can be pretty limiting as authoring formats. You can quickly end up having to manage hundreds of files, some of which might be buried within the bundled output of various generators.

The beet project is a development kit that tries to unify data pack and resource pack tooling into a single pipeline. The community is always coming up with pre-processors, frameworks, and generators of all kinds to make the developer experience more ergonomic. With beet you can seamlessly integrate all these tools in your project.

Screencasts

Library

from beet import ResourcePack, Texture

# Open a zipped resource pack and add a custom stone texture
with ResourcePack(path="stone.zip") as assets:
    assets["minecraft:block/stone"] = Texture(source_path="custom.png")

The beet library provides carefully crafted primitives for working with Minecraft resource packs and data packs.

  • Create, read, edit and merge resource packs and data packs
  • Handle zipped and unzipped packs
  • Fast and lazy by default, files are transparently loaded when needed
  • Statically typed API enabling rich intellisense and autocompletion
  • First-class pytest integration with detailed assertion explanations

Toolchain

from beet import Context, Function

def greet(ctx: Context):
    """Plugin that adds a function for greeting the player."""
    ctx.data["greet:hello"] = Function(["say hello"], tags=["minecraft:load"])

The beet toolchain is designed to support a wide range of use-cases. The most basic pipeline will let you create configurable resource packs and data packs, but plugins make it easy to implement arbitrarily advanced workflows and tools like linters, asset generators and function pre-processors.

  • Compose plugins that can inspect and edit the generated resource pack and data pack
  • Configure powerful build systems for development and creating releases
  • First-class template integration approachable without prior Python knowledge
  • Link the generated resource pack and data pack to Minecraft
  • Automatically rebuild the project on file changes with watch mode
  • Batteries-included package that comes with a few handy plugins out of the box
  • Rich ecosystem, extensible CLI, and powerful generator and worker API

Installation

The package can be installed with pip.

$ pip install beet

To create and edit images programmatically you should install beet with the image extra or install Pillow separately.

$ pip install beet[image]
$ pip install beet Pillow

You can make sure that beet was successfully installed by trying to use the toolchain from the command-line.

$ beet --help
Usage: beet [OPTIONS] COMMAND [ARGS]...

  The beet toolchain.

Options:
  -d, --directory DIRECTORY  Use the specified project directory.
  -c, --config FILE          Use the specified config file.
  -l, --log LEVEL            Configure output verbosity.
  -v, --version              Show the version and exit.
  -h, --help                 Show this message and exit.

Commands:
  build  Build the current project.
  cache  Inspect or clear the cache.
  link   Link the generated resource pack and data pack to Minecraft.
  watch  Watch the project directory and build on file changes.

Contributing

Contributions are welcome. Make sure to first open an issue discussing the problem or the new feature before creating a pull request. The project uses poetry.

$ poetry install --extras image

You can run the tests with poetry run pytest. We use pytest-minecraft to run tests against actual Minecraft releases.

$ poetry run pytest
$ poetry run pytest --minecraft-latest

We also use pytest-insta for snapshot testing. Data pack and resource pack snapshots make it easy to monitor and review changes.

$ poetry run pytest --insta review

The project must type-check with pyright. If you're using VSCode the pylance extension should report diagnostics automatically. You can also install the type-checker locally with npm install and run it from the command-line.

$ npm run watch
$ npm run check

The code follows the black code style. Import statements are sorted with isort.

$ poetry run isort beet tests
$ poetry run black beet tests
$ poetry run black --check beet tests

License - MIT

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beet-0.48.0.tar.gz (63.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

beet-0.48.0-py3-none-any.whl (80.6 kB view details)

Uploaded Python 3

File details

Details for the file beet-0.48.0.tar.gz.

File metadata

  • Download URL: beet-0.48.0.tar.gz
  • Upload date:
  • Size: 63.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for beet-0.48.0.tar.gz
Algorithm Hash digest
SHA256 75cbae315f9c7e3c642281a6c061feed2f0af63a174b9c4a22b1727eb9f55b28
MD5 e7e42ae890d88dc5416b6c289486f148
BLAKE2b-256 47610af6916ce8ffa444cf16e4c42b04f408f8c5e3597e790128261e43d078ea

See more details on using hashes here.

File details

Details for the file beet-0.48.0-py3-none-any.whl.

File metadata

  • Download URL: beet-0.48.0-py3-none-any.whl
  • Upload date:
  • Size: 80.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for beet-0.48.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd06a4c3d28f9278f20e901fdbf2db9f0ed35cc5f5d185ffc4319b9990fbc6e2
MD5 670d7b856ae1e1cbc5e3d590a1607928
BLAKE2b-256 9c13ab609d394d046cec32e947caf8f73de6b6512d24d364edca7f5edf9560a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page