diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..2ba5a48 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,42 @@ +name: Build and upload to PyPI + +on: + workflow_dispatch: + release: + types: + - published + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: astral-sh/setup-uv@v5 + - name: Build sdist and wheel + run: uv build + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/* + + upload_pypi: + needs: [build] + environment: + name: pypi + url: https://pypi.org/p/asebytes + permissions: + id-token: write + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && github.event.action == 'published') + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 09c44c8..ea0aa35 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ benchmark_results.json # Git worktrees .worktrees/ + +# hatch-vcs generated version file +src/asebytes/_version.py diff --git a/pyproject.toml b/pyproject.toml index bc63f89..9f4c60c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "asebytes" -version = "0.3.0" +dynamic = ["version"] description = "Fast binary serialization and storage for ASE Atoms." authors = [ { name = "Fabian Zills", email = "fzills@icp.uni-stuttgart.de" }, @@ -15,8 +15,8 @@ dependencies = [ ] [build-system] -requires = ["uv_build>=0.9.6,<0.10.0"] -build-backend = "uv_build" +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" [dependency-groups] dev = [ @@ -62,6 +62,12 @@ redis = [ "redis>=5.0", ] +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "src/asebytes/_version.py" + [tool.pytest.ini_options] testpaths = ["tests"] python_files = ["test_*.py"] diff --git a/uv.lock b/uv.lock index eccbf3c..9e8ec18 100644 --- a/uv.lock +++ b/uv.lock @@ -194,7 +194,6 @@ wheels = [ [[package]] name = "asebytes" -version = "0.3.0" source = { editable = "." } dependencies = [ { name = "ase" }, @@ -250,7 +249,7 @@ requires-dist = [ { name = "typing-extensions", specifier = ">=4.5.0" }, { name = "zarr", marker = "extra == 'zarr'", specifier = ">=3.0" }, ] -provides-extras = ["lmdb", "hf", "h5", "zarr", "mongodb", "redis"] +provides-extras = ["h5", "hf", "lmdb", "mongodb", "redis", "zarr"] [package.metadata.requires-dev] dev = [