AdsorPy 1.2.2__tar.gz → 1.2.2a4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. adsorpy-1.2.2a4/.github/CODEOWNERS +1 -0
  2. adsorpy-1.2.2a4/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
  3. adsorpy-1.2.2a4/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. adsorpy-1.2.2a4/.github/PULL_REQUEST_TEMPLATE.md +19 -0
  5. adsorpy-1.2.2a4/.github/dependabot.yml +38 -0
  6. adsorpy-1.2.2a4/.github/pr-prefix-labeller.yml +17 -0
  7. adsorpy-1.2.2a4/.github/workflows/codeql.yml +77 -0
  8. adsorpy-1.2.2a4/.github/workflows/dependency-review.yml +27 -0
  9. adsorpy-1.2.2a4/.github/workflows/docs-ci.yml +76 -0
  10. adsorpy-1.2.2a4/.github/workflows/publish_to_PyPI.yml +387 -0
  11. adsorpy-1.2.2a4/.github/workflows/scorecard.yml +83 -0
  12. adsorpy-1.2.2a4/.github/workflows/tests-ci.yml +72 -0
  13. adsorpy-1.2.2a4/.pre-commit-config.yaml +10 -0
  14. adsorpy-1.2.2a4/CHANGELOG.md +138 -0
  15. adsorpy-1.2.2a4/CODE_OF_CONDUCT.md +128 -0
  16. adsorpy-1.2.2a4/CONTRIBUTING.md +151 -0
  17. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/PKG-INFO +2 -1
  18. adsorpy-1.2.2a4/SECURITY.md +48 -0
  19. adsorpy-1.2.2a4/audit_trail.txt +2259 -0
  20. adsorpy-1.2.2a4/dist1/adsorpy-1.2.2a4-py3-none-any.whl +0 -0
  21. adsorpy-1.2.2a4/dist1/adsorpy-1.2.2a4.tar.gz +0 -0
  22. adsorpy-1.2.2a4/docs/Makefile +20 -0
  23. adsorpy-1.2.2a4/docs/make.bat +35 -0
  24. adsorpy-1.2.2a4/docs/source/adsorpy.molecule_lib.rst +7 -0
  25. adsorpy-1.2.2a4/docs/source/adsorpy.randomsequentialadsorption.rst +7 -0
  26. adsorpy-1.2.2a4/docs/source/adsorpy.rsa_calculator.rst +7 -0
  27. adsorpy-1.2.2a4/docs/source/adsorpy.rsa_config.rst +7 -0
  28. adsorpy-1.2.2a4/docs/source/adsorpy.rst +28 -0
  29. adsorpy-1.2.2a4/docs/source/adsorpy.run_simulation.rst +7 -0
  30. adsorpy-1.2.2a4/docs/source/adsorpy.types.rst +7 -0
  31. adsorpy-1.2.2a4/docs/source/conf.py +121 -0
  32. adsorpy-1.2.2a4/docs/source/index.rst +28 -0
  33. adsorpy-1.2.2a4/docs/source/modules.rst +7 -0
  34. adsorpy-1.2.2a4/images/AdsorPy_Covered_Surface.png +0 -0
  35. adsorpy-1.2.2a4/py.typed +0 -0
  36. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/pyproject.toml +6 -11
  37. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/sbom.cdx.json +115 -7
  38. adsorpy-1.2.2a4/src/__init__.py +0 -0
  39. adsorpy-1.2.2a4/src/__main__.py +8 -0
  40. adsorpy-1.2.2a4/tach.toml +35 -0
  41. adsorpy-1.2.2a4/tests/__init__.py +0 -0
  42. adsorpy-1.2.2a4/tests/rsa_test.py +659 -0
  43. adsorpy-1.2.2a4/tests/run_simulation_test.py +392 -0
  44. adsorpy-1.2.2a4/tests/test_data/config_test_hard.json +56 -0
  45. adsorpy-1.2.2a4/tests/test_data/config_test_periodic.json +56 -0
  46. adsorpy-1.2.2a4/tests/test_data/config_test_soft.json +56 -0
  47. adsorpy-1.2.2a4/tests/xyz_fuzzer_test.py +134 -0
  48. adsorpy-1.2.2a4/tox.toml +44 -0
  49. adsorpy-1.2.2a4/uv.lock +3245 -0
  50. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/LICENSE.md +0 -0
  51. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/README.md +0 -0
  52. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/VdW_Radii.csv +0 -0
  53. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/__init__.py +0 -0
  54. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/config.json +0 -0
  55. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/molecule_colour.json +0 -0
  56. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/molecule_lib.py +0 -0
  57. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/randomsequentialadsorption.py +0 -0
  58. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/rsa_calculator.py +0 -0
  59. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/rsa_config.py +0 -0
  60. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/run_simulation.py +0 -0
  61. {adsorpy-1.2.2 → adsorpy-1.2.2a4}/src/adsorpy/types.py +0 -0
