# ![](https://gamepedia.cursecdn.com/terraria_gamepedia/e/ee/Lihzahrd.png?version=b8e7ea78b2f9f27a46e2e70d5684b344) `lihzahrd` [![Available on PyPI](https://img.shields.io/pypi/v/lihzahrd)](https://pypi.org/project/lihzahrd/)
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
```console
$ source .venv/bin/activate
$ pip install lihzahrd
```
- Poetry
```console
$ poetry add lihzahrd
```
- And more!
## Usage
You can open a world file and get a `World` object by calling:
```python
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](http://gh.steffo.eu/lihzahrd/html/world.html).
> **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](https://gh.steffo.eu/lihzahrd/html/).
If you know something that is missing in the documentation, please let me know [with an issue](https://github.com/Steffo99/lihzahrd/issues/new)!
## PyPy
`lihzahrd` is compatible with [PyPy](https://www.pypy.org), 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](https://poetry.eustace.io/) installed on your PC.
After you've installed Poetry, clone the git repo with the command:
```console
$ git clone https://github.com/Steffo99/lihzahrd
```
Then enter the new directory:
```console
$ cd lihzahrd
```
And finally install all dependencies and the package:
```console
$ poetry install
```
This will create a new virtualenv for the development of the library; you can activate it by typing:
```console
$ 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
- The [TEdit World Parser](https://github.com/TEdit/Terraria-Map-Editor/blob/master/TEditXna/Terraria/World.FileV2.cs), the most accurate source currently available.
- The [tModLoader wiki](https://github.com/tModLoader/tModLoader/wiki), containing lists of all possible IDs.
- The [Terrafirma world documentation](http://seancode.com/terrafirma/world.html), accurate for old worlds (version <69)
- The [1.3.x.x world documentation](http://ludwig.schafer.free.fr/), a bit incomplete, but an useful source nevertheless.
- A [JS World Parser](https://github.com/cokolele/terraria-world-parser/) on GitHub.
- A [Background Guide](https://steamcommunity.com/sharedfiles/filedetails/?id=841032800) on Steam that displays all possible world backgrounds.
## License
`lihzahrd` is licensed under the [AGPL 3.0](/LICENSE.txt).
That means you have to publish under the same license the source code of any program you create that uses `lihzahrd`.
## See also
- [flyingsnake](https://github.com/Steffo99/flyingsnake), a map renderer using this package
Raw data
{
"_id": null,
"home_page": "https://github.com/Steffo99/lihzahrd/",
"name": "lihzahrd",
"maintainer": "Stefano Pigozzi",
"docs_url": null,
"requires_python": ">=3.6.2,<4.0.0",
"maintainer_email": "me@steffo.eu",
"keywords": "terraria,parser,game",
"author": "Stefano Pigozzi",
"author_email": "me@steffo.eu",
"download_url": "https://files.pythonhosted.org/packages/23/91/299ff776fbbeec4ca3885b760e72276edaf418adf8ce08b489c3d3945495/lihzahrd-3.1.0.tar.gz",
"platform": null,
"description": "# ![](https://gamepedia.cursecdn.com/terraria_gamepedia/e/ee/Lihzahrd.png?version=b8e7ea78b2f9f27a46e2e70d5684b344) `lihzahrd` [![Available on PyPI](https://img.shields.io/pypi/v/lihzahrd)](https://pypi.org/project/lihzahrd/)\n\nA Terraria 1.4.4.9 world parser in Python.\n\nYou can use this package to get programmer-friendly data from a Terraria world!\n\n## Installation\n\nUse your favourite Python package manager to install `lihzahrd`:\n\n- Venv + Pip\n\n ```console\n $ source .venv/bin/activate\n $ pip install lihzahrd\n ```\n\n- Poetry\n\n ```console\n $ poetry add lihzahrd\n ```\n \n- And more!\n\n## Usage\n\nYou can open a world file and get a `World` object by calling:\n\n```python\nimport lihzahrd\nworld = lihzahrd.World.create_from_file(\"filename.wld\")\n```\n\nIt _will_ take a while to process: a small Terraria world contains more than 5 million tiles!\n\nOnce you have a `World` object, you can use all data present in the save file by accessing [its attributes](http://gh.steffo.eu/lihzahrd/html/world.html).\n\n> **Warning**\n> \n> Loading maliciously designed Terraria worlds can drain system resources, crash the interpreter, or possibly do more evil things!\n> \n> **Make sure you trust the worlds you are parsing!**\n\n## Documentation\n\nThe documentation is available [here](https://gh.steffo.eu/lihzahrd/html/).\n\nIf you know something that is missing in the documentation, please let me know [with an issue](https://github.com/Steffo99/lihzahrd/issues/new)!\n\n## PyPy\n\n`lihzahrd` is compatible with [PyPy](https://www.pypy.org), an alternative implementation on Python!\n\nIf you think that parsing a world takes too much time, you can use PyPy to reduce the required time by a factor of ~3!\n\n### Benchmarks\n\nTime to parse the same large world:\n\n- CPython took 11.45 s.\n- Pypy took 3.57 s!\n\n## Development\n\nTo contribute to `lihzahrd`, you need to have [Poetry](https://poetry.eustace.io/) installed on your PC.\n\nAfter you've installed Poetry, clone the git repo with the command:\n\n```console\n$ git clone https://github.com/Steffo99/lihzahrd\n```\n\nThen enter the new directory:\n\n```console\n$ cd lihzahrd\n```\n\nAnd finally install all dependencies and the package:\n\n```console\n$ poetry install\n```\n\nThis will create a new virtualenv for the development of the library; you can activate it by typing:\n\n```console\n$ poetry shell\n```\n\nPlease note that for compatibility with PyPy, the project needs to target Python 3.6.\n\n### Building docs\n\nYou can build the docs by entering the `docs_source` folder and running `make html`, then committing the whole `docs` folder.\n\n## References used\n\n- The [TEdit World Parser](https://github.com/TEdit/Terraria-Map-Editor/blob/master/TEditXna/Terraria/World.FileV2.cs), the most accurate source currently available.\n- The [tModLoader wiki](https://github.com/tModLoader/tModLoader/wiki), containing lists of all possible IDs.\n- The [Terrafirma world documentation](http://seancode.com/terrafirma/world.html), accurate for old worlds (version <69)\n- The [1.3.x.x world documentation](http://ludwig.schafer.free.fr/), a bit incomplete, but an useful source nevertheless.\n- A [JS World Parser](https://github.com/cokolele/terraria-world-parser/) on GitHub.\n- A [Background Guide](https://steamcommunity.com/sharedfiles/filedetails/?id=841032800) on Steam that displays all possible world backgrounds.\n\n## License\n\n`lihzahrd` is licensed under the [AGPL 3.0](/LICENSE.txt).\nThat means you have to publish under the same license the source code of any program you create that uses `lihzahrd`.\n\n## See also\n\n- [flyingsnake](https://github.com/Steffo99/flyingsnake), a map renderer using this package\n",
"bugtrack_url": null,
"license": "AGPL-3.0-or-later",
"summary": "A Terraria world parser in Python",
"version": "3.1.0",
"project_urls": {
"Documentation": "https://gh.steffo.eu/lihzahrd/",
"Homepage": "https://github.com/Steffo99/lihzahrd/",
"Repository": "https://github.com/Steffo99/lihzahrd/"
},
"split_keywords": [
"terraria",
"parser",
"game"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "83601345f90f209dd815e30d0aff7f9a37a6dc4c58a9052a584cc974fd418198",
"md5": "9b9ab351f6b909f6beedf78ac4de8d5e",
"sha256": "a8c0c3ac482fb9a8a28eb733a72b584f63d709f1262f78a68761102c735f455d"
},
"downloads": -1,
"filename": "lihzahrd-3.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9b9ab351f6b909f6beedf78ac4de8d5e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6.2,<4.0.0",
"size": 118384,
"upload_time": "2023-10-17T17:32:33",
"upload_time_iso_8601": "2023-10-17T17:32:33.731761Z",
"url": "https://files.pythonhosted.org/packages/83/60/1345f90f209dd815e30d0aff7f9a37a6dc4c58a9052a584cc974fd418198/lihzahrd-3.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2391299ff776fbbeec4ca3885b760e72276edaf418adf8ce08b489c3d3945495",
"md5": "4dc26172f6489b1e9cb88757115f070f",
"sha256": "2c45179c7d5d2f14836ded9edde7bc3a2b18c6069ae7cb596eb8a798b7591b57"
},
"downloads": -1,
"filename": "lihzahrd-3.1.0.tar.gz",
"has_sig": false,
"md5_digest": "4dc26172f6489b1e9cb88757115f070f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.2,<4.0.0",
"size": 100522,
"upload_time": "2023-10-17T17:32:35",
"upload_time_iso_8601": "2023-10-17T17:32:35.702669Z",
"url": "https://files.pythonhosted.org/packages/23/91/299ff776fbbeec4ca3885b760e72276edaf418adf8ce08b489c3d3945495/lihzahrd-3.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-17 17:32:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Steffo99",
"github_project": "lihzahrd",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "lihzahrd"
}