Skip to content

Commit 6cbc141

Browse files
committed
build: prepare pykore 0.2.1 for pypi
- complete PyPI metadata and README_PYPI.md - add manylinux/TestPyPI/PyPI publish workflow - add self-contained TestPyPI install smoke script - expose pykore.__version__ for installed package verification
1 parent 82450ff commit 6cbc141

8 files changed

Lines changed: 294 additions & 2 deletions

File tree

.github/workflows/publish-pypi.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Publish PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
repository:
7+
description: Target repository
8+
required: true
9+
default: testpypi
10+
type: choice
11+
options:
12+
- testpypi
13+
- pypi
14+
confirm_testpypi_verified:
15+
description: Confirm TestPyPI install verification was completed before publishing to PyPI
16+
required: false
17+
default: false
18+
type: boolean
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
build-wheels:
25+
name: Build manylinux wheels
26+
runs-on: ubuntu-latest
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
target: [x86_64, aarch64]
31+
steps:
32+
- uses: actions/checkout@v5
33+
- uses: PyO3/maturin-action@v1
34+
with:
35+
target: ${{ matrix.target }}
36+
manylinux: auto
37+
args: --release --out dist
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: wheels-${{ matrix.target }}
41+
path: dist
42+
43+
build-sdist:
44+
name: Build source distribution
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v5
48+
- uses: PyO3/maturin-action@v1
49+
with:
50+
command: sdist
51+
args: --out dist
52+
- uses: actions/upload-artifact@v4
53+
with:
54+
name: sdist
55+
path: dist
56+
57+
publish-testpypi:
58+
name: Upload to TestPyPI
59+
runs-on: ubuntu-latest
60+
needs: [build-wheels, build-sdist]
61+
if: ${{ github.event.inputs.repository == 'testpypi' && secrets.TEST_PYPI_API_TOKEN != '' }}
62+
steps:
63+
- uses: actions/download-artifact@v4
64+
with:
65+
path: dist
66+
merge-multiple: true
67+
- uses: pypa/gh-action-pypi-publish@release/v1
68+
with:
69+
repository-url: https://test.pypi.org/legacy/
70+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
71+
72+
publish-pypi:
73+
name: Upload to PyPI
74+
runs-on: ubuntu-latest
75+
needs: [build-wheels, build-sdist]
76+
if: ${{ github.event.inputs.repository == 'pypi' && github.event.inputs.confirm_testpypi_verified == 'true' && secrets.PYPI_API_TOKEN != '' }}
77+
steps:
78+
- uses: actions/download-artifact@v4
79+
with:
80+
path: dist
81+
merge-multiple: true
82+
- uses: pypa/gh-action-pypi-publish@release/v1
83+
with:
84+
password: ${{ secrets.PYPI_API_TOKEN }}

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "kore"
3-
version = "0.1.0"
3+
version = "0.2.1"
44
edition = "2024"
55
description = "Portable FFT-based Schrodinger-Poisson pseudospectral kernel"
66
license = "MIT OR Apache-2.0"

