From f474e9848ccc1ff884180f2078c66c5b1ec289fa Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Wed, 18 Nov 2026 12:36:58 -0800 Subject: [PATCH] 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. --- .github/workflows/packages.yml | 3 +-- README.md | 2 +- docs/development.md | 4 ++-- docs/python.md | 13 ++++++------- docs/releases.md | 9 ++++----- pheon/__init__.py | 2 +- pheon/arrow.py | 3 +-- pyproject.toml | 3 ++- tools/check_installed.py | 4 ++-- 9 files changed, 20 insertions(+), 23 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 710c22f..321f3c6 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -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: diff --git a/README.md b/README.md index 470c168..5d035ba 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/docs/development.md b/docs/development.md index 493f35b..e884456 100644 --- a/docs/development.md +++ b/docs/development.md @@ -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 diff --git a/docs/python.md b/docs/python.md index fa48cf4..bc03060 100644 --- a/docs/python.md +++ b/docs/python.md @@ -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 diff --git a/docs/releases.md b/docs/releases.md index 4384205..b21c70d 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -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 ``` diff --git a/pheon/__init__.py b/pheon/__init__.py index b71eb35..535f808 100644 --- a/pheon/__init__.py +++ b/pheon/__init__.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 diff --git a/pheon/arrow.py b/pheon/arrow.py index 5aa6ee1..af3a39a 100644 --- a/pheon/arrow.py +++ b/pheon/arrow.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 835880a..aaa9512 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/tools/check_installed.py b/tools/check_installed.py index 970dc90..437aadb 100644 --- a/tools/check_installed.py +++ b/tools/check_installed.py @@ -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, )