Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
- macos-latest
- windows-latest
python-version:
- "3.8"
- "3.12"
- "3.13"

defaults:
run:
Expand Down
42 changes: 34 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish package

on:
workflow_dispatch:
pull_request:
# pull_request:
push:
branches:
- master
Expand All @@ -16,6 +16,7 @@ concurrency:

env:
FORCE_COLOR: 3
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build_sdist:
Expand All @@ -42,7 +43,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install cibuildwheel
run: pipx install cibuildwheel==2.19.2
run: pipx install cibuildwheel==3.4.0
- id: set-matrix
run: |
MATRIX=$(
Expand All @@ -59,6 +60,8 @@ jobs:
echo "$MATRIX"
echo "include=$MATRIX" >> $GITHUB_OUTPUT
env:
# Build CPython wheels only (3.10-3.13)
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
CIBW_ARCHS_LINUX: x86_64 # aarch64 # skipping as h5py stopped providing pre-build wheels for aarch64 on PyPI
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_WINDOWS: AMD64
Expand Down Expand Up @@ -92,11 +95,8 @@ jobs:
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1

- uses: pypa/cibuildwheel@v2.19.2
- uses: pypa/cibuildwheel@v3.4.0
env:
# skip testing PyPy builds
CIBW_TEST_SKIP: "pp*"

CIBW_ENVIRONMENT_LINUX: >
SKBUILD_CMAKE_ARGS="-DENABLE_ARCH_FLAGS=OFF;-DENABLE_OPENMP=OFF"

Expand All @@ -118,15 +118,18 @@ jobs:
path: ./wheelhouse/*.whl

upload_all:
name: Upload if release
name: Upload distributions
needs:
- build_wheels
- build_sdist
if: >-
github.event_name == 'workflow_dispatch'
|| (github.event_name == 'push' && github.ref == 'refs/heads/master')
|| github.event_name == 'release'
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
#if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v4
Expand All @@ -135,6 +138,29 @@ jobs:
path: dist
merge-multiple: true

- name: Reject local versions in upload artifacts
run: |
python - <<'PY'
from pathlib import Path
files = [path.name for path in Path("dist").glob("*") if path.is_file()]
bad = [name for name in files if "+" in name]
if bad:
joined = "\n".join(f" - {name}" for name in bad)
raise SystemExit(
"Refusing to upload artifacts with local version identifiers:\n"
f"{joined}\n"
"Configure setuptools_scm local_scheme to drop local version suffixes."
)
print("Artifact version check passed.")
PY

- uses: pypa/gh-action-pypi-publish@release/v1
if: >-
github.event_name == 'workflow_dispatch'
|| (github.event_name == 'push' && github.ref == 'refs/heads/master')
|| (github.event_name == 'release' && github.event.release.prerelease)
with:
repository-url: https://test.pypi.org/legacy/

- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release' && !github.event.release.prerelease
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,36 @@ cmake ..
make
```

### pip/setuptools
### pip
Another way to install CPPE is via `pip`:
```
pip install cppe
```
Note that CPPE will be built from source and a C++14 compatible compiler is required (see below), and OpenMP parallelization is **disabled** in the `setup.py`/`pip` installation.
Alternatively, CPPE can be built from source using the `setup.py` script with
If no wheel is available for your platform, CPPE is built from source and a C++14 compatible compiler is required (see below).

To build from a local checkout:
```
git clone https://github.com/maxscheurer/cppe
cd cppe
python setup.py install
python -m pip install .
```

### Python interface
If the Python interface should be built, specify the CMake option
`-DENABLE_PYTHON_INTERFACE=ON`. If `pybind11` is not installed, CMake
will automatically download `pybind11` and install it locally.
Installing through `setup.py` will always build the Python interface.
Installing through `pip` will build the Python interface.

### Dependencies
- C++ 14 compiler
- Python >= 3.6 (interpreter and development packages)
- Python >= 3.8 (interpreter and development packages)

### Tests
The tests can be run with
```
python setup.py build_ext -i; python setup.py test
```
for the `setup.py` build, or
```
source setup_environment.sh; py.test
python -m pip install -e .[test]
pytest
```
for the CMake build.


## Citation
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Chemistry",
]

Expand All @@ -44,7 +46,7 @@ test = [
Homepage = "https://github.com/maxscheurer/cppe"
Source = "https://github.com/maxscheurer/cppe"
"Bug Tracker" = "https://github.com/maxscheurer/cppe/issues"
Changelog = "https://github.com/org/maxscheurer/releases"
Changelog = "https://github.com/maxscheurer/cppe/releases"

[tool.scikit-build]
# Protect the configuration against future changes in scikit-build-core
Expand All @@ -53,9 +55,6 @@ minimum-version = "0.8"
# Setuptools-style build caching in a local directory
build-dir = "build/{wheel_tag}"

# Build stable ABI wheels for CPython 3.12+
wheel.py-api = "cp312"

cmake.verbose = true
cmake.version = ">=3.16"
ninja.make-fallback = false
Expand All @@ -71,6 +70,7 @@ sdist.include = [
[tool.setuptools_scm]
write_to = "src/cppe/_version.py"
fallback_version = "0.3.2"
local_scheme = "no-local-version"

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down
Loading