plum 2.8.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.
- plum-2.8.0/.gitattributes +2 -0
- plum-2.8.0/.github/workflows/build_book.yml +38 -0
- plum-2.8.0/.github/workflows/ci.yml +102 -0
- plum-2.8.0/.github/workflows/codeql.yml +67 -0
- plum-2.8.0/.github/workflows/formatting_check.yml +17 -0
- plum-2.8.0/.github/workflows/publish.yml +125 -0
- plum-2.8.0/.github/workflows/publish_new_pypi_name.yml +197 -0
- plum-2.8.0/.gitignore +32 -0
- plum-2.8.0/.pre-commit-config.yaml +39 -0
- plum-2.8.0/.readthedocs.yaml +21 -0
- plum-2.8.0/LICENCE.txt +21 -0
- plum-2.8.0/PKG-INFO +182 -0
- plum-2.8.0/README.md +161 -0
- plum-2.8.0/conftest.py +54 -0
- plum-2.8.0/docs/_config.yml +42 -0
- plum-2.8.0/docs/_toc.yml +24 -0
- plum-2.8.0/docs/advanced_usage.md +4 -0
- plum-2.8.0/docs/api.rst +56 -0
- plum-2.8.0/docs/autoreload.md +32 -0
- plum-2.8.0/docs/basic_usage.md +76 -0
- plum-2.8.0/docs/classes.md +137 -0
- plum-2.8.0/docs/command_line.md +42 -0
- plum-2.8.0/docs/comparison.md +290 -0
- plum-2.8.0/docs/conversion_promotion.md +152 -0
- plum-2.8.0/docs/dispatch.md +157 -0
- plum-2.8.0/docs/integration.md +97 -0
- plum-2.8.0/docs/intro.md +4 -0
- plum-2.8.0/docs/keyword_arguments.md +162 -0
- plum-2.8.0/docs/logo.png +0 -0
- plum-2.8.0/docs/parametric.md +278 -0
- plum-2.8.0/docs/precedence.md +71 -0
- plum-2.8.0/docs/references.bib +2 -0
- plum-2.8.0/docs/scope.md +152 -0
- plum-2.8.0/docs/types.md +318 -0
- plum-2.8.0/docs/union_aliases.md +108 -0
- plum-2.8.0/noxfile.py +72 -0
- plum-2.8.0/pyproject.toml +211 -0
- plum-2.8.0/src/plum/__init__.py +167 -0
- plum-2.8.0/src/plum/_alias.py +166 -0
- plum-2.8.0/src/plum/_autoreload.py +77 -0
- plum-2.8.0/src/plum/_bear.py +14 -0
- plum-2.8.0/src/plum/_dispatcher.py +151 -0
- plum-2.8.0/src/plum/_function.py +557 -0
- plum-2.8.0/src/plum/_method.py +233 -0
- plum-2.8.0/src/plum/_overload.py +3 -0
- plum-2.8.0/src/plum/_parametric.py +674 -0
- plum-2.8.0/src/plum/_promotion.py +198 -0
- plum-2.8.0/src/plum/_resolver.py +402 -0
- plum-2.8.0/src/plum/_signature.py +450 -0
- plum-2.8.0/src/plum/_type.py +351 -0
- plum-2.8.0/src/plum/_util.py +163 -0
- plum-2.8.0/src/plum/_version.py +34 -0
- plum-2.8.0/src/plum/py.typed +0 -0
- plum-2.8.0/src/plum/repr.py +235 -0
- plum-2.8.0/tests/__init__.py +0 -0
- plum-2.8.0/tests/advanced/__init__.py +0 -0
- plum-2.8.0/tests/advanced/test_advanced.py +362 -0
- plum-2.8.0/tests/advanced/test_annotated.py +23 -0
- plum-2.8.0/tests/advanced/test_cases.py +210 -0
- plum-2.8.0/tests/advanced/test_future_annotations.py +98 -0
- plum-2.8.0/tests/advanced/test_precedence.py +56 -0
- plum-2.8.0/tests/advanced/test_return_type.py +76 -0
- plum-2.8.0/tests/benchmark.py +101 -0
- plum-2.8.0/tests/conftest.py +39 -0
- plum-2.8.0/tests/static/dispatches.pyi +42 -0
- plum-2.8.0/tests/static/overload.pyi +29 -0
- plum-2.8.0/tests/test_alias.py +75 -0
- plum-2.8.0/tests/test_autoreload.py +77 -0
- plum-2.8.0/tests/test_cache.py +173 -0
- plum-2.8.0/tests/test_dispatcher.py +82 -0
- plum-2.8.0/tests/test_function.py +624 -0
- plum-2.8.0/tests/test_init.py +34 -0
- plum-2.8.0/tests/test_method.py +175 -0
- plum-2.8.0/tests/test_overload.py +22 -0
- plum-2.8.0/tests/test_parametric.py +619 -0
- plum-2.8.0/tests/test_promotion.py +206 -0
- plum-2.8.0/tests/test_repr.py +39 -0
- plum-2.8.0/tests/test_resolver.py +304 -0
- plum-2.8.0/tests/test_signature.py +454 -0
- plum-2.8.0/tests/test_type.py +281 -0
- plum-2.8.0/tests/test_util.py +94 -0
- plum-2.8.0/tests/util.py +48 -0
- plum-2.8.0/todo.tasks +15 -0
- plum-2.8.0/uv.lock +3227 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Build Jupyter Book
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
# Trigger the workflow on push to main branch.
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- master
|
|
8
|
+
|
|
9
|
+
# This job installs dependencies, build the book, and pushes it to `gh-pages`.
|
|
10
|
+
jobs:
|
|
11
|
+
build-and-deploy-book:
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
os: [ubuntu-latest]
|
|
16
|
+
python-version: ["3.10"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v2
|
|
19
|
+
|
|
20
|
+
# Install dependencies.
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
uv sync --group dev --locked
|
|
28
|
+
|
|
29
|
+
# Build the book.
|
|
30
|
+
- name: Build
|
|
31
|
+
run: uv run --frozen jupyter-book build docs
|
|
32
|
+
|
|
33
|
+
# Deploy the book's HTML to gh-pages branch.
|
|
34
|
+
- name: Deploy to GitHub Pages
|
|
35
|
+
uses: peaceiris/actions-gh-pages@v3.6.1
|
|
36
|
+
with:
|
|
37
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
38
|
+
publish_dir: docs/_build/html
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
push:
|
|
9
|
+
branches:
|
|
10
|
+
- master
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
value:
|
|
19
|
+
- name: "3.10"
|
|
20
|
+
python-version: "3.10"
|
|
21
|
+
extra-install: ""
|
|
22
|
+
- name: "3.11"
|
|
23
|
+
python-version: "3.11"
|
|
24
|
+
extra-install: ""
|
|
25
|
+
- name: "3.12"
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
extra-install: ""
|
|
28
|
+
- name: "3.12-pre-beartype"
|
|
29
|
+
python-version: "3.12"
|
|
30
|
+
extra-install: "uv pip install --upgrade --pre beartype"
|
|
31
|
+
- name: "3.13"
|
|
32
|
+
python-version: "3.13"
|
|
33
|
+
extra-install: ""
|
|
34
|
+
- name: "3.13-pre-beartype"
|
|
35
|
+
python-version: "3.13"
|
|
36
|
+
extra-install: "uv pip install --upgrade --pre beartype"
|
|
37
|
+
|
|
38
|
+
name: Test ${{ matrix.value.name }}
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- name: Set up Python ${{ matrix.value.python-version }}
|
|
42
|
+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
|
|
43
|
+
with:
|
|
44
|
+
python-version: ${{ matrix.value.python-version }}
|
|
45
|
+
- name: Install dependencies
|
|
46
|
+
run: |
|
|
47
|
+
uv sync --group dev --locked
|
|
48
|
+
${{ matrix.value.extra-install }}
|
|
49
|
+
- name: Test linter assertions
|
|
50
|
+
run: uv run --frozen nox -s typecheck
|
|
51
|
+
- name: Run tests
|
|
52
|
+
run: |
|
|
53
|
+
PRAGMA_VERSION=`uv run python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))"` \
|
|
54
|
+
uv run --frozen pytest -v --cov=src/plum --cov-report term-missing --cov-report lcov:coverage.lcov
|
|
55
|
+
- name: Coveralls parallel
|
|
56
|
+
uses: coverallsapp/github-action@v2
|
|
57
|
+
with:
|
|
58
|
+
flag-name: run-${{ matrix.value.name }}
|
|
59
|
+
parallel: true
|
|
60
|
+
file: coverage.lcov
|
|
61
|
+
|
|
62
|
+
# Test that `mypyc`-compiled wheels work.
|
|
63
|
+
test-mypyc:
|
|
64
|
+
name: Test mypyc wheel
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/checkout@v4
|
|
68
|
+
with:
|
|
69
|
+
fetch-depth: 0
|
|
70
|
+
|
|
71
|
+
- name: Set up uv
|
|
72
|
+
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
|
|
73
|
+
with:
|
|
74
|
+
python-version: "3.12"
|
|
75
|
+
|
|
76
|
+
- name: Install build & test dependencies
|
|
77
|
+
run: uv sync --locked --no-install-project --no-default-groups --group build --group wheels --group test_static --group test_runtime
|
|
78
|
+
|
|
79
|
+
- name: Build mypyc wheel
|
|
80
|
+
run: uv run --no-sync python -m build --wheel
|
|
81
|
+
env:
|
|
82
|
+
HATCH_BUILD_HOOKS_ENABLE: "1"
|
|
83
|
+
|
|
84
|
+
- name: Install wheel
|
|
85
|
+
run: uv pip install dist/*.whl
|
|
86
|
+
|
|
87
|
+
- name: Verify compiled
|
|
88
|
+
run: uv run --no-sync python -c "from plum import COMPILED; print(f'COMPILED={COMPILED}'); assert COMPILED"
|
|
89
|
+
|
|
90
|
+
- name: Run tests
|
|
91
|
+
run: uv run --no-sync pytest tests/ -v -k "not incompatible_with_mypyc" --ignore=tests/advanced
|
|
92
|
+
|
|
93
|
+
finish:
|
|
94
|
+
name: Finish coverage
|
|
95
|
+
needs: test
|
|
96
|
+
if: ${{ always() }}
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
steps:
|
|
99
|
+
- name: Coveralls finished
|
|
100
|
+
uses: coverallsapp/github-action@v2
|
|
101
|
+
with:
|
|
102
|
+
parallel-finished: true
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: CodeQL Advanced
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "master" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "master" ]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: '42 1 * * 0'
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
analyze:
|
|
13
|
+
name: Analyze (${{ matrix.language }})
|
|
14
|
+
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
|
15
|
+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
|
16
|
+
# - https://gh.io/supported-runners-and-hardware-resources
|
|
17
|
+
# - https://gh.io/using-larger-runners (GitHub.com only)
|
|
18
|
+
# Consider using larger runners or machines with greater resources for possible
|
|
19
|
+
# analysis time improvements.
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
permissions:
|
|
22
|
+
# Required for all workflows:
|
|
23
|
+
security-events: write
|
|
24
|
+
|
|
25
|
+
# Required to fetch internal or private CodeQL packs:
|
|
26
|
+
packages: read
|
|
27
|
+
|
|
28
|
+
# Only required for workflows in private repositories:
|
|
29
|
+
actions: read
|
|
30
|
+
contents: read
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
include:
|
|
36
|
+
- language: actions
|
|
37
|
+
build-mode: none
|
|
38
|
+
- language: python
|
|
39
|
+
build-mode: none
|
|
40
|
+
steps:
|
|
41
|
+
- name: Checkout repository
|
|
42
|
+
uses: actions/checkout@v4
|
|
43
|
+
|
|
44
|
+
# Initializes the CodeQL tools for scanning.
|
|
45
|
+
- name: Initialize CodeQL
|
|
46
|
+
uses: github/codeql-action/init@v4
|
|
47
|
+
with:
|
|
48
|
+
languages: ${{ matrix.language }}
|
|
49
|
+
build-mode: ${{ matrix.build-mode }}
|
|
50
|
+
|
|
51
|
+
# See https://docs.github.com/en/enterprise-server@3.16/code-security/how-tos/scan-code-for-vulnerabilities/manage-your-configuration/codeql-code-scanning-for-compiled-languages#using-multiple-build-modes-in-a-multi-language-repository
|
|
52
|
+
- name: Run manual build steps
|
|
53
|
+
|
|
54
|
+
if: matrix.build-mode == 'manual'
|
|
55
|
+
shell: bash
|
|
56
|
+
run: |
|
|
57
|
+
echo 'If you are using a "manual" build mode for one or more of the ' \
|
|
58
|
+
'languages you are analyzing, replace this with the commands to build ' \
|
|
59
|
+
'your code, for example:'
|
|
60
|
+
echo ' make bootstrap'
|
|
61
|
+
echo ' make release'
|
|
62
|
+
exit 1
|
|
63
|
+
|
|
64
|
+
- name: Perform CodeQL Analysis
|
|
65
|
+
uses: github/codeql-action/analyze@v4
|
|
66
|
+
with:
|
|
67
|
+
category: "/language:${{matrix.language}}"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: Check Formatting
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [master]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
pre-commit:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v3
|
|
13
|
+
- uses: actions/setup-python@v3
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.10"
|
|
16
|
+
|
|
17
|
+
- uses: pre-commit/action@v3.0.0
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
name: Build and Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
publish:
|
|
9
|
+
description: "Publish to PyPI (only for releases)"
|
|
10
|
+
required: false
|
|
11
|
+
default: false
|
|
12
|
+
type: boolean
|
|
13
|
+
|
|
14
|
+
# Cancel any in-progress build when a new commit is pushed.
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
# Build the `sdist` and pure Python wheel.
|
|
21
|
+
sdist-and-wheel:
|
|
22
|
+
name: Build sdist and pure wheel
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
fetch-depth: 0 # Needed for hatch-vcs versioning
|
|
28
|
+
|
|
29
|
+
- name: Set up uv
|
|
30
|
+
uses: astral-sh/setup-uv@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.12"
|
|
33
|
+
|
|
34
|
+
- name: Build sdist and wheel
|
|
35
|
+
run: uv build
|
|
36
|
+
|
|
37
|
+
- name: Upload sdist
|
|
38
|
+
uses: actions/upload-artifact@v4
|
|
39
|
+
with:
|
|
40
|
+
name: sdist
|
|
41
|
+
path: dist/*.tar.gz
|
|
42
|
+
|
|
43
|
+
- name: Upload wheel
|
|
44
|
+
uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: wheel-pure
|
|
47
|
+
path: dist/*.whl
|
|
48
|
+
|
|
49
|
+
# Generate the wheel build matrix dynamically.
|
|
50
|
+
generate-wheels-matrix:
|
|
51
|
+
name: Generate wheels matrix
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
outputs:
|
|
54
|
+
include: ${{ steps.set-matrix.outputs.include }}
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v4
|
|
57
|
+
- name: Set up uv
|
|
58
|
+
uses: astral-sh/setup-uv@v5
|
|
59
|
+
- name: Install cibuildwheel and generate matrix
|
|
60
|
+
run: |
|
|
61
|
+
uvx cibuildwheel==3.4.0 --print-build-identifiers --platform linux \
|
|
62
|
+
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' > /tmp/linux_builds.json
|
|
63
|
+
uvx cibuildwheel==3.4.0 --print-build-identifiers --platform macos \
|
|
64
|
+
| jq -nRc '{"only": inputs, "os": "macos-14"}' > /tmp/macos_builds.json
|
|
65
|
+
uvx cibuildwheel==3.4.0 --print-build-identifiers --platform windows \
|
|
66
|
+
| jq -nRc '{"only": inputs, "os": "windows-latest"}' > /tmp/windows_builds.json
|
|
67
|
+
- name: Merge matrices
|
|
68
|
+
id: set-matrix
|
|
69
|
+
run: |
|
|
70
|
+
MATRIX=$(jq -sc '.' /tmp/*_builds.json | jq -c '.')
|
|
71
|
+
echo "include=$MATRIX" >> "$GITHUB_OUTPUT"
|
|
72
|
+
|
|
73
|
+
# Build `mypyc`-compiled wheels using `cibuildwheel`.
|
|
74
|
+
mypyc-wheels:
|
|
75
|
+
name: Build ${{ matrix.only }}
|
|
76
|
+
needs: generate-wheels-matrix
|
|
77
|
+
runs-on: ${{ matrix.os }}
|
|
78
|
+
strategy:
|
|
79
|
+
fail-fast: false
|
|
80
|
+
matrix:
|
|
81
|
+
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
|
|
82
|
+
steps:
|
|
83
|
+
- uses: actions/checkout@v4
|
|
84
|
+
with:
|
|
85
|
+
fetch-depth: 0
|
|
86
|
+
|
|
87
|
+
- name: Build wheels
|
|
88
|
+
uses: pypa/cibuildwheel@v3.4.0
|
|
89
|
+
with:
|
|
90
|
+
only: ${{ matrix.only }}
|
|
91
|
+
env:
|
|
92
|
+
CIBW_BUILD_VERBOSITY: 1
|
|
93
|
+
|
|
94
|
+
- name: Upload wheels
|
|
95
|
+
uses: actions/upload-artifact@v4
|
|
96
|
+
with:
|
|
97
|
+
name: wheel-${{ matrix.only }}
|
|
98
|
+
path: wheelhouse/*.whl
|
|
99
|
+
|
|
100
|
+
# Publish to PyPI using trusted publishing.
|
|
101
|
+
publish:
|
|
102
|
+
name: Publish to PyPI
|
|
103
|
+
needs: [sdist-and-wheel, mypyc-wheels]
|
|
104
|
+
runs-on: ubuntu-latest
|
|
105
|
+
# Only publish on release events or manual trigger with `publish=true`.
|
|
106
|
+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish)
|
|
107
|
+
environment:
|
|
108
|
+
name: pypi
|
|
109
|
+
url: https://pypi.org/p/plum-dispatch
|
|
110
|
+
permissions:
|
|
111
|
+
id-token: write # Required for trusted publishing
|
|
112
|
+
steps:
|
|
113
|
+
- name: Download all artifacts
|
|
114
|
+
uses: actions/download-artifact@v4
|
|
115
|
+
with:
|
|
116
|
+
path: dist
|
|
117
|
+
merge-multiple: true
|
|
118
|
+
|
|
119
|
+
- name: List artifacts
|
|
120
|
+
run: ls -la dist/
|
|
121
|
+
|
|
122
|
+
- name: Publish to PyPI
|
|
123
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
124
|
+
with:
|
|
125
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
name: Build and Publish to New PyPI Name
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
publish:
|
|
9
|
+
description: "Publish to PyPI (only for releases)"
|
|
10
|
+
required: false
|
|
11
|
+
default: false
|
|
12
|
+
type: boolean
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
# Cancel any in-progress build when a new commit is pushed.
|
|
18
|
+
concurrency:
|
|
19
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
20
|
+
cancel-in-progress: true
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
# Build the `sdist` and pure Python wheel.
|
|
24
|
+
sdist-and-wheel:
|
|
25
|
+
name: Build sdist and pure wheel
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
fetch-depth: 0 # Needed for hatch-vcs versioning
|
|
31
|
+
|
|
32
|
+
- name: Adjust metadata
|
|
33
|
+
shell: bash
|
|
34
|
+
run: |
|
|
35
|
+
python - <<'PYTHON'
|
|
36
|
+
from pathlib import Path
|
|
37
|
+
|
|
38
|
+
for path in [
|
|
39
|
+
Path("pyproject.toml"),
|
|
40
|
+
Path("uv.lock"),
|
|
41
|
+
]:
|
|
42
|
+
text = path.read_text(encoding="utf-8")
|
|
43
|
+
text = text.replace("plum-dispatch", "plum")
|
|
44
|
+
path.write_text(text, encoding="utf-8")
|
|
45
|
+
PYTHON
|
|
46
|
+
|
|
47
|
+
- name: Store release version
|
|
48
|
+
shell: bash
|
|
49
|
+
run: echo "RELEASE_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
|
|
50
|
+
|
|
51
|
+
- name: Set up uv
|
|
52
|
+
uses: astral-sh/setup-uv@v5
|
|
53
|
+
with:
|
|
54
|
+
python-version: "3.12"
|
|
55
|
+
|
|
56
|
+
- name: Build sdist and wheel
|
|
57
|
+
run: uv build
|
|
58
|
+
env:
|
|
59
|
+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.RELEASE_VERSION }}
|
|
60
|
+
|
|
61
|
+
- name: Upload sdist
|
|
62
|
+
uses: actions/upload-artifact@v4
|
|
63
|
+
with:
|
|
64
|
+
name: sdist
|
|
65
|
+
path: dist/*.tar.gz
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
- name: Upload wheel
|
|
69
|
+
uses: actions/upload-artifact@v4
|
|
70
|
+
with:
|
|
71
|
+
name: wheel-pure
|
|
72
|
+
path: dist/*.whl
|
|
73
|
+
|
|
74
|
+
# Generate the wheel build matrix dynamically.
|
|
75
|
+
generate-wheels-matrix:
|
|
76
|
+
name: Generate wheels matrix
|
|
77
|
+
runs-on: ubuntu-latest
|
|
78
|
+
outputs:
|
|
79
|
+
include: ${{ steps.set-matrix.outputs.include }}
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v4
|
|
82
|
+
|
|
83
|
+
- name: Adjust metadata
|
|
84
|
+
shell: bash
|
|
85
|
+
run: |
|
|
86
|
+
python - <<'PYTHON'
|
|
87
|
+
from pathlib import Path
|
|
88
|
+
|
|
89
|
+
for path in [
|
|
90
|
+
Path("pyproject.toml"),
|
|
91
|
+
Path("uv.lock"),
|
|
92
|
+
]:
|
|
93
|
+
text = path.read_text(encoding="utf-8")
|
|
94
|
+
text =text.replace("plum-dispatch", "plum")
|
|
95
|
+
path.write_text(text, encoding="utf-8")
|
|
96
|
+
PYTHON
|
|
97
|
+
|
|
98
|
+
- name: Store release version
|
|
99
|
+
shell: bash
|
|
100
|
+
run: echo "RELEASE_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
|
|
101
|
+
|
|
102
|
+
- name: Set up uv
|
|
103
|
+
uses: astral-sh/setup-uv@v5
|
|
104
|
+
|
|
105
|
+
- name: Install cibuildwheel and generate matrix
|
|
106
|
+
run: |
|
|
107
|
+
uvx cibuildwheel==3.4.0 --print-build-identifiers --platform linux \
|
|
108
|
+
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' > /tmp/linux_builds.json
|
|
109
|
+
uvx cibuildwheel==3.4.0 --print-build-identifiers --platform macos \
|
|
110
|
+
| jq -nRc '{"only": inputs, "os": "macos-14"}' > /tmp/macos_builds.json
|
|
111
|
+
uvx cibuildwheel==3.4.0 --print-build-identifiers --platform windows \
|
|
112
|
+
| jq -nRc '{"only": inputs, "os": "windows-latest"}' > /tmp/windows_builds.json
|
|
113
|
+
env:
|
|
114
|
+
CIBW_BUILD_VERBOSITY: 1
|
|
115
|
+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.RELEASE_VERSION }}
|
|
116
|
+
CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION
|
|
117
|
+
|
|
118
|
+
- name: Merge matrices
|
|
119
|
+
id: set-matrix
|
|
120
|
+
run: |
|
|
121
|
+
MATRIX=$(jq -sc '.' /tmp/*_builds.json | jq -c '.')
|
|
122
|
+
echo "include=$MATRIX" >> "$GITHUB_OUTPUT"
|
|
123
|
+
|
|
124
|
+
# Build `mypyc`-compiled wheels using `cibuildwheel`.
|
|
125
|
+
mypyc-wheels:
|
|
126
|
+
name: Build ${{ matrix.only }}
|
|
127
|
+
needs: generate-wheels-matrix
|
|
128
|
+
runs-on: ${{ matrix.os }}
|
|
129
|
+
strategy:
|
|
130
|
+
fail-fast: false
|
|
131
|
+
matrix:
|
|
132
|
+
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
|
|
133
|
+
steps:
|
|
134
|
+
- uses: actions/checkout@v4
|
|
135
|
+
with:
|
|
136
|
+
fetch-depth: 0
|
|
137
|
+
|
|
138
|
+
- name: Adjust metadata
|
|
139
|
+
shell: bash
|
|
140
|
+
run: |
|
|
141
|
+
python - <<'PYTHON'
|
|
142
|
+
from pathlib import Path
|
|
143
|
+
|
|
144
|
+
for path in [
|
|
145
|
+
Path("pyproject.toml"),
|
|
146
|
+
Path("uv.lock"),
|
|
147
|
+
]:
|
|
148
|
+
text = path.read_text(encoding="utf-8")
|
|
149
|
+
text = text.replace("plum-dispatch", "plum")
|
|
150
|
+
path.write_text(text, encoding="utf-8")
|
|
151
|
+
PYTHON
|
|
152
|
+
|
|
153
|
+
- name: Store release version
|
|
154
|
+
shell: bash
|
|
155
|
+
run: echo "RELEASE_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
|
|
156
|
+
|
|
157
|
+
- name: Build wheels
|
|
158
|
+
uses: pypa/cibuildwheel@v3.4.0
|
|
159
|
+
with:
|
|
160
|
+
only: ${{ matrix.only }}
|
|
161
|
+
env:
|
|
162
|
+
CIBW_BUILD_VERBOSITY: 1
|
|
163
|
+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.RELEASE_VERSION }}
|
|
164
|
+
CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION
|
|
165
|
+
|
|
166
|
+
- name: Upload wheels
|
|
167
|
+
uses: actions/upload-artifact@v4
|
|
168
|
+
with:
|
|
169
|
+
name: wheel-${{ matrix.only }}
|
|
170
|
+
path: wheelhouse/*.whl
|
|
171
|
+
|
|
172
|
+
# Publish to PyPI using trusted publishing.
|
|
173
|
+
publish:
|
|
174
|
+
name: Publish to PyPI
|
|
175
|
+
needs: [sdist-and-wheel, mypyc-wheels]
|
|
176
|
+
runs-on: ubuntu-latest
|
|
177
|
+
# Only publish on release events or manual trigger with `publish=true`.
|
|
178
|
+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish)
|
|
179
|
+
environment:
|
|
180
|
+
name: pypi
|
|
181
|
+
url: https://pypi.org/p/plum
|
|
182
|
+
permissions:
|
|
183
|
+
id-token: write # Required for trusted publishing
|
|
184
|
+
steps:
|
|
185
|
+
- name: Download all artifacts
|
|
186
|
+
uses: actions/download-artifact@v4
|
|
187
|
+
with:
|
|
188
|
+
path: dist
|
|
189
|
+
merge-multiple: true
|
|
190
|
+
|
|
191
|
+
- name: List artifacts
|
|
192
|
+
run: ls -la dist/
|
|
193
|
+
|
|
194
|
+
- name: Publish to PyPI
|
|
195
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
196
|
+
with:
|
|
197
|
+
packages-dir: dist/
|
plum-2.8.0/.gitignore
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Autogenerated files
|
|
2
|
+
src/plum/_version.py
|
|
3
|
+
|
|
4
|
+
# Byte-compiled file
|
|
5
|
+
*.pyc
|
|
6
|
+
|
|
7
|
+
# Virtual environments
|
|
8
|
+
venv
|
|
9
|
+
.tox
|
|
10
|
+
|
|
11
|
+
# Packaging
|
|
12
|
+
*.egg-info
|
|
13
|
+
dist
|
|
14
|
+
pip-wheel-metadata
|
|
15
|
+
|
|
16
|
+
# Documentation and coverage
|
|
17
|
+
docs/_build
|
|
18
|
+
docs/_static
|
|
19
|
+
docs/source
|
|
20
|
+
docs/readme.rst
|
|
21
|
+
cover
|
|
22
|
+
|
|
23
|
+
# Other
|
|
24
|
+
.DS_Store
|
|
25
|
+
*.swp
|
|
26
|
+
.envrc
|
|
27
|
+
|
|
28
|
+
# Cython build files
|
|
29
|
+
*.html
|
|
30
|
+
*.c
|
|
31
|
+
*.so
|
|
32
|
+
*.o
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_commit_msg: "chore: update pre-commit hooks"
|
|
3
|
+
autofix_commit_msg: "style: pre-commit fixes"
|
|
4
|
+
|
|
5
|
+
default_language_version:
|
|
6
|
+
python: "3.10"
|
|
7
|
+
|
|
8
|
+
repos:
|
|
9
|
+
- repo: meta
|
|
10
|
+
hooks:
|
|
11
|
+
- id: check-useless-excludes
|
|
12
|
+
|
|
13
|
+
- repo: https://github.com/abravalheri/validate-pyproject
|
|
14
|
+
rev: v0.23
|
|
15
|
+
hooks:
|
|
16
|
+
- id: validate-pyproject
|
|
17
|
+
|
|
18
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
19
|
+
rev: "v4.6.0"
|
|
20
|
+
hooks:
|
|
21
|
+
- id: check-added-large-files
|
|
22
|
+
- id: check-case-conflict
|
|
23
|
+
- id: check-merge-conflict
|
|
24
|
+
- id: check-yaml
|
|
25
|
+
- id: debug-statements
|
|
26
|
+
- id: end-of-file-fixer
|
|
27
|
+
- id: mixed-line-ending
|
|
28
|
+
- id: trailing-whitespace
|
|
29
|
+
|
|
30
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
31
|
+
rev: "v0.7.3"
|
|
32
|
+
hooks:
|
|
33
|
+
# Run the linter
|
|
34
|
+
- id: ruff
|
|
35
|
+
types_or: [python, pyi]
|
|
36
|
+
args: ["--fix", "--show-fixes"]
|
|
37
|
+
# Run the formatter
|
|
38
|
+
- id: ruff-format
|
|
39
|
+
types_or: [python, pyi]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
build:
|
|
4
|
+
os: ubuntu-22.04
|
|
5
|
+
tools:
|
|
6
|
+
python: "3.12"
|
|
7
|
+
nodejs: "20"
|
|
8
|
+
jobs:
|
|
9
|
+
install:
|
|
10
|
+
# Since the install step is overridden, pip is no longer updated automatically.
|
|
11
|
+
- pip install --upgrade pip
|
|
12
|
+
- pip install --group 'docs' .
|
|
13
|
+
|
|
14
|
+
pre_build:
|
|
15
|
+
# Generate the Sphinx configuration for this Jupyter Book, so it builds.
|
|
16
|
+
- "jupyter-book config sphinx docs/"
|
|
17
|
+
|
|
18
|
+
sphinx:
|
|
19
|
+
builder: html
|
|
20
|
+
fail_on_warning: true
|
|
21
|
+
configuration: docs/conf.py
|
plum-2.8.0/LICENCE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Wessel Bruinsma
|
|
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.
|