pge2py 0.1.0__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.
- pge2py-0.1.0/.github/workflows/ci.yml +22 -0
- pge2py-0.1.0/.github/workflows/release.yml +90 -0
- pge2py-0.1.0/.gitignore +6 -0
- pge2py-0.1.0/CHANGELOG.md +17 -0
- pge2py-0.1.0/LICENSE +21 -0
- pge2py-0.1.0/LICENSES/GPL-3.0-or-later.txt +674 -0
- pge2py-0.1.0/LICENSES/MIT-pge2.txt +21 -0
- pge2py-0.1.0/LICENSES/MIT-pulseg.txt +21 -0
- pge2py-0.1.0/LICENSES/MIT-pulseq.txt +22 -0
- pge2py-0.1.0/LICENSES/README.md +17 -0
- pge2py-0.1.0/PKG-INFO +98 -0
- pge2py-0.1.0/README.md +71 -0
- pge2py-0.1.0/pyproject.toml +39 -0
- pge2py-0.1.0/src/pge2py/__init__.py +33 -0
- pge2py-0.1.0/src/pge2py/_api.py +357 -0
- pge2py-0.1.0/src/pge2py/_js/bridge.js +51 -0
- pge2py-0.1.0/src/pge2py/_js/octave-worker.js +76 -0
- pge2py-0.1.0/src/pge2py/_octave.py +123 -0
- pge2py-0.1.0/src/pge2py/_report.py +112 -0
- pge2py-0.1.0/src/pge2py/aio.py +37 -0
- pge2py-0.1.0/src/pge2py/pulseg.py +5 -0
- pge2py-0.1.0/tests/browser/README.md +24 -0
- pge2py-0.1.0/tests/browser/cells.json +7 -0
- pge2py-0.1.0/tests/browser/drive_lite.js +27 -0
- pge2py-0.1.0/tests/browser/gre2d.py +123 -0
- pge2py-0.1.0/tests/test_desktop.py +79 -0
- pge2py-0.1.0/tools/build_assets.py +194 -0
- pge2py-0.1.0/tools/check_wheel.py +17 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
desktop:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: actions/setup-python@v5
|
|
13
|
+
with:
|
|
14
|
+
python-version: "3.12"
|
|
15
|
+
- name: Install GNU Octave
|
|
16
|
+
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends octave
|
|
17
|
+
- name: Build assets
|
|
18
|
+
run: python tools/build_assets.py
|
|
19
|
+
- name: Install and test
|
|
20
|
+
run: |
|
|
21
|
+
python -m pip install -e ".[test]"
|
|
22
|
+
python -m pytest -q
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Cut a release with a tag vX.Y.Z (X.Y.Z = pge2py.__version__): push the tag,
|
|
4
|
+
# or create the release (and its tag) in the GitHub web interface.
|
|
5
|
+
# Builds the wheel (with the Octave WebAssembly build and the pinned toolboxes),
|
|
6
|
+
# publishes it to PyPI with a trusted publisher (no API token), and attaches the
|
|
7
|
+
# files to the GitHub release (creating it, with the CHANGELOG.md section, if
|
|
8
|
+
# it does not exist). Both events may fire for one tag: the second run finds
|
|
9
|
+
# the files already on PyPI and the release already there.
|
|
10
|
+
# A manual run only builds and checks.
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
push:
|
|
14
|
+
tags: ["v*"]
|
|
15
|
+
release:
|
|
16
|
+
types: [published]
|
|
17
|
+
workflow_dispatch:
|
|
18
|
+
|
|
19
|
+
concurrency:
|
|
20
|
+
group: release-${{ github.ref }}
|
|
21
|
+
cancel-in-progress: false
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
build:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- uses: actions/setup-python@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: "3.12"
|
|
31
|
+
- name: Tag matches the package version
|
|
32
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
33
|
+
run: |
|
|
34
|
+
version=$(python -c "import re; print(re.search(r'__version__ = \"(.+)\"', open('src/pge2py/__init__.py').read())[1])")
|
|
35
|
+
test "v$version" = "${GITHUB_REF_NAME}" || { echo "tag ${GITHUB_REF_NAME} != v$version"; exit 1; }
|
|
36
|
+
- name: Build assets (Octave wasm, toolboxes)
|
|
37
|
+
run: python tools/build_assets.py
|
|
38
|
+
- name: Build wheel and sdist
|
|
39
|
+
run: |
|
|
40
|
+
python -m pip install build
|
|
41
|
+
python -m build --sdist
|
|
42
|
+
python -m build --wheel # from the checkout: the sdist leaves the assets out
|
|
43
|
+
- name: Check the wheel contents
|
|
44
|
+
run: python tools/check_wheel.py dist/*.whl
|
|
45
|
+
- uses: actions/upload-artifact@v4
|
|
46
|
+
with:
|
|
47
|
+
name: dist
|
|
48
|
+
path: dist/
|
|
49
|
+
|
|
50
|
+
publish-pypi:
|
|
51
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
52
|
+
needs: build
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
environment:
|
|
55
|
+
name: pypi
|
|
56
|
+
url: https://pypi.org/p/pge2py
|
|
57
|
+
permissions:
|
|
58
|
+
id-token: write
|
|
59
|
+
steps:
|
|
60
|
+
- uses: actions/download-artifact@v4
|
|
61
|
+
with:
|
|
62
|
+
name: dist
|
|
63
|
+
path: dist/
|
|
64
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
65
|
+
with:
|
|
66
|
+
skip-existing: true
|
|
67
|
+
|
|
68
|
+
github-release:
|
|
69
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
70
|
+
needs: publish-pypi
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
permissions:
|
|
73
|
+
contents: write
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/checkout@v4
|
|
76
|
+
- uses: actions/download-artifact@v4
|
|
77
|
+
with:
|
|
78
|
+
name: dist
|
|
79
|
+
path: dist/
|
|
80
|
+
- name: Create the GitHub release
|
|
81
|
+
env:
|
|
82
|
+
GH_TOKEN: ${{ github.token }}
|
|
83
|
+
run: |
|
|
84
|
+
version="${GITHUB_REF_NAME#v}"
|
|
85
|
+
if gh release view "$GITHUB_REF_NAME" > /dev/null 2>&1; then
|
|
86
|
+
gh release upload "$GITHUB_REF_NAME" dist/* --clobber
|
|
87
|
+
else
|
|
88
|
+
awk -v v="$version" '$0 ~ "^## " {p = ($2 == v)} p && !/^## /' CHANGELOG.md > notes.md
|
|
89
|
+
gh release create "$GITHUB_REF_NAME" dist/* --title "pge2py $version" --notes-file notes.md
|
|
90
|
+
fi
|
pge2py-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
First release.
|
|
6
|
+
|
|
7
|
+
- The calls of the MATLAB toolboxes, on a pypulseq sequence:
|
|
8
|
+
`pulseg.fromSeq`, `pge2.opts`, `pge2.check`, `pge2.validate`,
|
|
9
|
+
`pge2.serialize` (`import pge2py as pge2; from pge2py import pulseg`), and
|
|
10
|
+
coroutine versions in `pge2py.aio`.
|
|
11
|
+
- In the browser (Pyodide, JupyterLite): GNU Octave 10.3 compiled to
|
|
12
|
+
WebAssembly (emscripten-forge) is bundled in the wheel and runs in a Web
|
|
13
|
+
Worker. Calls are synchronous where the browser supports JSPI (tested in
|
|
14
|
+
Chromium); Firefox and Safari not tested yet.
|
|
15
|
+
- On the desktop: GNU Octave through oct2py (`pip install pge2py[octave]`).
|
|
16
|
+
- Bundled toolboxes: Pulseq `11e459d`, pulseg `ca2a278`, pge2 `9fa76e6`, with
|
|
17
|
+
the changes they need to run in Octave.
|
pge2py-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matteo Cencini
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|