@@ -0,0 +1 @@
1
+ * @JoostFWMaas
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: "[BUG]"
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. NixOS]
28
+ - Python version [e.g. 3.14]
29
+ - adsorpy version [e.g. 1.1.4]
30
+
31
+ **Additional context**
32
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,19 @@
1
+ All Submissions:
2
+
3
+ * [ ] Have you followed the guidelines in our Contributing document?
4
+ * [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change?
5
+
6
+ <!-- You can erase any parts of this template not applicable to your Pull Request. -->
7
+
8
+ ### New Feature Submissions:
9
+
10
+ 1. [ ] Does your submission pass all ``pytest`` tests?
11
+ 2. [ ] Have you lint your code locally before submission?
12
+ 3. [ ] Does your code pass the ``mypy``, ``pyright``, ``tach``, ``slotscheck``, and ``ruff`` checks?
13
+
14
+ ### Changes to Core Features:
15
+
16
+ * [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
17
+ * [ ] Have you written new tests for your core changes, as applicable?
18
+ * [ ] Have you successfully run tests with your changes locally?
19
+ * [ ] Does your code pass all checks and tests with ``tox``?
@@ -0,0 +1,38 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+
8
+ updates:
9
+ - package-ecosystem: "pip" # See documentation for possible values
10
+ directory: "/" # Location of package manifests
11
+ schedule:
12
+ interval: "weekly"
13
+
14
+ groups:
15
+ python-dependencies:
16
+ patterns:
17
+ - "*"
18
+
19
+ commit-message:
20
+ prefix: "deps"
21
+
22
+ labels:
23
+ - "dependencies"
24
+
25
+ rebase-strategy: "auto"
26
+
27
+ ignore: # Does not automatically push major version updates. Those can break things.
28
+ - dependency-name: "*"
29
+ update-types: [ "version-update:semver-major" ]
30
+
31
+
32
+ # Enable version updates for GitHub Actions
33
+ - package-ecosystem: "github-actions"
34
+ # Workflow files stored in the default location of `.github/workflows`
35
+ # You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
36
+ directory: "/"
37
+ schedule:
38
+ interval: "weekly"
@@ -0,0 +1,17 @@
1
+ "API": "30 - API"
2
+ "BENCH": "28 - Benchmark"
3
+ "BLD": "36 - Build"
4
+ "BUG": "00 - Bug"
5
+ "DEP": "07 - Deprecation"
6
+ "DEV": "16 - Development"
7
+ "DOC": "04 - Documentation"
8
+ "ENH": "01 - Enhancement"
9
+ "MAINT": "03 - Maintenance"
10
+ "MNT": "03 - Maintenance"
11
+ "REL": "14 - Release"
12
+ "REV": "34 - Reversion"
13
+ "STY": "03 - Maintenance"
14
+ "TST": "05 - Testing"
15
+ "TYP": "41 - Static typing"
16
+ "WIP": "25 - WIP"
17
+ # Copied from Numpy
@@ -0,0 +1,77 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: ["main"]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: ["main"]
20
+ schedule:
21
+ - cron: "0 0 * * 1"
22
+
23
+ permissions: {}
24
+
25
+ jobs:
26
+ analyze:
27
+ name: Analyze
28
+ runs-on: ubuntu-latest
29
+ permissions:
30
+ contents: read
31
+ security-events: write
32
+
33
+ strategy:
34
+ fail-fast: false
35
+ matrix:
36
+ language: ["python"]
37
+ # CodeQL supports [ $supported-codeql-languages ]
38
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
39
+
40
+ steps:
41
+ - name: Harden the runner (Audit all outbound calls)
42
+ uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
43
+ with:
44
+ egress-policy: audit
45
+
46
+ - name: Checkout repository
47
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
48
+ with:
49
+ persist-credentials: false
50
+
51
+ # Initializes the CodeQL tools for scanning.
52
+ - name: Initialize CodeQL
53
+ uses: github/codeql-action/init@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
54
+ with:
55
+ languages: ${{ matrix.language }}
56
+ # If you wish to specify custom queries, you can do so here or in a config file.
57
+ # By default, queries listed here will override any specified in a config file.
58
+ # Prefix the list here with "+" to use these queries and those in the config file.
59
+
60
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
61
+ # If this step fails, then you should remove it and run the build manually (see below)
62
+ - name: Autobuild
63
+ uses: github/codeql-action/autobuild@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
64
+ # ℹ️ Command-line programs to run using the OS shell.
65
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
66
+
67
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
68
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
69
+
70
+ # - run: |
71
+ # echo "Run, Build Application using script"
72
+ # ./location_of_script_within_repo/buildscript.sh
73
+
74
+ - name: Perform CodeQL Analysis
75
+ uses: github/codeql-action/analyze@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
76
+ with:
77
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,27 @@
1
+ # Dependency Review Action
2
+ #
3
+ # This Action will scan dependency manifest files that change as part of a Pull Request,
4
+ # surfacing known-vulnerable versions of the packages declared or updated in the PR.
5
+ # Once installed, if the workflow run is marked as required,
6
+ # PRs introducing known-vulnerable packages will be blocked from merging.
7
+ #
8
+ # Source repository: https://github.com/actions/dependency-review-action
9
+ name: 'Dependency Review'
10
+ on: [pull_request]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ dependency-review:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Harden the runner (Audit all outbound calls)
20
+ uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
21
+ with:
22
+ egress-policy: audit
23
+
24
+ - name: 'Checkout Repository'
25
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26
+ - name: 'Dependency Review'
27
+ uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
@@ -0,0 +1,76 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ workflow_dispatch:
7
+
8
+ # Top-level permissions for Pages (recommended)
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ concurrency:
15
+ group: "pages"
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ deploy-docs:
20
+ name: Build and Upload Docs Artifact
21
+ runs-on: ubuntu-latest
22
+ # needs: test
23
+
24
+ steps:
25
+ - name: Harden the runner (Audit all outbound calls)
26
+ uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
27
+ with:
28
+ egress-policy: audit
29
+
30
+ - name: Checkout
31
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32
+
33
+ - name: Set up Python
34
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
35
+ with:
36
+ python-version: "3.14"
37
+
38
+ - name: Set up uv
39
+ uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
40
+
41
+ - name: Install Sphinx and theme
42
+ run: uv sync --frozen --extra docs # Installs adsorpy with [docs] optional requirements.
43
+
44
+ # Optional: configure Pages (sets up base_url, etc.)
45
+ - name: Configure Pages
46
+ uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
47
+
48
+ - name: Build Sphinx docs
49
+ run: |
50
+ mkdir -p public
51
+ uv run python -m sphinx -W docs/source public
52
+
53
+ - name: Upload artifact for Pages
54
+ uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
55
+ with:
56
+ path: ./public
57
+
58
+ deploy:
59
+ name: Deploy to GitHub Pages
60
+ runs-on: ubuntu-latest
61
+ needs: deploy-docs
62
+ environment:
63
+ name: github-pages
64
+ url: ${{ steps.deploy-pages.outputs.page_url }}
65
+ permissions:
66
+ pages: write
67
+ id-token: write
68
+ steps:
69
+ - name: Harden the runner (Audit all outbound calls)
70
+ uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
71
+ with:
72
+ egress-policy: audit
73
+
74
+ - name: Deploy to GitHub Pages
75
+ id: deploy-pages
76
+ uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
@@ -0,0 +1,387 @@
1
+ name: release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ # workflow_dispatch:
7
+
8
+ concurrency:
9
+ group: release-${{ github.ref }}
10
+ cancel-in-progress: true
11
+
12
+ permissions: {}
13
+
14
+ env:
15
+ PACKAGE_NAME: adsorpy
16
+
17
+ jobs:
18
+ build:
19
+ name: build + reproducible artifacts
20
+ runs-on: ubuntu-latest
21
+ outputs:
22
+ hashes: ${{ steps.hash.outputs.hashes }}
23
+
24
+ permissions:
25
+ contents: read
26
+ id-token: write
27
+
28
+ env:
29
+ SOURCE_DATE_EPOCH: "0"
30
+ PYTHONHASHSEED: "0"
31
+ UV_FROZEN: "1"
32
+
33
+ steps:
34
+ - name: Harden runner
35
+ uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5
36
+ with:
37
+ egress-policy: audit
38
+
39
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
40
+
41
+ - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
42
+ with:
43
+ python-version: "3.14"
44
+
45
+ - name: Setup uv
46
+ uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
47
+
48
+ - name: Cache uv
49
+ uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
50
+ with:
51
+ path: ~/.cache/uv
52
+ key: uv-${{ hashFiles('uv.lock') }}
53
+
54
+ # -------------------------------
55
+ # SBOM GENERATION + SIGNING INPUT
56
+ # -------------------------------
57
+ - name: Generate SBOM
58
+ uses: sbomify/sbomify-action@ac8b0d423c90447f3011ef8ab5f9ff2e854c6931
59
+ env:
60
+ LOCK_FILE: uv.lock
61
+ OUTPUT_FILE: sbom.cdx.json
62
+ UPLOAD: false
63
+ COMPONENT_NAME: ${{ env.PACKAGE_NAME }}
64
+ COMPONENT_VERSION: ${{ github.ref_name }}
65
+ ENRICH: true
66
+
67
+ # -------------------------------
68
+ # INSTALL BUILD TOOLS
69
+ # -------------------------------
70
+ - name: Install build and validation tools
71
+ run: |
72
+ set -euo pipefail
73
+ uv sync --frozen --extra dev-misc --no-default-groups
74
+
75
+ # -------------------------------
76
+ # DETERMINISTIC DOUBLE BUILD
77
+ # -------------------------------
78
+ - name: Build #1
79
+ run: |
80
+ set -euo pipefail
81
+ rm -rf dist1 dist2 dist
82
+ mkdir dist1 dist2
83
+ uv run python -m build --outdir dist1
84
+
85
+ - name: Build #2 (candidate reproducible)
86
+ run: |
87
+ set -euo pipefail
88
+ uv run python -m build --outdir dist2
89
+
90
+ - name: Compare builds
91
+ run: |
92
+ set -euo pipefail
93
+ rm -rf reproducibility
94
+ mkdir reproducibility
95
+ sha256sum dist1/*.whl | awk '{print $1}' > reproducibility/hashes1.txt
96
+ sha256sum dist2/*.whl | awk '{print $1}' > reproducibility/hashes2.txt
97
+ diff reproducibility/hashes1.txt reproducibility/hashes2.txt
98
+ echo "Reproducible build OK"
99
+
100
+ - name: Promote reproducible build to dist/
101
+ run: |
102
+ set -euo pipefail
103
+ rm -rf dist
104
+ mv dist2 dist
105
+
106
+
107
+ - name: Generate hashes.txt
108
+ run: |
109
+ set -euo pipefail
110
+ sha256sum dist/*.whl dist/*.tar.gz > hashes.txt
111
+
112
+
113
+ # -------------------------------
114
+ # VALIDATION ON REPRODUCIBLE BUILD
115
+ # -------------------------------
116
+ - name: Twine check
117
+ run: |
118
+ set -euo pipefail
119
+ uv run python -m twine check dist/*
120
+
121
+ - name: Check wheel contents
122
+ run: |
123
+ set -euo pipefail
124
+ uv tool run check-wheel-contents dist/*.whl
125
+
126
+ - name: Smoke test (wheel)
127
+ run: |
128
+ set -euo pipefail
129
+ uv run --no-project pip install dist/*.whl
130
+ uv run --no-project python -c "import ${PACKAGE_NAME}; print(${PACKAGE_NAME}.__version__)"
131
+
132
+ - name: Smoke test (sdist)
133
+ run: |
134
+ set -euo pipefail
135
+ uv run --no-project pip install dist/*.tar.gz
136
+ uv run --no-project python -c "import ${PACKAGE_NAME}; print(${PACKAGE_NAME}.__version__)"
137
+
138
+ - name: Verify version matches tag
139
+ run: |
140
+ set -euo pipefail
141
+ python - <<EOF
142
+ import re
143
+ import sys
144
+ from packaging.version import Version
145
+
146
+ import ${PACKAGE_NAME}
147
+
148
+ expected_raw = "${GITHUB_REF_NAME}"
149
+ actual = Version(${PACKAGE_NAME}.__version__)
150
+
151
+ # Normalize Git tag → PEP 440
152
+ expected = expected_raw
153
+
154
+ # strip leading "v"
155
+ expected = re.sub(r"^v", "", expected)
156
+
157
+ # convert semver prerelease → PEP 440
158
+ expected = expected.replace("-alpha.", "a")
159
+ expected = expected.replace("-beta.", "b")
160
+ expected = expected.replace("-rc.", "rc")
161
+
162
+ # drop build metadata (+...)
163
+ expected = re.sub(r"\+.*$", "", expected)
164
+
165
+ expected = Version(expected)
166
+
167
+ if actual != expected:
168
+ print(f"Version mismatch: {actual} != {expected} (from {expected_raw})")
169
+ sys.exit(1)
170
+
171
+ print(f"Version OK: {actual}")
172
+ EOF
173
+
174
+ - name: Generate base64 subject hashes
175
+ id: hash
176
+ run: |
177
+ set -euo pipefail
178
+ HASHES=$(sha256sum dist/*.whl dist/*.tar.gz | base64 -w0)
179
+ echo "hashes=$HASHES" >> "$GITHUB_OUTPUT"
180
+
181
+ - name: Upload dist artifacts
182
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
183
+ with:
184
+ name: dist
185
+ path: |
186
+ dist/
187
+ hashes.txt
188
+
189
+ - name: Upload SBOM
190
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
191
+ with:
192
+ name: sbom
193
+ path: sbom.cdx.json
194
+
195
+ sign:
196
+ name: sign reproducible artifacts + SBOM
197
+ needs: build
198
+ runs-on: ubuntu-latest
199
+
200
+ permissions:
201
+ id-token: write
202
+ contents: read
203
+
204
+ steps:
205
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
206
+ with:
207
+ name: dist
208
+ path: .
209
+
210
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
211
+ with:
212
+ name: sbom
213
+ path: .
214
+
215
+ - name: List artifacts
216
+ run: |
217
+ echo "Files:"
218
+ find . -maxdepth 2 -type f
219
+
220
+ - name: Sign SBOM (Sigstore)
221
+ uses: sigstore/gh-action-sigstore-python@04cffa1d795717b140764e8b640de88853c92acc
222
+ with:
223
+ inputs: sbom.cdx.json
224
+ staging: false
225
+ verify: true
226
+ verify-cert-identity: https://github.com/${{ github.repository }}/.github/workflows/publish_to_PyPI.yml@${{ github.ref }}
227
+ verify-oidc-issuer: https://token.actions.githubusercontent.com
228
+ upload-signing-artifacts: false
229
+ release-signing-artifacts: false
230
+
231
+ - name: Sign artifacts (Sigstore)
232
+ uses: sigstore/gh-action-sigstore-python@04cffa1d795717b140764e8b640de88853c92acc
233
+ with:
234
+ inputs: dist/*.whl dist/*.tar.gz hashes.txt
235
+ staging: false
236
+ verify: true
237
+ verify-cert-identity: https://github.com/${{ github.repository }}/.github/workflows/publish_to_PyPI.yml@${{ github.ref }}
238
+ verify-oidc-issuer: https://token.actions.githubusercontent.com
239
+ upload-signing-artifacts: false
240
+ release-signing-artifacts: false
241
+
242
+ - name: Upload signed artifacts + SBOM bundles
243
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
244
+ with:
245
+ name: signed-dist
246
+ path: |
247
+ dist/
248
+ hashes.txt
249
+ sbom.cdx.json
250
+ sbom.cdx.json.sigstore.json
251
+
252
+ provenance:
253
+ needs: [build]
254
+ permissions:
255
+ actions: read
256
+ id-token: write
257
+ contents: write
258
+ # uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@f7dd8c54c2067bafc12ca7a55595d5ee9b75204a
259
+ uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0
260
+ with:
261
+ base64-subjects: "${{ needs.build.outputs.hashes }}"
262
+ upload-assets: true
263
+
264
+ publish-testpypi:
265
+ name: publish to TestPyPI
266
+ needs: [build, sign]
267
+ runs-on: ubuntu-latest
268
+ environment:
269
+ name: pypi
270
+
271
+ permissions:
272
+ id-token: write
273
+
274
+ steps:
275
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
276
+ with:
277
+ name: dist
278
+ path: .
279
+
280
+ - name: Show hashes (pre-publish verification)
281
+ run: cat hashes.txt
282
+
283
+ - name: Publish to TestPyPI
284
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
285
+ with:
286
+ repository-url: https://test.pypi.org/legacy/
287
+ print-hash: true
288
+ attestations: true
289
+
290
+ verify-install:
291
+ name: verify install from TestPyPI
292
+ needs: publish-testpypi
293
+ runs-on: ubuntu-latest
294
+
295
+ steps:
296
+ - name: Setup uv
297
+ uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
298
+
299
+ - name: Normalize version
300
+ id: normalize_version
301
+ run: |
302
+ VERSION="${GITHUB_REF_NAME}"
303
+
304
+ VERSION="${VERSION#v}" # strip leading v
305
+ VERSION="${VERSION/-alpha./a}"
306
+ VERSION="${VERSION/-beta./b}"
307
+ VERSION="${VERSION/-rc./rc}"
308
+ VERSION=$(echo "$VERSION" | sed 's/+.*//') # remove build metadata
309
+
310
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
311
+
312
+ - name: Install from TestPyPI
313
+ run: |
314
+ set -euo pipefail
315
+ uv run --no-project pip install \
316
+ --index-url https://test.pypi.org/simple \
317
+ --extra-index-url https://pypi.org/simple \
318
+ ${PACKAGE_NAME}==${{ steps.normalize_version.outputs.version }}
319
+ uv run --no-project python -c "import ${PACKAGE_NAME}; print(${PACKAGE_NAME}.__version__)"
320
+
321
+ - name: Verify import outside project tree
322
+ run: |
323
+ set -euo pipefail
324
+ mkdir /tmp/testimport
325
+ cd /tmp/testimport
326
+ uv run --no-project python -c "import ${PACKAGE_NAME}; print('Import OK')"
327
+
328
+ publish:
329
+ name: publish to PyPI
330
+ needs: verify-install
331
+ runs-on: ubuntu-latest
332
+
333
+ environment:
334
+ name: pypi
335
+
336
+ permissions:
337
+ id-token: write
338
+
339
+ steps:
340
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
341
+ with:
342
+ name: dist
343
+ path: .
344
+
345
+ - name: Verify hashes before publish
346
+ run: |
347
+ set -euo pipefail
348
+ sha256sum -c hashes.txt
349
+
350
+ - name: Publish to PyPI
351
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
352
+ with:
353
+ attestations: true
354
+ print-hash: true
355
+
356
+ create-release:
357
+ name: create immutable GitHub release
358
+ needs: [publish, sign, provenance]
359
+ runs-on: ubuntu-latest
360
+
361
+ permissions:
362
+ contents: write
363
+
364
+ steps:
365
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
366
+ with:
367
+ name: dist
368
+ path: .
369
+
370
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
371
+ with:
372
+ name: signed-dist
373
+ path: signed/
374
+
375
+ - name: Collect release files
376
+ run: |
377
+ set -euo pipefail
378
+ mkdir release-assets
379
+ cp dist/* release-assets/
380
+ cp signed/* release-assets/ || true
381
+
382
+ - name: Create GitHub Release (immutable)
383
+ uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
384
+ with:
385
+ files: release-assets/*
386
+ env:
387
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}