pheon/tools/check_installed.py
Jan Petykiewicz a723ba2265 Simplify Python bindings and package builds
Read each input path through one opened stream, including gzip detection, and
use direct numeric converter lookup while preserving byte-order handling and
caller data. Read the package version from installed metadata and report range
errors consistently as ValueError.

Require the supplied Cargo.lock instead of generating it during builds, use
the standard sdist command, and update package checks and development guides.

Validation: 15 Python tests pass against source and the rebuilt installed
wheel; the source archive and platform wheel build successfully.
2026-11-16 20:44:56 -08:00

26 lines
833 B
Python

"""Run outside the checkout, without PHEON_LIBRARY, after installing a wheel."""
from pathlib import Path
import subprocess
import sys
import unittest
ROOT = Path(__file__).resolve().parents[1]
# A separate interpreter verifies that base packing does not import PyArrow.
subprocess.run(
[sys.executable, "-I", "-c", """
import sys
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')
"""],
check=True,
)
suite = unittest.defaultTestLoader.discover(str(ROOT / "tests/python"))
if not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful():
raise SystemExit(1)