{"id":16713950,"url":"https://github.com/tktech/pynbt","last_synced_at":"2025-07-24T09:37:50.302Z","repository":{"id":2132043,"uuid":"3075313","full_name":"TkTech/PyNBT","owner":"TkTech","description":"Tiny NBT library. NBT is the datafile format used in Minecraft.","archived":false,"fork":false,"pushed_at":"2023-07-05T13:53:33.000Z","size":91,"stargazers_count":51,"open_issues_count":1,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-24T10:56:20.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://tkte.ch","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TkTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"TkTech","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2011-12-30T16:27:49.000Z","updated_at":"2025-05-30T13:07:30.000Z","dependencies_parsed_at":"2024-06-20T22:08:05.104Z","dependency_job_id":null,"html_url":"https://github.com/TkTech/PyNBT","commit_stats":{"total_commits":100,"total_committers":7,"mean_commits":"14.285714285714286","dds":0.08999999999999997,"last_synced_commit":"bd7e545fee00e509276ee3dc90cb23949e450cda"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/TkTech/PyNBT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2FPyNBT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2FPyNBT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2FPyNBT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2FPyNBT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TkTech","download_url":"https://codeload.github.com/TkTech/PyNBT/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TkTech%2FPyNBT/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266822361,"owners_count":23989825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T20:48:38.860Z","updated_at":"2025-07-24T09:37:48.552Z","avatar_url":"https://github.com/TkTech.png","language":"Python","funding_links":["https://github.com/sponsors/TkTech"],"categories":[],"sub_categories":[],"readme":"![Run tests](https://github.com/TkTech/PyNBT/workflows/Run%20tests/badge.svg?event=push)\n\n# PyNBT\n\nPyNBT is a tiny, liberally licenced (MIT) NBT library.\nIt supports reading and writing big endian or little endian NBT files.\nTested and supported on Py3.5-Py3.9, pypy3.\n\n## Using the Library\nUsing the library in your own programs is simple and is capable of reading, modifying, and saving NBT files.\n\n### Writing\n\n**NOTE**: Beginning with version 1.1.0, names are optional for TAG_*'s that are added to a TAG_Compound, as they will be given the same name as their key. If you do\nspecify a name, it will be used instead. This breaks compatibility with old code, as the position of the `name` and `value` parameter have now swapped.\n\n```python\nfrom pynbt import NBTFile, TAG_Long, TAG_List, TAG_String\n\nvalue = {\n    'long_test': TAG_Long(104005),\n    'list_test': TAG_List(TAG_String, [\n        'Timmy',\n        'Billy',\n        'Sally'\n    ])\n}\n\nnbt = NBTFile(value=value)\nwith open('out.nbt', 'wb') as io:\n  nbt.save(io)\n```\n\n### Reading\n\nReading is simple, and will accept any file-like object providing `read()`.\nSimply pretty-printing the file created from the example under writing:\n\n```python\nfrom pynbt import NBTFile\n\nwith open('out.nbt', 'rb') as io:\n  nbt = NBTFile(io)\n  print(nbt.pretty())\n```\n\nThis produces the output:\n\n```\nTAG_Compound(''): 2 entries\n{\n  TAG_Long('long_test'): 104005\n  TAG_List('list_test'): 3 entries\n  {\n    TAG_String(None): 'Timmy'\n    TAG_String(None): 'Billy'\n    TAG_String(None): 'Sally'\n  }\n}\n```\n\nEvery tag exposes a minimum of two fields, `.name` and `.value`. Every tag's value maps to a plain Python type, such as a `dict()` for `TAG_Compound` and a `list()` for `TAG_List`. Every tag\nalso provides complete `__repr__` methods for printing. This makes traversal very simple and familiar to existing Python developers.\n\n```python\nwith open('out.nbt', 'rb') as io:\n  nbt = NBTFile(io)\n  # Iterate over every TAG in the root compound as you would any other dict\n  for name, tag in nbt.items():\n      print(name, tag)\n\n  # Print every tag in a list\n  for tag in nbt['list_test']:\n      print(tag)\n```\n\n## Changelog\n\nThese changelogs are summaries only and not comprehensive. See\nthe commit history between tags for full changes.\n\n### v3.0.0\n- TAG_Byte_Array now returns and accepts `bytearray()`, rather than a list\n  of bytes (#18).\n\n### v2.0.0\n- Py2 is no longer supported.\n\n### v1.4.0\n- **Removed** pocket detection helpers and ``RegionFile``, leaving PyNBT to\n  **only** handle NBT.\n- Added a simple unicode test.\n\n### v1.3.0\n\n- Internal cleanups in ``nbt.py`` to ease some C work.\n- ``NBTFile.__init__()`` and ``NBTFile.save()``'s arguments have changed.\n  For most cases changing ``compressed=True`` to ``NBTFIle.Compression.GZIP``\n  will suffice.\n- ``NBTFile.__init__()`` and ``NBTFile.save()`` no longer accept paths,\n  instead accepting only file-like objects implementing ``read()`` and\n  ``write()``, respectively.\n- ``name`` must now be provided at construction or before saving of an\n  ``NBTFile()`` (defaults to ``None`` instead of '').\n\n### v1.2.\n\n- TAG_List's values no longer need to be ``TAG_*`` objects. They\n  will be converted when the tag is saved. This allows much  easier lists of\n  native types.\n\n### v1.2.0\n\n- Internal code cleanup. Breaks compatibility with pocket loading\n  and saving (to be reimplemented as helpers).\n- Slight speed improvements.\n- TAG_List can now be treated as a plain python list (`.value` points to `self`)\n\n### v1.1.0\n\n- Breaks compatibility with older code, but allows much more\n  convenient creation of `TAG_Compound`. `name` and `value` have in most cases\n  swapped spots.\n- `name` is now the last argument of every `TAG_*`, and\n  optional for children of a `TAG_Compound`. Instead, they'll be given the key\n  they're assigned to as a name.\n- `TAG_Compound`s can now be treated like\n  dictionaries for convienience. `.value` simply maps to itself.\n\n### v1.0.1\n\n- Small bugfixes. \n- Adds support for `TAG_Int_Array`.\n\n### v1.0.0\n\n- First release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftktech%2Fpynbt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftktech%2Fpynbt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftktech%2Fpynbt/lists"}