Require PyArrow in the Python package
Keep the arrow extra available for existing requirements. Update wheel checks and install instructions, and verify that integer packing leaves PyArrow unloaded.
This commit is contained in:
parent
8efeb04aab
commit
f474e9848c
9 changed files with 20 additions and 23 deletions
3
.github/workflows/packages.yml
vendored
3
.github/workflows/packages.yml
vendored
|
|
@ -56,7 +56,6 @@ jobs:
|
|||
CIBW_ARCHS: native
|
||||
CIBW_ENVIRONMENT_LINUX: 'CARGO_HOME=/tmp/pheon-cargo RUSTUP_HOME=/tmp/pheon-rustup PATH=/tmp/pheon-cargo/bin:$PATH'
|
||||
CIBW_BEFORE_ALL_LINUX: 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable'
|
||||
CIBW_TEST_EXTRAS: arrow
|
||||
CIBW_TEST_COMMAND: 'python -I {project}/tools/check_installed.py'
|
||||
- name: Check wheel ABI tags
|
||||
shell: python
|
||||
|
|
@ -91,7 +90,7 @@ jobs:
|
|||
path: wheelhouse
|
||||
- name: Install the same artifact on another Python version
|
||||
shell: bash
|
||||
run: python -m pip install wheelhouse/*.whl pyarrow
|
||||
run: python -m pip install wheelhouse/*.whl
|
||||
- run: python -I tools/check_installed.py
|
||||
|
||||
cli:
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ comparisons. Start with the [CLI guide](docs/cli.md), then set up
|
|||
Python 3.11 or newer is required. From a source checkout:
|
||||
|
||||
```sh
|
||||
python -m pip install '.[arrow]'
|
||||
python -m pip install .
|
||||
```
|
||||
|
||||
Run Python outside the source checkout to use the installed package:
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ the tracked `Cargo.lock`; update dependencies explicitly with Cargo.
|
|||
cargo test --locked
|
||||
cargo test --release --locked
|
||||
cargo build --release --locked
|
||||
python -m pip install '.[arrow]'
|
||||
python -m pip install .
|
||||
python -I tools/check_installed.py
|
||||
```
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ Unset this override when checking installed artifacts with `check_installed.py`.
|
|||
## Check upstream layouts
|
||||
|
||||
The [GDSII corpus](../contrib/gds-corpus.toml) pins open-source fixtures and cell
|
||||
libraries. After installing `.[arrow]` and building the release CLI, run:
|
||||
libraries. After installing Pheon and building the release CLI, run:
|
||||
|
||||
```sh
|
||||
python -I tools/check_gds_corpus.py --fetch
|
||||
|
|
|
|||
|
|
@ -6,16 +6,15 @@ Python 3.11 or newer is required.
|
|||
|
||||
## Install
|
||||
|
||||
To install a PyPI release with Arrow support:
|
||||
To install a PyPI release:
|
||||
|
||||
```sh
|
||||
python -m pip install 'pheon[arrow]'
|
||||
python -m pip install pheon
|
||||
```
|
||||
|
||||
For a local wheel, pass its file path followed by `[arrow]` in the same quotes.
|
||||
Prebuilt wheels bundle the native library. From a source checkout, use
|
||||
`python -m pip install '.[arrow]'` with Rust 1.88 or newer. The base `pheon`
|
||||
package is enough for integer packing.
|
||||
The package installs PyArrow for layout reads. Existing `pheon[arrow]`
|
||||
requirements still work. Prebuilt wheels bundle the native library. From a
|
||||
source checkout, use `python -m pip install .` with Rust 1.88 or newer.
|
||||
|
||||
Run Python outside the source checkout to use the installed package.
|
||||
|
||||
|
|
@ -89,7 +88,7 @@ errors use Python's normal I/O exceptions.
|
|||
## Use from Klamath or Masque
|
||||
|
||||
Klamath's `native` extra installs Pheon's packing helpers. Masque's `arrow` extra
|
||||
installs Pheon with Arrow support. Use the same Python environment as the
|
||||
installs Pheon for layout reads. Use the same Python environment as the
|
||||
companion package.
|
||||
|
||||
See [development](development.md) to test a locally built native library from
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ export CIBW_CONTAINER_ENGINE="podman; disable_host_mount: true; create_args: \
|
|||
export CIBW_MANYLINUX_X86_64_IMAGE=localhost/pheon-manylinux:2.28-2026.10.26-1
|
||||
export CIBW_ENVIRONMENT_LINUX='PATH=/rust-toolchain/bin:$PATH CARGO_HOME=/pheon-cache/cargo CARGO_NET_OFFLINE=true PIP_CACHE_DIR=/pheon-cache/pip'
|
||||
export CIBW_BUILD='cp31{1,2,3,4}-manylinux_x86_64'
|
||||
export CIBW_TEST_EXTRAS=arrow
|
||||
export CIBW_TEST_COMMAND='python -I {project}/tools/check_installed.py'
|
||||
unset PHEON_LIBRARY
|
||||
python -m cibuildwheel --platform linux --archs x86_64 \
|
||||
|
|
@ -93,12 +92,12 @@ Wheel filenames use `py3-none` plus a platform tag, such as
|
|||
`manylinux_2_28_x86_64` or `win_amd64`. Use repaired `manylinux_*` wheels for
|
||||
Linux releases.
|
||||
|
||||
To test a wheel manually, install it with its `arrow` extra in a test
|
||||
environment on the target OS. Clear `PHEON_LIBRARY` so the checks load the
|
||||
bundled library. Replace the example path with the wheel you built.
|
||||
To test a wheel manually, install it in a test environment on the target OS.
|
||||
Clear `PHEON_LIBRARY` so the checks load the bundled library. Replace the
|
||||
example path with the wheel you built.
|
||||
|
||||
```sh
|
||||
python -m pip install "path/to/pheon-wheel.whl[arrow]"
|
||||
python -m pip install "path/to/pheon-wheel.whl"
|
||||
python -I tools/check_installed.py
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""Native GDSII helpers. Install pheon[arrow] for the pheon.arrow readers."""
|
||||
"""Native GDSII helpers. Use pheon.arrow to read layouts into PyArrow."""
|
||||
|
||||
from importlib.metadata import version as _version
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"""GDSII readers returning a one-row Arrow StructArray for the library.
|
||||
|
||||
The returned arrays own their buffers independently of the input. This module
|
||||
requires the optional ``arrow`` extra; integer packing does not import PyArrow.
|
||||
The returned arrays own their buffers independently of the input.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
|
|||
|
|
@ -26,10 +26,11 @@ dynamic = ["version"]
|
|||
dependencies = [
|
||||
"cffi",
|
||||
"numpy",
|
||||
"pyarrow>=14",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
arrow = ["pyarrow>=14"]
|
||||
arrow = [] # Compatibility with existing requirements for pheon[arrow].
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://mpxd.net/code/jan/pheon"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import unittest
|
|||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
# A separate interpreter verifies that base packing does not import PyArrow.
|
||||
# A separate interpreter checks that PyArrow stays unloaded during packing.
|
||||
subprocess.run(
|
||||
[sys.executable, "-I", "-c", """
|
||||
import sys
|
||||
|
|
@ -15,9 +15,9 @@ from importlib.metadata import version
|
|||
import pheon
|
||||
from pheon._native import library
|
||||
assert pheon.__version__ == version('pheon')
|
||||
assert 'pyarrow' not in sys.modules
|
||||
assert library.parent == __import__('pathlib').Path(pheon.__file__).parent
|
||||
assert pheon.pack_int2([1, -2]) == bytes.fromhex('0001fffe')
|
||||
assert 'pyarrow' not in sys.modules
|
||||
"""],
|
||||
check=True,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue