Skip to content

Commit ab2b554

Browse files
Merge pull request #5 from datajoint/ci/pypi-release
ci: add a PyPI release workflow, and modernize the license declaration
2 parents 9761c9f + 000e582 commit ab2b554

4 files changed

Lines changed: 85 additions & 30 deletions

File tree

.github/workflows/cd.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CD
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
FORCE_COLOR: 3
19+
20+
jobs:
21+
dist:
22+
name: Distribution build
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v6
27+
with:
28+
fetch-depth: 0
29+
30+
# v3 ships Twine 7, which understands packaging metadata 2.4/2.5 — what a
31+
# PEP 639 SPDX license declaration produces. v2 bundles Twine 6 and fails
32+
# `twine check --strict`. v3 no longer force-tags majors, so pin in full.
33+
- uses: hynek/build-and-inspect-python-package@v3.0.1
34+
35+
publish:
36+
needs: [dist]
37+
name: Publish to PyPI
38+
environment: pypi
39+
permissions:
40+
# Trusted publishing: PyPI verifies this workflow's OIDC identity, so no
41+
# API token is stored anywhere. Requires a pending publisher configured on
42+
# PyPI for this project before the first release.
43+
id-token: write
44+
attestations: write
45+
contents: read
46+
runs-on: ubuntu-latest
47+
if: github.event_name == 'release' && github.event.action == 'published'
48+
49+
steps:
50+
- uses: actions/download-artifact@v8
51+
with:
52+
name: Packages
53+
path: dist
54+
55+
- name: Generate artifact attestation for sdist and wheel
56+
uses: actions/attest-build-provenance@v4
57+
with:
58+
subject-path: "dist/*"
59+
60+
- uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
1+
# Generated by the hatch-vcs build hook — the git tag is the source of truth
2+
src/**/_version.py
53

6-
# Distribution / packaging
7-
dist/
4+
# Build artifacts
85
build/
6+
dist/
97
*.egg-info/
10-
*.egg
11-
12-
# Virtual environments
8+
__pycache__/
9+
*.py[cod]
1310
.venv/
14-
venv/
15-
ENV/
16-
17-
# IDE
18-
.idea/
19-
.vscode/
20-
*.swp
21-
*.swo
22-
23-
# Testing
2411
.pytest_cache/
25-
.coverage
26-
htmlcov/
27-
28-
# OS
29-
.DS_Store
30-
Thumbs.db
12+
.ruff_cache/
13+
.mypy_cache/

pyproject.toml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
[build-system]
2-
requires = ["hatchling"]
2+
requires = ["hatchling>=1.27", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

55
[project]
66
name = "dj-figpack-codecs"
7-
version = "0.2.0"
87
description = "DataJoint codec for storing figpack visualizations in schema-addressed OAS"
98
readme = "README.md"
10-
license = { file = "LICENSE" }
9+
license = "Apache-2.0"
10+
license-files = ["LICENSE"]
1111
requires-python = ">=3.10"
12+
dynamic = ["version"]
1213
authors = [
1314
{ name = "DataJoint", email = "info@datajoint.com" }
1415
]
1516
keywords = ["datajoint", "figpack", "visualization", "neuroscience"]
1617
classifiers = [
1718
"Development Status :: 3 - Alpha",
1819
"Intended Audience :: Science/Research",
19-
"License :: OSI Approved :: Apache Software License",
2020
"Programming Language :: Python :: 3",
2121
"Programming Language :: Python :: 3.10",
2222
"Programming Language :: Python :: 3.11",
2323
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
25+
"Programming Language :: Python :: 3.14",
2426
"Topic :: Scientific/Engineering",
2527
]
2628

@@ -65,3 +67,12 @@ addopts = "-v"
6567
[tool.black]
6668
line-length = 100
6769
target-version = ["py310"]
70+
71+
# The git tag is the single source of truth for the version — mirrors dj-zarr-codecs.
72+
# The build hook writes _version.py, which the package imports, so nothing declares a
73+
# version twice and nothing needs bumping in a pull request.
74+
[tool.hatch.version]
75+
source = "vcs"
76+
77+
[tool.hatch.build.hooks.vcs]
78+
version-file = "src/dj_figpack_codecs/_version.py"

src/dj_figpack_codecs/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ def make(self, key):
4141

4242
from .codec import FigpackCodec
4343
from .ref import FigpackRef
44+
from ._version import version as __version__
4445

45-
__all__ = ["FigpackCodec", "FigpackRef", "__version__"]
46+
__all__ = ["__version__", "FigpackCodec", "FigpackRef", "__version__"]

0 commit comments

Comments
 (0)