Research preview

Development Guide

Local setup, testing, linting, releases, and contributing to vortex-pqc.

Skip to content

Quick setup

bash
git clone https://github.com/bajpai-labs/vortex-pqc.git
cd vortex-pqc

python3 -m venv .venv
source .venv/bin/activate

pip install -U pip wheel
pip install -e ".[dev]"

make test

Expected output ends with 26 passed (Python) and All tests passed (C).

Daily commands

CommandWhat it does
make testPython + C test suites
make test-pythonPython tests only
make test-cC library tests only
make lintflake8 + mypy
make buildBuild Python wheel → dist/
make cleanRemove all build artifacts
make -C c demoRun Alice–Bob CLI demo

Where to edit

ChangeFiles
Public Python APIsrc/vortex_pqc/core.py, __init__.py
Crypto logic (reference)src/vortex_pqc/_pure.py
Scheme parameterssrc/vortex_pqc/params.py
PEM encodingsrc/vortex_pqc/pem.py
C KEM operationsc/src/vortex_core.c
C polynomial mathc/src/vortex_poly.c
Python ↔ C bindingsc/src/python_module.c
C public headerc/include/vortex_pqc.h

Golden rule: changes to _pure.py must be mirrored in the C implementation. Both backends must produce identical byte outputs.

Running tests

bash
# Everything
make test

# Single Python test
python -m pytest src/tests/test_core.py::test_round_trip_basic -v

# With coverage
python -m pytest src/tests/ --cov=vortex_pqc --cov-report=term-missing

# C only
make -C c test

What must always pass

SuiteFileCovers
Python coretest_core.pyRound-trip, rejection, validation
Python PEMtest_pem.pyEncode/decode, file I/O, permissions
C librarytest_vortex.cRound-trip, tamper rejection, sizes

Rebuilding the native extension

After editing C sources:

bash
pip install -e . --force-reinstall --no-deps

Verify:

python
import vortex_pqc
assert "native" in vortex_pqc.native_backend()

Debugging tips

Force pure-Python backend

Temporarily move the compiled extension aside to isolate C bugs:

bash
mv src/vortex_pqc/_native*.so /tmp/
python -m pytest src/tests/ -v
Run the C demo
bash
make -C c demo
./c/examples/demo
Benchmark both backends
python
from vortex_pqc import benchmark_throughput, native_backend

print(f"Backend: {native_backend()}")
print(benchmark_throughput(20))

Lint & type-check

bash
make lint

# Individual
python -m flake8 src/vortex_pqc/ --max-line-length=100
python -m mypy src/vortex_pqc/ --ignore-missing-imports

Shipping a release

One-time PyPI setup

  1. Create project vortex-pqc on pypi.org
  2. Generate an API token
  3. Add PYPI_API_TOKEN to GitHub → Settings → Secrets → Actions

Release checklist

□ Bump version in pyproject.toml
□ Bump __version__ in src/vortex_pqc/__init__.py
□ Run make test && make lint
□ Commit and push to main
□ Create GitHub Release (tag: v0.x.x)
□ CI publishes automatically via release.yml

Manual publish (emergency)

bash
make build
twine check dist/*
twine upload dist/*

Contributor checklist

□ Implement in _pure.py (reference)
□ Mirror in C if performance-critical
□ Export from core.py / __init__.py if public
□ Add tests in src/tests/
□ Update docs/api-reference.md
□ Update docs/getting-started.md if user-facing
□ Run make test && make lint

Security rules

DoDon't
Use hmac.compare_digest for secret comparisonsLog keys, seeds, or shared secrets
Clear secret buffers in C with secure_zeroCommit .pem, .key, or .env files
Report vulnerabilities to hello@bajpailabs.comSkip security tests to make CI green

CI pipeline

Every push and PR to main runs:

JobMatrixSteps
PythonUbuntu + macOS × 3.10/3.11/3.12install → pytest → lint → mypy
C libraryUbuntu + macOSmake -C c test

→ Defined in .github/workflows/ci.yml

Documentation sync

Published docs live in the central Bajpai Labs documentation repo:

bajpai-labs/documentation → docs/vortex-pqc

Automatic (CI)

On every push to main that changes docs/**, the workflow .github/workflows/sync-docs.yml rsyncs this folder to documentation/docs/vortex-pqc/ and commits the result.

One-time GitHub setup

  1. Create a fine-grained or classic PAT with Contents: Read and write on bajpai-labs/documentation
  2. In vortex-pqc → Settings → Secrets → Actions, add:
    • Name: DOCS_SYNC_TOKEN
    • Value: your PAT

Manual sync (local)

bash
git clone https://github.com/bajpai-labs/documentation.git ../documentation
chmod +x scripts/sync-docs.sh
./scripts/sync-docs.sh ../documentation
cd ../documentation
git add docs/vortex-pqc/
git commit -m "docs(vortex-pqc): manual sync"
git push origin main