From 558b0ea04416004021bd681834607a80d52b0d0f Mon Sep 17 00:00:00 2001 From: peunsu <44690893+peunsu@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:36:19 +0000 Subject: [PATCH 1/6] Update README.md and add GitHub Actions ci. --- .github/workflows/wheels.yml | 31 +++++++++++++++++++++++++++++++ README.md | 10 ++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 0000000..5d75c4c --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,31 @@ +name: Build + +on: [push, pull_request] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + + steps: + - uses: actions/checkout@v4 + + # Used to host cibuildwheel + - uses: actions/setup-python@v3 + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.16.5 + + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + # to supply options, put them in 'env', like: + # env: + # CIBW_SOME_OPTION: value + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/README.md b/README.md index 9f37298..5dab503 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,12 @@ This is the example of the FTB snbt tag: **This library is only for the FTB snbt tag**. If you are finding the snbt library for the "vanilla" snbt tag, use [nbtlib](https://github.com/vberlier/nbtlib) by [vberlier](https://github.com/vberlier). +## Installation +The package can be installed with ``pip``. +```bash +$ pip install ftb_snbt_lib +``` + ## Getting Started * Import the library. ```python @@ -29,7 +35,7 @@ This is the example of the FTB snbt tag: >>> some_snbt = ftb_snbt_lib.load(open("tests/some_file.snbt", "r", encoding="utf-8")) ``` * The type of returned value is ``Compound``, a dictionary-like object.
-The ``Compound`` is containing values with **custom data types** provided by this library. +The ``Compound`` is containing values with **[tag data types](#data-types)** provided by this library. ```python >>> type(some_snbt) @@ -63,7 +69,7 @@ Compound({'some_tag': String('some_value'), 'another_tag': Byte(1)}) ``` * Edit the snbt tag. As its type is ``Compound``, it can be edited like a dictionary.
-The inserted or replace values should be any of **custom data types** provided by this library. +The inserted or replace values should be any of **[tag data types](#data-types)** provided by this library. ```python >>> another_snbt["some_tag"] = ftb_snbt_lib.String("another_value") ``` From af8842e0ebc13668d5d3713bc5a619a87a85c17f Mon Sep 17 00:00:00 2001 From: peunsu <44690893+peunsu@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:43:55 +0000 Subject: [PATCH 2/6] Fix actions. --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index e074141..03d26a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,5 +35,8 @@ homepage = "https://github.com/peunsu/ftb-snbt-lib" repository = "https://github.com/peunsu/ftb-snbt-lib" documentation = "https://github.com/peunsu/ftb-snbt-lib" +[tool.setuptools] +py_modules = ["ftb_snbt_lib"] + [tool.setuptools.dynamic] version = {attr = "ftb_snbt_lib.__version__"} \ No newline at end of file From e9b6f65d7f87abd6d2ad3589d21027e4cf106e3c Mon Sep 17 00:00:00 2001 From: peunsu <44690893+peunsu@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:45:45 +0000 Subject: [PATCH 3/6] Fix actions. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 03d26a7..aaa8d48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ repository = "https://github.com/peunsu/ftb-snbt-lib" documentation = "https://github.com/peunsu/ftb-snbt-lib" [tool.setuptools] -py_modules = ["ftb_snbt_lib"] +py-modules = ["ftb_snbt_lib"] [tool.setuptools.dynamic] version = {attr = "ftb_snbt_lib.__version__"} \ No newline at end of file From 67c42c0a6d7b6ee9a62dabec38b75ad4497fda69 Mon Sep 17 00:00:00 2001 From: peunsu <44690893+peunsu@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:39:25 +0000 Subject: [PATCH 4/6] Update Github Actions --- .github/workflows/build.yml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/wheels.yml | 31 ------------------------------- 3 files changed, 64 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e893081 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: Build + +on: [push, pull_request] + +jobs: + build_wheel: + name: Build wheel + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build package + run: python -m build + + - name: Upload wheel + uses: actions/upload-artifact@v4 + with: + name: ci-wheels-${{ strategy.job-index }} + path: ./dist/*.whl \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a788c52 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,31 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + deploy: + name: Build wheel + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build package + run: python -m build + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml deleted file mode 100644 index 5d75c4c..0000000 --- a/.github/workflows/wheels.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Build - -on: [push, pull_request] - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-14] - - steps: - - uses: actions/checkout@v4 - - # Used to host cibuildwheel - - uses: actions/setup-python@v3 - - - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.16.5 - - - name: Build wheels - run: python -m cibuildwheel --output-dir wheelhouse - # to supply options, put them in 'env', like: - # env: - # CIBW_SOME_OPTION: value - - - uses: actions/upload-artifact@v4 - with: - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} - path: ./wheelhouse/*.whl \ No newline at end of file From 2d6326cd830bd1e39150037becc41d20f350f8c3 Mon Sep 17 00:00:00 2001 From: peunsu <44690893+peunsu@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:47:29 +0000 Subject: [PATCH 5/6] update github actions --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index aaa8d48..e074141 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,8 +35,5 @@ homepage = "https://github.com/peunsu/ftb-snbt-lib" repository = "https://github.com/peunsu/ftb-snbt-lib" documentation = "https://github.com/peunsu/ftb-snbt-lib" -[tool.setuptools] -py-modules = ["ftb_snbt_lib"] - [tool.setuptools.dynamic] version = {attr = "ftb_snbt_lib.__version__"} \ No newline at end of file From e32b06744f1d0086f12ea4ddf580ae7382e5a8db Mon Sep 17 00:00:00 2001 From: peunsu <44690893+peunsu@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:49:39 +0000 Subject: [PATCH 6/6] Update github actions. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e893081..aa2a5f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build -on: [push, pull_request] +on: push jobs: build_wheel: