Skip to main content

A Terraria world parser in Python

Project description

lihzahrd Available on PyPI

A Terraria 1.4.4.9 world parser in Python.

You can use this package to get programmer-friendly data from a Terraria world!

Installation

Use your favourite Python package manager to install lihzahrd:

  • Venv + Pip

    $ source .venv/bin/activate
    $ pip install lihzahrd
    
  • Poetry

    $ poetry add lihzahrd
    
  • And more!

Usage

You can open a world file and get a World object by calling:

import lihzahrd
world = lihzahrd.World.create_from_file("filename.wld")

It will take a while to process: a small Terraria world contains more than 5 million tiles!

Once you have a World object, you can use all data present in the save file by accessing its attributes.

Warning

Loading maliciously designed Terraria worlds can drain system resources, crash the interpreter, or possibly do more evil things!

Make sure you trust the worlds you are parsing!

Documentation

The documentation is available here.

If you know something that is missing in the documentation, please let me know with an issue!

PyPy

lihzahrd is compatible with PyPy, an alternative implementation on Python!

If you think that parsing a world takes too much time, you can use PyPy to reduce the required time by a factor of ~3!

Benchmarks

Time to parse the same large world:

  • CPython took 11.45 s.
  • Pypy took 3.57 s!

Development

To contribute to lihzahrd, you need to have Poetry installed on your PC.

After you've installed Poetry, clone the git repo with the command:

$ git clone https://github.com/Steffo99/lihzahrd

Then enter the new directory:

$ cd lihzahrd

And finally install all dependencies and the package:

$ poetry install

This will create a new virtualenv for the development of the library; you can activate it by typing:

$ poetry shell

Please note that for compatibility with PyPy, the project needs to target Python 3.6.

Building docs

You can build the docs by entering the docs_source folder and running make html, then committing the whole docs folder.

References used

License

lihzahrd is licensed under the AGPL 3.0. That means you have to publish under the same license the source code of any program you create that uses lihzahrd.

See also

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

lihzahrd-3.1.0.tar.gz (100.5 kB view details)

Uploaded Source

Built Distribution

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

lihzahrd-3.1.0-py3-none-any.whl (118.4 kB view details)

Uploaded Python 3

File details

Details for the file lihzahrd-3.1.0.tar.gz.

File metadata

  • Download URL: lihzahrd-3.1.0.tar.gz
  • Upload date:
  • Size: 100.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.5.7-zen2-1-zen

File hashes

Hashes for lihzahrd-3.1.0.tar.gz
Algorithm Hash digest
SHA256 2c45179c7d5d2f14836ded9edde7bc3a2b18c6069ae7cb596eb8a798b7591b57
MD5 4dc26172f6489b1e9cb88757115f070f
BLAKE2b-256 2391299ff776fbbeec4ca3885b760e72276edaf418adf8ce08b489c3d3945495

See more details on using hashes here.

File details

Details for the file lihzahrd-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: lihzahrd-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 118.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.5.7-zen2-1-zen

File hashes

Hashes for lihzahrd-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a8c0c3ac482fb9a8a28eb733a72b584f63d709f1262f78a68761102c735f455d
MD5 9b9ab351f6b909f6beedf78ac4de8d5e
BLAKE2b-256 83601345f90f209dd815e30d0aff7f9a37a6dc4c58a9052a584cc974fd418198

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