Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .bumpversion.cfg

This file was deleted.

109 changes: 73 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,73 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create release

jobs:
build:
name: Creating Release

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
pip install wheel twine

- name: Publishing
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py bdist_wheel
python setup.py sdist
twine upload dist/*
name: CI

on:
push:
branches: [master]
pull_request:
release:
types: [published]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.11"]

steps:
- uses: actions/checkout@v7

- name: Install uv
uses: astral-sh/setup-uv@v8.3.2
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Run tests
run: uv run --extra test pytest

build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: Install uv
uses: astral-sh/setup-uv@v8.3.2
with:
enable-cache: true

- name: Build sdist and wheel
run: uv build

- uses: actions/upload-artifact@v7
with:
name: dist
path: ./dist/*

publish:
name: Publish to PyPI
needs: [test, build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.repository == 'TkTech/PyNBT'
environment:
name: pypi
url: https://pypi.org/p/PyNBT
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist

- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
30 changes: 0 additions & 30 deletions .github/workflows/test.yml

This file was deleted.

17 changes: 14 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
*.swp
*.swo
*.pyc
build/*
*.pyd
*.so
__pycache__/
.pytest_cache/
build/
_build/
dist/
wheelhouse/
*.egg-info
.eggs
.venv/
venv
ENV/
uv.lock
__test__.nbt
*.egg-info
.ropeproject
.idea
.DS_Store
venv
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
![Run tests](https://github.com/TkTech/PyNBT/workflows/Run%20tests/badge.svg?event=push)
![CI](https://github.com/TkTech/PyNBT/actions/workflows/release.yml/badge.svg)

# PyNBT

PyNBT is a tiny, liberally licenced (MIT) NBT library.
It supports reading and writing big endian or little endian NBT files.
Tested and supported on Py3.5-Py3.9, pypy3.
Tested and supported on CPython 3.9-3.14 and PyPy.

## Using the Library
Using the library in your own programs is simple and is capable of reading, modifying, and saving NBT files.
Expand Down
1 change: 1 addition & 0 deletions pynbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Implements reading & writing for the Named Binary Tag (NBT) format used
in Minecraft.
"""
__version__ = "3.1.0"
__all__ = (
'NBTFile',
'TAG_Byte',
Expand Down
57 changes: 57 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[build-system]
requires = ["setuptools>=77"]
build-backend = "setuptools.build_meta"

[project]
name = "PyNBT"
dynamic = ["version"]
description = "Tiny, liberally-licensed NBT library (Minecraft)."
readme = "README.md"
requires-python = ">=3.9"
license = "MIT"
license-files = ["LICENCE"]
authors = [{ name = "Tyler Kennedy", email = "tk@tkte.ch" }]
keywords = ["minecraft", "nbt"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = ["mutf8>=1.1.0"]

[project.optional-dependencies]
test = ["pytest"]

[project.urls]
Homepage = "https://github.com/TkTech/PyNBT"
Source = "https://github.com/TkTech/PyNBT"
Issues = "https://github.com/TkTech/PyNBT/issues"

[tool.setuptools]
py-modules = ["pynbt"]

[tool.setuptools.dynamic]
version = { attr = "pynbt.__version__" }

[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.bumpversion]
current_version = "3.1.0"
commit = true
tag = true
tag_name = "v{new_version}"
allow_dirty = false

[[tool.bumpversion.files]]
filename = "pynbt.py"
31 changes: 0 additions & 31 deletions setup.py

This file was deleted.