tempnet 1.0.0rc2__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.
@@ -0,0 +1,157 @@
1
+ name: Development Workflow
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened, edited, ready_for_review]
6
+ branches:
7
+ - main
8
+
9
+ permissions:
10
+ pull-requests: write
11
+ contents: write
12
+
13
+ jobs:
14
+ determine-python-version:
15
+ runs-on: ubuntu-24.04
16
+ outputs:
17
+ version: ${{ steps.pyver.outputs.version }}
18
+ steps:
19
+ - uses: actions/checkout@v5
20
+
21
+ - name: Determine minimum Python version from pyproject.toml
22
+ id: pyver
23
+ run: |
24
+ py_req=$(sed -n 's/^[[:space:]]*requires-python[[:space:]]*=[[:space:]]*"\(.*\)".*/\1/p' pyproject.toml | head -n1)
25
+ py_min=$(echo "$py_req" | sed -n 's/.*>=[[:space:]]*\([0-9]\+\.[0-9]\+\).*/\1/p')
26
+ if [ -z "$py_min" ]; then
27
+ echo "Could not parse minimum Python version from requires-python='$py_req'" >&2
28
+ exit 1
29
+ fi
30
+ echo "version=$py_min" >> "$GITHUB_OUTPUT"
31
+ echo "Resolved minimum Python: $py_min"
32
+
33
+ setup-and-test:
34
+ if: github.event.pull_request.draft == false
35
+ runs-on: ubuntu-24.04
36
+ needs: [determine-python-version]
37
+ steps:
38
+ - uses: actions/checkout@v5
39
+
40
+ - name: Install Intel MKL
41
+ run: |
42
+ sudo apt-get update
43
+ sudo apt-get -y install intel-mkl
44
+
45
+ - name: Install uv
46
+ uses: astral-sh/setup-uv@v5
47
+ with:
48
+ enable-cache: true
49
+ cache-dependency-glob: "pyproject.toml"
50
+
51
+ - name: Set up Python
52
+ run: uv python install ${{ needs.determine-python-version.outputs.version }}
53
+
54
+ - name: Install project and dev dependencies
55
+ run: |
56
+ uv venv --python ${{ needs.determine-python-version.outputs.version }} .venv
57
+ source .venv/bin/activate
58
+ uv pip install -e . --group dev
59
+
60
+ - name: Build wheel
61
+ run: uv build
62
+
63
+ - name: Upload wheel
64
+ uses: actions/upload-artifact@v4
65
+ with:
66
+ name: wheel
67
+ path: dist
68
+ retention-days: 1
69
+
70
+ - name: Lint with ruff
71
+ run: uv run ruff check --select=ALL --output-format=github src/
72
+ continue-on-error: true
73
+
74
+ - name: Tests without memory tracking
75
+ run: |
76
+ uv run pytest --junitxml=junit/test-results.xml --cov=tempnet --durations=0 -k 'not _memory' \
77
+ || { code=$?; [ $code -eq 5 ] && exit 0 || exit $code; }
78
+ env:
79
+ COVERAGE_FILE: ".coverage.no_memory"
80
+
81
+ - name: Store coverage file
82
+ if: always()
83
+ uses: actions/upload-artifact@v4
84
+ with:
85
+ name: coverage-no_memory
86
+ path: .coverage.no_memory
87
+ include-hidden-files: true
88
+
89
+ test-memory:
90
+ if: github.event.pull_request.draft == false
91
+ runs-on: ubuntu-24.04
92
+ needs: [determine-python-version]
93
+ steps:
94
+ - uses: actions/checkout@v5
95
+
96
+ - name: Install Intel MKL
97
+ run: |
98
+ sudo apt-get update
99
+ sudo apt-get -y install intel-mkl
100
+
101
+ - name: Install uv
102
+ uses: astral-sh/setup-uv@v5
103
+ with:
104
+ enable-cache: true
105
+ cache-dependency-glob: "pyproject.toml"
106
+
107
+ - name: Set up Python
108
+ run: uv python install ${{ needs.determine-python-version.outputs.version }}
109
+
110
+ - name: Install project and dev dependencies
111
+ run: |
112
+ uv venv --python ${{ needs.determine-python-version.outputs.version }} .venv
113
+ source .venv/bin/activate
114
+ uv pip install -e . --group dev
115
+
116
+ - name: Tests memory tracking
117
+ run: |
118
+ uv run pytest --junitxml=junit/test-results.xml --cov=tempnet --durations=0 --memray --most-allocations=0 -k '_memory' \
119
+ || { code=$?; [ $code -eq 5 ] && exit 0 || exit $code; }
120
+ env:
121
+ COVERAGE_FILE: ".coverage.memory"
122
+
123
+ - name: Store coverage file
124
+ if: always()
125
+ uses: actions/upload-artifact@v4
126
+ with:
127
+ name: coverage-memory
128
+ path: .coverage.memory
129
+ include-hidden-files: true
130
+
131
+ coverage:
132
+ if: always() && github.event.pull_request.draft == false
133
+ name: combine-coverage
134
+ runs-on: ubuntu-24.04
135
+ needs: [setup-and-test, test-memory]
136
+ permissions:
137
+ pull-requests: write
138
+ contents: write
139
+ steps:
140
+ - uses: actions/checkout@v5
141
+ - uses: actions/download-artifact@v4
142
+ with:
143
+ pattern: coverage-*
144
+ merge-multiple: true
145
+ - name: Coverage comment
146
+ id: coverage_comment
147
+ uses: py-cov-action/python-coverage-comment-action@v3
148
+ with:
149
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
150
+ MERGE_COVERAGE_FILES: true
151
+
152
+ - name: Store Pull Request comment
153
+ uses: actions/upload-artifact@v4
154
+ if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
155
+ with:
156
+ name: python-coverage-comment-action
157
+ path: python-coverage-comment-action.txt
@@ -0,0 +1,105 @@
1
+ # Release workflow: builds a wheel + sdist, creates a GitHub Release with
2
+ # auto-generated notes, and publishes to PyPI via OIDC trusted publishing.
3
+ # The PyPI publish step is gated on the ``pypi`` GitHub environment, which
4
+ # is configured (in repo settings) to require manual reviewer approval.
5
+ #
6
+ # Tag conventions (no ``v`` prefix; SemVer-style):
7
+ # 1.2.3 -- final release
8
+ # 1.2.3-rc1 -- pre-releases (alpha / beta / rc; PEP 440 normalises
9
+ # ``1.2.3-rc1`` to ``1.2.3rc1`` for the wheel version)
10
+ #
11
+ # Prerequisites (configured outside this workflow):
12
+ # * PyPI trusted publisher: workflow=release.yml, environment=pypi
13
+ # * GitHub environment ``pypi`` with required reviewers
14
+ # * Tag protection rule for the patterns below
15
+
16
+ name: Release
17
+
18
+ on:
19
+ push:
20
+ tags:
21
+ - '[0-9]+.[0-9]+.[0-9]+'
22
+ - '[0-9]+.[0-9]+.[0-9]+-[abr]*'
23
+
24
+ permissions:
25
+ contents: read
26
+
27
+ jobs:
28
+ guard_main:
29
+ # Refuse to release from a tag that does not point at a commit on main.
30
+ # Prevents accidental releases from feature branches or stale tags.
31
+ name: Verify tag is on main
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ with:
36
+ fetch-depth: 0
37
+ - name: Check tag commit is an ancestor of origin/main
38
+ run: |
39
+ git fetch origin main
40
+ if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
41
+ echo "::error::Tag commit $GITHUB_SHA is not on origin/main; refusing to release."
42
+ exit 1
43
+ fi
44
+
45
+ build:
46
+ name: Build artifacts
47
+ needs: guard_main
48
+ runs-on: ubuntu-latest
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+ with:
52
+ # hatch-vcs needs the full history (or at least tags) to resolve
53
+ # the version dynamically.
54
+ fetch-depth: 0
55
+
56
+ - name: Build wheel and sdist
57
+ run: pipx run build
58
+
59
+ - uses: actions/upload-artifact@v4
60
+ with:
61
+ name: dist-${{ github.ref_name }}
62
+ path: dist/*
63
+
64
+ create_github_release:
65
+ name: Create GitHub Release
66
+ needs: build
67
+ runs-on: ubuntu-latest
68
+ permissions:
69
+ contents: write
70
+ steps:
71
+ - uses: actions/download-artifact@v4
72
+ with:
73
+ pattern: dist-*
74
+ path: dist
75
+ merge-multiple: true
76
+
77
+ - name: Create release
78
+ uses: softprops/action-gh-release@v2
79
+ with:
80
+ generate_release_notes: true
81
+ files: dist/*
82
+ # Mark pre-releases (anything with a/b/rc in the tag) appropriately
83
+ # so PyPI/users see the right channel.
84
+ prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
85
+
86
+ publish_pypi:
87
+ name: Publish to PyPI
88
+ needs: create_github_release
89
+ runs-on: ubuntu-latest
90
+ environment:
91
+ name: pypi
92
+ url: https://pypi.org/p/tempnet
93
+ permissions:
94
+ id-token: write # OIDC for trusted publishing
95
+ attestations: write # sigstore provenance attestations
96
+ steps:
97
+ - uses: actions/download-artifact@v4
98
+ with:
99
+ pattern: dist-*
100
+ path: dist
101
+ merge-multiple: true
102
+
103
+ - uses: pypa/gh-action-pypi-publish@release/v1
104
+ with:
105
+ attestations: true
@@ -0,0 +1,118 @@
1
+ name: Status
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ determine-python-version:
10
+ runs-on: ubuntu-24.04
11
+ outputs:
12
+ min-version: ${{ steps.pyver.outputs.version }}
13
+ steps:
14
+ - uses: actions/checkout@v5
15
+
16
+ - name: Determine minimum Python version from pyproject.toml
17
+ id: pyver
18
+ run: |
19
+ py_req=$(sed -n 's/^[[:space:]]*requires-python[[:space:]]*=[[:space:]]*"\(.*\)".*/\1/p' pyproject.toml | head -n1)
20
+ py_min=$(echo "$py_req" | sed -n 's/.*>=[[:space:]]*\([0-9]\+\.[0-9]\+\).*/\1/p')
21
+ if [ -z "$py_min" ]; then
22
+ echo "Could not parse minimum Python version from requires-python='$py_req'" >&2
23
+ exit 1
24
+ fi
25
+ echo "version=$py_min" >> "$GITHUB_OUTPUT"
26
+ echo "Resolved minimum Python: $py_min"
27
+
28
+ unit-tests:
29
+ runs-on: ubuntu-24.04
30
+ needs: [determine-python-version]
31
+ strategy:
32
+ matrix:
33
+ pythonV: ["3.10", "3.11", "3.12", "3.13", "3.14"]
34
+ fail-fast: false
35
+ steps:
36
+ - uses: actions/checkout@v5
37
+ with:
38
+ lfs: 'true'
39
+ submodules: recursive
40
+
41
+ - name: Install Intel MKL
42
+ run: |
43
+ sudo apt-get update
44
+ sudo apt-get -y install intel-mkl
45
+
46
+ - name: Install uv
47
+ uses: astral-sh/setup-uv@v5
48
+ with:
49
+ enable-cache: true
50
+ cache-dependency-glob: "pyproject.toml"
51
+
52
+ - name: Set up Python
53
+ run: uv python install ${{ matrix.pythonV }}
54
+
55
+ - name: Install project and dev dependencies
56
+ # Using `uv venv` + `uv pip install -e .` instead of `uv sync`:
57
+ # `uv sync`'s ephemeral build env mis-resolves Python.h for git-URL
58
+ # deps (e.g. stochmat). `uv pip install -e .` builds against the
59
+ # active venv directly and works.
60
+ run: |
61
+ uv venv --python ${{ matrix.pythonV }} .venv
62
+ source .venv/bin/activate
63
+ uv pip install -e . --group dev
64
+
65
+ - name: Lint with ruff
66
+ run: |
67
+ source .venv/bin/activate
68
+ uv run ruff check --select=ALL --output-format=github src/
69
+ continue-on-error: true
70
+
71
+ - name: Tests
72
+ run: |
73
+ source .venv/bin/activate
74
+ uv run pytest --junitxml=junit/test-results.xml --cov=tempnet --durations=0
75
+ env:
76
+ COVERAGE_FILE: ".coverage.all"
77
+
78
+ - name: Store coverage file
79
+ if: matrix.pythonV == needs.determine-python-version.outputs.min-version
80
+ uses: actions/upload-artifact@v4
81
+ with:
82
+ name: coverage-all
83
+ path: .coverage.all
84
+ include-hidden-files: true
85
+
86
+ # Update per-version pass/fail badge in gist
87
+ - name: Update Python ${{ matrix.pythonV }} status badge
88
+ if: always()
89
+ # pinned to v1.8.0
90
+ uses: schneegans/dynamic-badges-action@0e50b8bad39e7e1afd3e4e9c2b7dd145fad07501
91
+ with:
92
+ auth: ${{ secrets.GIST_SECRET }}
93
+ gistID: ${{ vars.STATUS_GIST_ID }}
94
+ filename: python-${{ matrix.pythonV }}.json
95
+ label: "Python ${{ matrix.pythonV }}"
96
+ message: ${{ job.status == 'success' && 'passing' || 'failing' }}
97
+ color: ${{ job.status == 'success' && 'brightgreen' || 'red' }}
98
+
99
+ coverage-badge:
100
+ name: coverage-badge
101
+ runs-on: ubuntu-24.04
102
+ needs: [unit-tests]
103
+ if: always()
104
+ permissions:
105
+ contents: write
106
+ steps:
107
+ - uses: actions/checkout@v5
108
+ - uses: actions/download-artifact@v4
109
+ id: download
110
+ with:
111
+ pattern: coverage*
112
+ merge-multiple: true
113
+
114
+ - name: Update coverage badge
115
+ uses: py-cov-action/python-coverage-comment-action@v3
116
+ with:
117
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118
+ MERGE_COVERAGE_FILES: true
@@ -0,0 +1,62 @@
1
+ # Manual TestPyPI dry-run. Trigger via the Actions tab; the branch picker
2
+ # in the workflow_dispatch UI selects which ref to build from. Useful for
3
+ # validating the build and publish pipeline before cutting a real release tag.
4
+ #
5
+ # Prerequisites (configured outside this workflow):
6
+ # * TestPyPI trusted publisher: workflow=test_release.yml, environment=testpypi
7
+ # * GitHub environment ``testpypi`` (no reviewers required)
8
+
9
+ name: Test release (TestPyPI)
10
+
11
+ on:
12
+ workflow_dispatch: {}
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ build:
19
+ name: Build artifacts
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Build wheel and sdist
27
+ # TestPyPI rejects PEP 440 local version segments (the ``+gSHA``
28
+ # suffix hatch-vcs appends on non-tag commits). Strip it here --
29
+ # and only here -- so PyPI releases and local dev installs are
30
+ # unaffected.
31
+ env:
32
+ SETUPTOOLS_SCM_LOCAL_SCHEME: no-local-version
33
+ run: pipx run build
34
+
35
+ - uses: actions/upload-artifact@v4
36
+ with:
37
+ name: dist-testrelease
38
+ path: dist/*
39
+
40
+ publish_testpypi:
41
+ name: Publish to TestPyPI
42
+ needs: build
43
+ runs-on: ubuntu-latest
44
+ environment:
45
+ name: testpypi
46
+ url: https://test.pypi.org/p/tempnet
47
+ permissions:
48
+ id-token: write
49
+ steps:
50
+ - uses: actions/download-artifact@v4
51
+ with:
52
+ pattern: dist-*
53
+ path: dist
54
+ merge-multiple: true
55
+
56
+ - uses: pypa/gh-action-pypi-publish@release/v1
57
+ with:
58
+ repository-url: https://test.pypi.org/legacy/
59
+ # TestPyPI rejects re-uploads of an existing version; allow the
60
+ # workflow to succeed when the version already exists so repeated
61
+ # dry-runs from the same commit don't fail noisily.
62
+ skip-existing: true
@@ -0,0 +1,209 @@
1
+ # hatching version file
2
+ _version.py
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[codz]
6
+ *$py.class
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ share/python-wheels/
26
+ *.egg-info/
27
+ .installed.cfg
28
+ *.egg
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python script from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py.cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ cover/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ # For a library or package, you might want to ignore these files since the code is
89
+ # intended to run in multiple environments; otherwise, check them in:
90
+ # .python-version
91
+
92
+ # pipenv
93
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
95
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
96
+ # install all needed dependencies.
97
+ #Pipfile.lock
98
+
99
+ # UV
100
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
101
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
102
+ # commonly ignored for libraries.
103
+ #uv.lock
104
+
105
+ # poetry
106
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
107
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
108
+ # commonly ignored for libraries.
109
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
110
+ #poetry.lock
111
+ #poetry.toml
112
+
113
+ # pdm
114
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
115
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
116
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
117
+ #pdm.lock
118
+ #pdm.toml
119
+ .pdm-python
120
+ .pdm-build/
121
+
122
+ # pixi
123
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
124
+ #pixi.lock
125
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
126
+ # in the .venv directory. It is recommended not to include this directory in version control.
127
+ .pixi
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule
134
+ celerybeat.pid
135
+
136
+ # SageMath parsed files
137
+ *.sage.py
138
+
139
+ # Environments
140
+ .env
141
+ .envrc
142
+ .venv
143
+ env/
144
+ venv/
145
+ ENV/
146
+ env.bak/
147
+ venv.bak/
148
+
149
+ # Spyder project settings
150
+ .spyderproject
151
+ .spyproject
152
+
153
+ # Rope project settings
154
+ .ropeproject
155
+
156
+ # mkdocs documentation
157
+ /site
158
+
159
+ # mypy
160
+ .mypy_cache/
161
+ .dmypy.json
162
+ dmypy.json
163
+
164
+ # Pyre type checker
165
+ .pyre/
166
+
167
+ # pytype static type analyzer
168
+ .pytype/
169
+
170
+ # Cython debug symbols
171
+ cython_debug/
172
+
173
+ # PyCharm
174
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
175
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
176
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
177
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
178
+ #.idea/
179
+
180
+ # Abstra
181
+ # Abstra is an AI-powered process automation framework.
182
+ # Ignore directories containing user credentials, local state, and settings.
183
+ # Learn more at https://abstra.io/docs
184
+ .abstra/
185
+
186
+ # Visual Studio Code
187
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
188
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
189
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
190
+ # you could uncomment the following to ignore the entire vscode folder
191
+ # .vscode/
192
+
193
+ # Ruff stuff:
194
+ .ruff_cache/
195
+
196
+ # PyPI configuration file
197
+ .pypirc
198
+
199
+ # Cursor
200
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
201
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
202
+ # refer to https://docs.cursor.com/context/ignore-files
203
+ .cursorignore
204
+ .cursorindexingignore
205
+
206
+ # Marimo
207
+ marimo/_static/
208
+ marimo/_lsp/
209
+ __marimo__/