This package compiles Cython extensions while it builds. Keep setup.py
because the build backend calls it to compile those extensions.
Install the package and every development dependency with uv:
uv sync --all-extrasThe STL tests do not need external services:
uv run pytest tests/test_stl.pyThe low-level PostgreSQL binary array converter tests also run without a PostgreSQL server:
uv run pytest tests/test_psycopg_array.pyThe psycopg loader integration tests use the pytest-postgresql postgresql
fixture. The fixture finds pg_ctl through pg_config and starts a temporary
local server. Check the resolved binary directory before running the
integration tests:
command -v pg_config
pg_config --bindirNote
A PostgreSQL Docker container on port 5432 does not satisfy the current
fixture. The tests request the process-backed postgresql fixture rather
than postgresql_noproc.
Once the local PostgreSQL executables are available, run:
uv run pytest tests/test_arrays.pyuv run ruff check .
uv run ruff format --check .
uv run codespell .
uv run pyright speedups tests
uv run mypy speedupsRuff and codespell check the source and documentation. Pyright and mypy check
the typed Python API. Their configuration lives in ruff.toml and
pyproject.toml.
Run the full tox matrix before you publish changes:
uvx --with tox-uv tox -p autoTox builds the extension against every supported Python and NumPy combination,
then runs the lint and type-check environments. A successful run ends with
every environment marked OK.
- Every
.pyxmodule should have a matching.pyistub. speedups/stl.pyxintentionally useslanguage_level=2.speedups/psycopg_array.pyxuseslanguage_level=3.- Python coverage cannot measure lines inside compiled Cython modules. Test their behavior through the Python API instead.
Benchmark code lives in benchmarks/run_benchmarks.py. Generated charts live
in benchmarks/results/. Change benchmark numbers in the documentation only
when you intentionally rerun the suite and update its generated results.