LICENSE-APACHE

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
Apache License
2+
Version 2.0, January 2004
3+
http://www.apache.org/licenses/
4+
5+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6+
7+
1. Definitions.
8+
9+
"License" shall mean the terms and conditions for use, reproduction, and
10+
distribution as defined by Sections 1 through 9 of this document.
11+
12+
"Licensor" shall mean the copyright owner or entity authorized by the
13+
copyright owner that is granting the License.
14+
15+
"Legal Entity" shall mean the union of the acting entity and all other
16+
entities that control, are controlled by, or are under common control with
17+
that entity. For the purposes of this definition, "control" means (i) the
18+
power, direct or indirect, to cause the direction or management of such entity,
19+
whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or
20+
more of the outstanding shares, or (iii) beneficial ownership of such entity.
21+
22+
"You" (or "Your") shall mean an individual or Legal Entity exercising
23+
permissions granted by this License.
24+
25+
"Source" form shall mean the preferred form for making modifications,
26+
including but not limited to software source code, documentation source, and
27+
configuration files.
28+
29+
"Object" form shall mean any form resulting from mechanical transformation or
30+
translation of a Source form, including but not limited to compiled object
31+
code, generated documentation, and conversions to other media types.
32+
33+
"Work" shall mean the work of authorship, whether in Source or Object form,
34+
made available under the License, as indicated by a copyright notice that is
35+
included in or attached to the work.
36+
37+
"Derivative Works" shall mean any work, whether in Source or Object form,
38+
that is based on (or derived from) the Work and for which the editorial
39+
revisions, annotations, elaborations, or other modifications represent, as a
40+
whole, an original work of authorship.
41+
42+
"Contribution" shall mean any work of authorship, including the original
43+
version of the Work and any modifications or additions to that Work or
44+
Derivative Works, that is intentionally submitted to Licensor for inclusion in
45+
the Work by the copyright owner or by an individual or Legal Entity authorized
46+
to submit on behalf of the copyright owner.
47+
48+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
49+
of whom a Contribution has been received by Licensor and subsequently
50+
incorporated within the Work.
51+
52+
2. Grant of Copyright License. Subject to the terms and conditions of this
53+
License, each Contributor hereby grants to You a perpetual, worldwide,
54+
non-exclusive, no-charge, royalty-free, irrevocable copyright license to
55+
reproduce, prepare Derivative Works of, publicly display, publicly perform,
56+
sublicense, and distribute the Work and such Derivative Works in Source or
57+
Object form.
58+
59+
3. Grant of Patent License. Subject to the terms and conditions of this
60+
License, each Contributor hereby grants to You a perpetual, worldwide,
61+
non-exclusive, no-charge, royalty-free, irrevocable patent license to make,
62+
have made, use, offer to sell, sell, import, and otherwise transfer the Work.
63+
64+
4. Redistribution. You may reproduce and distribute copies of the Work or
65+
Derivative Works thereof in any medium, with or without modifications, and in
66+
Source or Object form, provided that You meet the following conditions:
67+
68+
(a) You must give any other recipients of the Work or Derivative Works a
69+
copy of this License; and
70+
71+
(b) You must cause any modified files to carry prominent notices stating
72+
that You changed the files; and
73+
74+
(c) You must retain, in the Source form of any Derivative Works that You
75+
distribute, all copyright, patent, trademark, and attribution notices
76+
from the Source form of the Work, excluding those notices that do not
77+
pertain to any part of the Derivative Works; and
78+
79+
(d) If the Work includes a "NOTICE" text file as part of its distribution,
80+
then any Derivative Works that You distribute must include a readable
81+
copy of the attribution notices contained within such NOTICE file.
82+
83+
5. Submission of Contributions. Unless You explicitly state otherwise, any
84+
Contribution intentionally submitted for inclusion in the Work by You to the
85+
Licensor shall be under the terms and conditions of this License.
86+
87+
6. Trademarks. This License does not grant permission to use the trade names,
88+
trademarks, service marks, or product names of the Licensor.
89+
90+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
91+
writing, Licensor provides the Work on an "AS IS" BASIS, WITHOUT WARRANTIES OR
92+
CONDITIONS OF ANY KIND, either express or implied.
93+
94+
8. Limitation of Liability. In no event and under no legal theory, whether in
95+
tort (including negligence), contract, or otherwise, unless required by
96+
applicable law, shall any Contributor be liable to You for damages arising as a
97+
result of this License or out of the use or inability to use the Work.
98+
99+
9. Accepting Warranty or Additional Liability. While redistributing the Work
100+
or Derivative Works thereof, You may choose to offer, and charge a fee for,
101+
acceptance of support, warranty, indemnity, or other liability obligations.
102+
103+
END OF TERMS AND CONDITIONS

LICENSE-MIT

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Edengilbert
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.

