Skip to main content

Minecraft Data tracking PrismarineJS/minecraft-data

Project description

minecraft-data

Python wrapper for PrismarineJS/minecraft-data.

Installation

This package requires Python 3.9 or higher, and supports Python versions up to 3.13.

First, create and activate a virtual environment:

python -m venv .venv
source .venv/bin/activate  # On Unix/macOS
# or
.venv\Scripts\activate     # On Windows

Install the package:

pip install -e .

For development:

pip install -e ".[dev]"

Usage

from minecraft_assets import get_asset_root, get_asset_dir

# Get the root assets directory
assets_root = get_asset_root()
print(assets_root)  # Path to the root assets directory

# Get assets directory for a specific version
version_dir = get_asset_dir("1.20.4")
print(version_dir)  # Path to version-specific assets

# Will raise MinecraftVersionError if version doesn't exist
try:
    invalid_dir = get_asset_dir("9.99.99")
except MinecraftVersionError as e:
    print(f"Error: {e}")

The package provides functions to access Minecraft asset directories. Each version's directory contains the raw asset files from the corresponding Minecraft version.

Development

This project uses:

Updating Minecraft Assets

The package includes a script to update the Minecraft assets from the upstream repository:

# Make the script executable (first time only)
chmod +x update-assets.sh

# Run the script
./update-assets.sh

# Or specify a custom target directory
./update-assets.sh path/to/custom/dir

The script will:

  1. Clone the PrismarineJS/minecraft-data repository
  2. Checkout the specified version (currently 1.13.0)
  3. Copy the data to the appropriate directory
  4. Clean up temporary files

After running the script, commit the changes and update the version number accordingly.

Make Commands

Remember to activate your virtual environment before running these commands:

make format     # Format code using ruff
make lint       # Run linting checks
make test       # Run tests
make clean      # Clean build artifacts and virtual environment

Version Strategy

This package follows the version numbers of the upstream minecraft-data repository, with the addition of release candidate suffixes (e.g., 1.21.0rc1) during development. Once a version is thoroughly tested, it will be released with the matching version number from minecraft-data.

Updating to a New Version

To update the package to track a new version of minecraft-data, follow these steps:

  1. Find the closest previous version

    # Example: For updating to 1.13.1, look for:
    # - 1.13.0 (closest)
    # - 1.12.x (fallback)
    git clone https://github.com/PrismarineJS/minecraft-data.git
    cd minecraft-data
    git tag | sort -V
    
  2. Create a feature branch

    git checkout -b v1.13.1rc
    
  3. Update version references:

    • In update-data.sh:

      # Change MINECRAFT_ASSETS_VERSION
      MINECRAFT_DATA_VERSION="1.13.1"
      
    • In src/minecraft_assets/__init__.py:

      __version__ = "1.13.1rc0"
      
    • In tests/test_assets.py:

      SUPPORTED_VERSIONS = [
          # ... existing minecraft versions ...
          "1.21.5",  # Add newly supported Minecraft versions if needed
      ]
      
    • In tests/test_version.py:

      def test_version():
          cleaned_version = __version__.split("rc")[0]
          assert cleaned_version == "1.13.1"
      
  4. Run the update script:

    ./update-data.sh
    
  5. Test and commit changes:

    make test
    make lint
    git commit -am "Update to minecraft-data 1.13.1rc0"
    git push origin v1.13.1rc
    
  6. Once testing is complete:

    # Create release branch
    git checkout -b v1.13.1
    
    # Commit and push
    git push origin v1.13.1
    
  7. Create a release on GitHub using the v1.13.1 tag

Remember to update the package version in your dependent projects after releasing.

Building Distributions

To build both source distribution (sdist) and wheel distribution (bdist_wheel):

python -m build

This will create:

  • A source distribution (.tar.gz) in the dist/ directory
  • A wheel distribution (.whl) in the dist/ directory

Validating Distribution Contents

To inspect the contents of the source distribution:

tar tzf dist/*.tar.gz  # List contents without extracting
# or
tar xzf dist/*.tar.gz -C /tmp  # Extract to /tmp for inspection

To inspect the wheel distribution (which is a ZIP file):

unzip -l dist/*.whl  # List contents without extracting
# or
unzip dist/*.whl -d /tmp  # Extract to /tmp for inspection

To clean all build artifacts and start fresh:

make clean

License

See LICENSE for more information.

Project details


Download files

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

Source Distribution

mc_data_files-3.83.1rc0.tar.gz (16.3 MB view details)

Uploaded Source

Built Distribution

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

mc_data_files-3.83.1rc0-py3-none-any.whl (17.1 MB view details)

Uploaded Python 3

File details

Details for the file mc_data_files-3.83.1rc0.tar.gz.

File metadata

  • Download URL: mc_data_files-3.83.1rc0.tar.gz
  • Upload date:
  • Size: 16.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for mc_data_files-3.83.1rc0.tar.gz
Algorithm Hash digest
SHA256 9ef20e63386051ef94958c85b448ae9cc6380b23daeaf5e71eb4ce9b21d994e2
MD5 ab5964d6e30ee3537a94943631c364e6
BLAKE2b-256 3d0638a45097c9514e8ea153601833e96005d022cc429de7a8dcb6e927a676b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mc_data_files-3.83.1rc0.tar.gz:

Publisher: release.yml on mc-bench/mc-data-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mc_data_files-3.83.1rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for mc_data_files-3.83.1rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 127b86f3c2978756f50b8d290bb615566b6b2cebbc9ae116294a0a791e632397
MD5 ec5dfe3c2c5f572255167c179d9d9b90
BLAKE2b-256 91104665a0362acf715532389a07933b81969f0801dbbb5ffe27b719d9073045

See more details on using hashes here.

Provenance

The following attestation bundles were made for mc_data_files-3.83.1rc0-py3-none-any.whl:

Publisher: release.yml on mc-bench/mc-data-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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