FastAPIPS/
├── fastapi_payloadshield/ # Main package directory
│ ├── __init__.py # Package initialization & exports
│ ├── config.py # ComPyPS configuration re-export
│ ├── decorators.py # PayloadShield.encrypt/decrypt/crypt decorators
│ └── crypto.py # ComPyPS handler registry re-export
│
├── examples/ # Example implementations
│ ├── main.py # Full-featured example FastAPI app
│ ├── private.pem, public.pem # Generated RSA keys (rsa-hybrid)
│ ├── ec_private.pem, ec_public.pem # Generated EC keys (ecdh-aes-gcm, ecies)
│ └── hpke_private.pem, hpke_public.pem # Generated X25519 keys (hpke)
│
├── tests/ # pytest suite
│ ├── test_handlers.py # Handler encode/decode roundtrip tests
│ ├── test_config.py # PayloadShieldEnc.init() tests
│ └── test_decorators.py # Decorator + FastAPI TestClient tests
│
├── setup.py # Classic setup configuration (pip installable)
├── pyproject.toml # Modern Python project configuration
├── requirements.txt # Development & runtime dependencies
├── README.md # Full API documentation
├── MANIFEST.in # Files to include in distribution
├── .gitignore # Git ignore patterns
└── LICENSE # Apache-2.0 License
git clone <repository-url>
cd FastAPIPS# Windows
python -m venv venv
venv\Scripts\activate
# Linux/Mac
python -m venv venv
source venv/bin/activate# Install package with all dependencies
pip install -e .
# Or with development dependencies
pip install -e ".[dev]"
# Or install from requirements
pip install -r requirements.txtcd examples
python -m uvicorn main:app --reloadThe console prints ready-to-paste Postman requests (URL + JSON body) for every built-in handler on startup.
# Terminal 1: Start server
cd examples
python -m uvicorn main:app --reload
# Terminal 2: Test endpoints (see the Postman examples printed on startup)
curl http://localhost:8000/health
curl http://localhost:8000/basepytestSee ../README.md for the full API reference
(PayloadShieldEnc.init, PayloadShield.encrypt/decrypt/crypt, built-in
handlers, and custom handler registration). This guide only covers
day-to-day development workflows.
- Create
compyps/MyHandler.pyimplementingEncryptionHandler.encode(data, config)/.decode(encoded_data, config). - Register it in
compyps/crypto.py's_HANDLERSdict and export it fromcompyps/__init__.py. - Add a roundtrip test in
ComPyPS/tests/test_handlers.py. - FastAPIPS automatically receives the handler through
compyps.
See PUBLISHING_GUIDE.md for the full release process.
black fastapi_payloadshield examplesflake8 fastapi_payloadshield examplesmypy fastapi_payloadshield- Fork the repository
- Create a feature branch
- Make your changes
- Write tests
- Submit a pull request
# Reinstall in development mode
pip install -e . --force-reinstallpip install fastapi uvicorn# Create fresh virtual environment
python -m venv venv_fresh
venv_fresh/Scripts/activate
pip install -r requirements.txt# Check installed version
python -c "import fastapi_payloadshield; print(fastapi_payloadshield.__version__)"
# View package info
pip show fastapi_payloadshield
# Uninstall package
pip uninstall fastapi_payloadshield
# Clean build artifacts
rm -rf build/ dist/ *.egg-infoApache-2.0 - See ../LICENSE for details.