frgfp 0.1.0rc1__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. frgfp-0.1.0rc1/.devcontainer/devcontainer.json +23 -0
  2. frgfp-0.1.0rc1/.dockerignore +13 -0
  3. frgfp-0.1.0rc1/.github/workflows/ci.yml +210 -0
  4. frgfp-0.1.0rc1/.github/workflows/docs-dev.yml +70 -0
  5. frgfp-0.1.0rc1/.github/workflows/release.yml +438 -0
  6. frgfp-0.1.0rc1/.github/workflows/wheel-debug.yml +99 -0
  7. frgfp-0.1.0rc1/.gitignore +53 -0
  8. frgfp-0.1.0rc1/CMakeLists.txt +80 -0
  9. frgfp-0.1.0rc1/PKG-INFO +173 -0
  10. frgfp-0.1.0rc1/README.md +151 -0
  11. frgfp-0.1.0rc1/RELEASING.md +382 -0
  12. frgfp-0.1.0rc1/compose.yaml +36 -0
  13. frgfp-0.1.0rc1/doc/Makefile +14 -0
  14. frgfp-0.1.0rc1/doc/make.bat +35 -0
  15. frgfp-0.1.0rc1/doc/source/_static/.gitkeep +0 -0
  16. frgfp-0.1.0rc1/doc/source/_templates/.gitkeep +0 -0
  17. frgfp-0.1.0rc1/doc/source/api/core.rst +17 -0
  18. frgfp-0.1.0rc1/doc/source/api/index.rst +27 -0
  19. frgfp-0.1.0rc1/doc/source/api/lpa.rst +12 -0
  20. frgfp-0.1.0rc1/doc/source/conf.py +134 -0
  21. frgfp-0.1.0rc1/doc/source/index.rst +27 -0
  22. frgfp-0.1.0rc1/doc/source/installation.rst +165 -0
  23. frgfp-0.1.0rc1/doc/source/usage.rst +169 -0
  24. frgfp-0.1.0rc1/docker/Dockerfile +73 -0
  25. frgfp-0.1.0rc1/docker/dev.sh +76 -0
  26. frgfp-0.1.0rc1/docker/entrypoint.sh +15 -0
  27. frgfp-0.1.0rc1/environment.yml +23 -0
  28. frgfp-0.1.0rc1/examples/usage.ipynb +376 -0
  29. frgfp-0.1.0rc1/frgfp/__init__.py +65 -0
  30. frgfp-0.1.0rc1/frgfp/_core/CMakeLists.txt +16 -0
  31. frgfp-0.1.0rc1/frgfp/_core/__init__.py +24 -0
  32. frgfp-0.1.0rc1/frgfp/_core/_ansatz.py +262 -0
  33. frgfp-0.1.0rc1/frgfp/_core/_func.py +213 -0
  34. frgfp-0.1.0rc1/frgfp/_core/_grids.py +121 -0
  35. frgfp-0.1.0rc1/frgfp/_core/include/_ansatz.hpp +64 -0
  36. frgfp-0.1.0rc1/frgfp/_core/include/_func.hpp +31 -0
  37. frgfp-0.1.0rc1/frgfp/_core/src/_ansatz.cpp +251 -0
  38. frgfp-0.1.0rc1/frgfp/_core/src/_bindings.cpp +46 -0
  39. frgfp-0.1.0rc1/frgfp/_core/src/_func.cpp +58 -0
  40. frgfp-0.1.0rc1/frgfp/_core/tests/test_ansatz.py +60 -0
  41. frgfp-0.1.0rc1/frgfp/_core/tests/test_func.py +66 -0
  42. frgfp-0.1.0rc1/frgfp/_core/tests/test_grid.py +46 -0
  43. frgfp-0.1.0rc1/frgfp/lpa/CMakeLists.txt +15 -0
  44. frgfp-0.1.0rc1/frgfp/lpa/__init__.py +12 -0
  45. frgfp-0.1.0rc1/frgfp/lpa/_solver.py +678 -0
  46. frgfp-0.1.0rc1/frgfp/lpa/include/_solver.hpp +158 -0
  47. frgfp-0.1.0rc1/frgfp/lpa/src/_bindings.cpp +39 -0
  48. frgfp-0.1.0rc1/frgfp/lpa/src/_solver.cpp +431 -0
  49. frgfp-0.1.0rc1/frgfp/lpa/tests/test_lpa.py +208 -0
  50. frgfp-0.1.0rc1/frgfp/tests/o8_fp.dat +102 -0
  51. frgfp-0.1.0rc1/frgfp/tests/test_large_grid.py +344 -0
  52. frgfp-0.1.0rc1/frgfp/tests/test_o8_fp.py +93 -0
  53. frgfp-0.1.0rc1/frgfp/tests/test_o8_multistart.py +95 -0
  54. frgfp-0.1.0rc1/frgfp/tests/test_sensitivity_gating.py +194 -0
  55. frgfp-0.1.0rc1/frgfp/tests/test_solver_construction.py +106 -0
  56. frgfp-0.1.0rc1/frgfp_logo.png +0 -0
  57. frgfp-0.1.0rc1/pyproject.toml +126 -0
  58. frgfp-0.1.0rc1/requirements.txt +21 -0
  59. frgfp-0.1.0rc1/tools/ci/build_libomp.sh +90 -0
  60. frgfp-0.1.0rc1/tools/ci/deploy_docs.py +394 -0
  61. frgfp-0.1.0rc1/tools/ci/validate_tag.py +268 -0
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "FRGfp dev",
3
+ "dockerComposeFile": ["../compose.yaml"],
4
+ "service": "dev",
5
+ "workspaceFolder": "/workspace",
6
+ "remoteUser": "dev",
7
+ "postCreateCommand": "python -c 'import frgfp' || pip install -e .",
8
+ "customizations": {
9
+ "vscode": {
10
+ "extensions": [
11
+ "ms-python.python",
12
+ "ms-python.vscode-pylance",
13
+ "ms-vscode.cpptools",
14
+ "ms-toolsai.jupyter"
15
+ ],
16
+ "settings": {
17
+ "python.defaultInterpreterPath": "/opt/venv/bin/python",
18
+ "python.testing.pytestEnabled": true,
19
+ "python.testing.pytestArgs": ["frgfp"]
20
+ }
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,13 @@
1
+ # Keep the image build context small: only requirements.txt and docker/ are used.
2
+ .git/
3
+ build/
4
+ doc/build/
5
+ .pytest_cache/
6
+ .benchmarks/
7
+ .venv/
8
+ __pycache__/
9
+ *.py[cod]
10
+ *.so
11
+ sandbox/
12
+ .vscode/
13
+ .idea/
@@ -0,0 +1,210 @@
1
+ name: CI
2
+
3
+ # Pull requests into the two long-lived integration branches must build and test
4
+ # the package on every supported OS/Python combination before they can be merged.
5
+ on:
6
+ pull_request:
7
+ branches: [rc, main]
8
+ types: [opened, synchronize, reopened, ready_for_review]
9
+ push:
10
+ branches: [rc, main]
11
+ workflow_dispatch:
12
+
13
+ concurrency:
14
+ group: ci-${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ env:
21
+ # cibuildwheel's downloaded CPythons/tools live here so they can be cached.
22
+ CIBW_CACHE_PATH: ${{ github.workspace }}/.cibuildwheel-cache
23
+
24
+ jobs:
25
+ # ---------------------------------------------------------------------------
26
+ # Build the wheel and run the test suite on every OS/architecture/CPython.
27
+ # cibuildwheel installs the freshly built wheel into a clean virtual
28
+ # environment and runs pytest from a temporary directory, so the tests always
29
+ # exercise the installed binary rather than the source tree.
30
+ # ---------------------------------------------------------------------------
31
+ wheels:
32
+ name: wheel · ${{ matrix.runner.name }} · cp${{ matrix.python }}
33
+ runs-on: ${{ matrix.runner.os }}
34
+ timeout-minutes: 60
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ python: ["310", "311", "312", "313", "314"]
39
+ # Runner labels are pinned deliberately: the build environment - and with
40
+ # it the Homebrew bottles that delocate has to accept - should only change
41
+ # when we bump them on purpose. `macos-26` is the Apple Silicon image.
42
+ #
43
+ # macOS is Apple Silicon only: numba >= 0.63 and llvmlite >= 0.46 publish
44
+ # no Intel (x86_64) macOS wheels, so a test environment for an Intel wheel
45
+ # cannot even be created from PyPI. Intel macOS users install from the
46
+ # sdist or use conda-forge; see RELEASING.md and the platform support table
47
+ # in doc/source/installation.rst. The archs column drives CIBW_ARCHS.
48
+ runner:
49
+ - {name: linux-x86_64, os: ubuntu-24.04, archs: x86_64}
50
+ - {name: linux-aarch64, os: ubuntu-24.04-arm, archs: aarch64}
51
+ - {name: macos-arm64, os: macos-26, archs: arm64}
52
+ - {name: windows-amd64, os: windows-2022, archs: AMD64}
53
+ steps:
54
+ - uses: actions/checkout@v7
55
+ with:
56
+ # setuptools_scm derives the version from the git history and tags.
57
+ fetch-depth: 0
58
+ fetch-tags: true
59
+
60
+ - uses: actions/setup-python@v7
61
+ with:
62
+ python-version: "3.12"
63
+
64
+ - name: Cache cibuildwheel's tool downloads
65
+ uses: actions/cache@v6
66
+ with:
67
+ path: |
68
+ ${{ env.CIBW_CACHE_PATH }}
69
+ ~/frgfp-libomp
70
+ ~/frgfp-libomp-tarball
71
+ key: cibw-${{ matrix.runner.name }}-${{ hashFiles('pyproject.toml', 'tools/ci/build_libomp.sh') }}
72
+
73
+ - name: Prepare the macOS OpenMP runtime
74
+ if: runner.os == 'macOS'
75
+ shell: bash
76
+ # The build links the libomp that before-all compiled for the wheel's
77
+ # deployment target and delocate bundles it into the wheel; the Homebrew
78
+ # keg is installed only as the fallback for the build (CMakeLists.txt).
79
+ #
80
+ # The tests must never load a *second* OpenMP runtime: the extension
81
+ # loads the bundled one, and if numba's omp layer additionally dlopens
82
+ # Homebrew's copy, the OpenMP runtime aborts the whole process ("OMP:
83
+ # Error #15 ... already initialized", which the runner reports as exit
84
+ # code -6). Pinning numba to its dependency-free workqueue layer keeps
85
+ # exactly one runtime in the process; frgfp/lpa/_solver.py honours an
86
+ # explicit NUMBA_THREADING_LAYER.
87
+ run: |
88
+ brew list libomp >/dev/null 2>&1 || brew install libomp
89
+ echo "NUMBA_THREADING_LAYER=workqueue" >> "$GITHUB_ENV"
90
+
91
+ - name: Build the wheel and run pytest
92
+ uses: pypa/cibuildwheel@v4.2.1
93
+ env:
94
+ CIBW_BUILD: cp${{ matrix.python }}-*
95
+ CIBW_ARCHS: ${{ matrix.runner.archs }}
96
+ # macOS only: report a failing test run as a GitHub annotation.
97
+ # Annotations are readable without repository admin rights, so the real
98
+ # error is visible on the pull request rather than only in the
99
+ # (admin-only) job log.
100
+ CIBW_TEST_COMMAND_MACOS: >-
101
+ log=$(mktemp); python -m pytest --pyargs frgfp -m "not benchmark" -q >"$log" 2>&1
102
+ || { cat "$log"; echo "::error::pytest failed: $(tail -n 5 "$log" | tr '\n' ' ')"; exit 1; };
103
+ cat "$log"
104
+
105
+ - name: Upload the wheel
106
+ uses: actions/upload-artifact@v7
107
+ with:
108
+ name: wheel-cp${{ matrix.python }}-${{ matrix.runner.name }}
109
+ path: ./wheelhouse/*.whl
110
+ if-no-files-found: error
111
+
112
+
113
+ # ---------------------------------------------------------------------------
114
+ # The source distribution must be self-contained: build it, install it into a
115
+ # clean environment and run the same tests against it.
116
+ # ---------------------------------------------------------------------------
117
+ sdist:
118
+ name: sdist
119
+ runs-on: ubuntu-24.04
120
+ timeout-minutes: 30
121
+ steps:
122
+ - uses: actions/checkout@v7
123
+ with:
124
+ fetch-depth: 0
125
+ fetch-tags: true
126
+
127
+ - uses: actions/setup-python@v7
128
+ with:
129
+ python-version: "3.12"
130
+
131
+ - name: Build the sdist
132
+ run: |
133
+ python -m pip install --upgrade build
134
+ python -m build --sdist --outdir dist
135
+
136
+ - name: Install the sdist and run pytest
137
+ run: |
138
+ python -m venv /tmp/sdist-venv
139
+ /tmp/sdist-venv/bin/python -m pip install "dist/frgfp-"*.tar.gz
140
+ /tmp/sdist-venv/bin/python -m pip install pytest pytest-benchmark
141
+ cd /tmp
142
+ /tmp/sdist-venv/bin/python -m pytest --pyargs frgfp -m "not benchmark" -q
143
+
144
+ - name: Upload the sdist
145
+ uses: actions/upload-artifact@v7
146
+ with:
147
+ name: sdist
148
+ path: dist/*.tar.gz
149
+ if-no-files-found: error
150
+
151
+ # ---------------------------------------------------------------------------
152
+ # The documentation must build (warnings are errors) even before it is
153
+ # published. It imports the package, so the prebuilt Linux wheel is reused
154
+ # instead of compiling the extension a second time.
155
+ # ---------------------------------------------------------------------------
156
+ docs:
157
+ name: docs
158
+ runs-on: ubuntu-24.04
159
+ timeout-minutes: 30
160
+ needs: [wheels]
161
+ steps:
162
+ - uses: actions/checkout@v7
163
+ with:
164
+ fetch-depth: 0
165
+ fetch-tags: true
166
+
167
+ - uses: actions/setup-python@v7
168
+ with:
169
+ python-version: "3.12"
170
+
171
+ - name: Fetch the Linux wheel built above
172
+ uses: actions/download-artifact@v8
173
+ with:
174
+ name: wheel-cp312-linux-x86_64
175
+ path: dist
176
+
177
+ - name: Install the wheel and the documentation toolchain
178
+ run: |
179
+ python -m pip install dist/*.whl
180
+ python -m pip install -r requirements.txt
181
+
182
+ - name: Build the documentation
183
+ run: sphinx-build -b html -W --keep-going doc/source doc/build/html
184
+
185
+ - name: Upload the documentation
186
+ uses: actions/upload-artifact@v7
187
+ with:
188
+ name: docs-html
189
+ path: doc/build/html
190
+ if-no-files-found: error
191
+
192
+ # ---------------------------------------------------------------------------
193
+ # Single required status check: enable only this job in the branch protection
194
+ # rules of `rc` and `main`, so the matrix can grow without touching settings.
195
+ # ---------------------------------------------------------------------------
196
+ ci:
197
+ name: ci
198
+ if: always()
199
+ needs: [wheels, sdist, docs]
200
+ runs-on: ubuntu-24.04
201
+ timeout-minutes: 5
202
+ steps:
203
+ - name: Fail if any required job failed
204
+ if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
205
+ run: |
206
+ echo "::error::a required job failed or was cancelled"
207
+ exit 1
208
+
209
+ - name: Report success
210
+ run: echo "All required jobs succeeded."
@@ -0,0 +1,70 @@
1
+ name: Docs preview (dev)
2
+
3
+ # Publishes the documentation of the `develop` branch to /dev/ so the version
4
+ # switcher always has a preview entry. /latest/ is never touched from here.
5
+ # Delete this file if you do not want a continuously updated preview.
6
+ on:
7
+ push:
8
+ branches: [develop]
9
+ workflow_dispatch:
10
+
11
+ concurrency:
12
+ group: docs-dev
13
+ cancel-in-progress: true
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ env:
19
+ DOCS_BASE_URL: https://molbarnabas.github.io/frgfp/
20
+
21
+ jobs:
22
+ dev-docs:
23
+ name: dev docs
24
+ runs-on: ubuntu-24.04
25
+ timeout-minutes: 30
26
+ permissions:
27
+ contents: write # the docs are committed to the gh-pages branch
28
+ steps:
29
+ - uses: actions/checkout@v7
30
+ with:
31
+ fetch-depth: 0
32
+ fetch-tags: true
33
+
34
+ - uses: actions/setup-python@v7
35
+ with:
36
+ python-version: "3.12"
37
+
38
+ - name: Install the package and the documentation toolchain
39
+ run: |
40
+ python -m pip install .
41
+ python -m pip install -r requirements.txt
42
+
43
+ - name: Build the documentation
44
+ env:
45
+ DOC_VERSION_MATCH: dev
46
+ run: sphinx-build -b html -W --keep-going doc/source doc/build/html
47
+
48
+ - name: Check out the published documentation branch
49
+ env:
50
+ GH_TOKEN: ${{ github.token }}
51
+ run: |
52
+ set -euo pipefail
53
+ git init -q _pages
54
+ git -C _pages remote add origin \
55
+ "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
56
+ if git -C _pages fetch --depth=1 origin gh-pages; then
57
+ git -C _pages checkout -q -B gh-pages FETCH_HEAD
58
+ else
59
+ git -C _pages checkout -q --orphan gh-pages
60
+ fi
61
+
62
+ - name: Publish the preview
63
+ run: |
64
+ python tools/ci/deploy_docs.py \
65
+ --pages-dir _pages \
66
+ --html-dir doc/build/html \
67
+ --version dev \
68
+ --target version \
69
+ --base-url "$DOCS_BASE_URL" \
70
+ --branch gh-pages