C/Cython extension library: fast ASCII STL I/O and PostgreSQL binary array to NumPy conversion. Python >=3.10, BSD-3-Clause.
uv sync --all-extrassetup.py is required for Cython extension compilation -- do not remove
or replace it.
uv run pytest tests/test_stl.py # no external deps
uv run pytest tests/test_arrays.py # requires running PostgreSQLQuick PG setup:
docker run -d --name test-pg -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:16uv run ruff check . && uv run ruff format --check . && uv run codespell .
uv run pyright speedups tests && uv run mypy speedupsConfig lives in ruff.toml and pyproject.toml.
Before reporting work as complete, run the full tox suite and confirm it passes:
uvx --with tox-uv tox -p autoAll environments must pass. Do not present results to the user until tox is green -- fix issues yourself first.
Do not modify existing tests to make them pass. The existing tests are correct and verify backwards compatibility. If a test fails, fix your code, not the test.
_stl.pyxuseslanguage_level=2intentionally (C string ops,sscanf/fprintf) -- do not "upgrade" it to 3psycopg_array.pyxuseslanguage_level=3- Every
.pyxmodule must have a corresponding.pyitype stub - Type hints required on all new/modified
.pyfiles (except__init__.py,__about__.py) - Use
from __future__ import annotationsin type-checked pure Python modules - Dual-checker type ignore syntax:
# type: ignore[mypy-code, ty:ty-code] - Cython modules cannot be measured by Python coverage tools -- test indirectly via integration tests
hton.his vendored from MagicStack/py-pgproto (Apache 2.0) -- prefer syncing from upstream; if applying a local bug-fix patch, keep it minimal and document in the commit message