README_PYPI.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# pykore
2+
3+
pykore provides Python bindings for kore, a portable Schrödinger-Poisson pseudo-spectral kernel written in Rust.
4+
5+
## Install
6+
7+
```bash
8+
pip install pykore
9+
```
10+
11+
## Quick start
12+
13+
```python
14+
import numpy as np
15+
import pykore
16+
17+
grid = pykore.Grid((64, 64, 64), (1.0, 1.0, 1.0))
18+
config = pykore.Config(dt=0.01, poisson_scale=1.0)
19+
state = pykore.State(np.zeros((64, 64, 64), dtype=np.complex128))
20+
kernel = pykore.Kernel(grid, config)
21+
print(kernel.diagnostics(state))
22+
```
23+
24+
Paper: https://arxiv.org/abs/1807.04037
25+
Repository: https://github.com/edengilbertus/kore

pyproject.toml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,28 @@ build-backend = "maturin"
44

55
[project]
66
name = "pykore"
7-
dynamic = ["version"]
7+
version = "0.2.1"
8+
description = "Portable FFT-based Schrodinger-Poisson pseudospectral kernel"
9+
readme = "README_PYPI.md"
10+
license = { text = "MIT OR Apache-2.0" }
11+
requires-python = ">=3.11"
12+
keywords = ["physics", "simulation", "fft", "dark-matter", "hpc"]
13+
classifiers = [
14+
"Development Status :: 3 - Alpha",
15+
"Intended Audience :: Science/Research",
16+
"License :: OSI Approved :: Apache Software License",
17+
"License :: OSI Approved :: MIT License",
18+
"Programming Language :: Python :: 3",
19+
"Programming Language :: Python :: 3 :: Only",
20+
"Programming Language :: Rust",
21+
"Topic :: Scientific/Engineering",
22+
"Topic :: Scientific/Engineering :: Physics",
23+
]
24+
dependencies = ["numpy>=1.21"]
25+
26+
[project.urls]
27+
Repository = "https://github.com/edengilbertus/kore"
28+
Paper = "https://arxiv.org/abs/1807.04037"
829

930
[tool.maturin]
1031
python-source = "python"

python/pykore/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from importlib import import_module
2+
from importlib.metadata import version as _package_version
23

34
__all__ = [
45
"Grid",
@@ -9,6 +10,8 @@
910
"DiagnosticsSummary",
1011
]
1112

13+
__version__ = _package_version("pykore")
14+
1215

1316
def __getattr__(name: str):
1417
if name not in __all__:

scripts/test_testpypi_install.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
6+
REPO_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
7+
8+
PYTHON_BIN="${PYTHON_BIN:-python3}"
9+
PYKORE_VERSION="${PYKORE_VERSION:-$(REPO_ROOT="$REPO_ROOT" $PYTHON_BIN - <<'PY'
10+
from pathlib import Path
11+
import tomllib
12+
import os
13+
14+
data = tomllib.loads(Path(os.environ['REPO_ROOT'], 'pyproject.toml').read_text())
15+
print(data['project']['version'])
16+
PY
17+
)}"
18+
PACKAGE_SPEC="pykore==${PYKORE_VERSION}"
19+
VENV_DIR="$(mktemp -d "${TMPDIR:-/tmp}/pykore-testpypi.XXXXXX")"
20+
21+
trap 'rm -rf "$VENV_DIR"' EXIT
22+
23+
"$PYTHON_BIN" -m venv "$VENV_DIR"
24+
"$VENV_DIR/bin/pip" install \
25+
--index-url https://test.pypi.org/simple/ \
26+
--extra-index-url https://pypi.org/simple/ \
27+
"$PACKAGE_SPEC"
28+
29+
"$VENV_DIR/bin/python" -c "import pykore; print(pykore.__version__)"
30+
"$VENV_DIR/bin/python" - <<'PY'
31+
import pykore
32+
33+
grid = pykore.Grid((2, 2, 2), (1.0, 1.0, 1.0))
34+
print(type(grid).__name__)
35+
PY

0 commit comments

Comments
 (0)