Shared FastAPI/Celery scaffolding for Sweet Potato service backends.
Project description
SPAPS Server Quickstart
Reusable scaffolding for Sweet Potato service backends. This package gathers the FastAPI application factory, Celery bootstrap, Pydantic settings base classes, and other utilities that HTMA, Ingredient, and future services can share.
Installation
Use either Poetry (preferred inside this repo) or pip editable installs:
# with poetry
poetry install -C packages/python-server-quickstart
# or with pip (installs package + dev extras)
python3 -m pip install -e 'packages/python-server-quickstart[dev]'
The editable install ensures FastAPI, SQLAlchemy, Celery, and other dependencies are available when the pre-push scripts execute.
Local Development
poetry run -C packages/python-server-quickstart pytest
The shared modules are designed to be imported by individual service packages. Tests live alongside the shared code to guard the common behaviour.
Lifecycle Hooks
create_app now uses FastAPI's lifespan context to close shared resources (e.g., SPAPS auth
clients). When you need additional startup/shutdown logic, extend the lifespan in your service
by wrapping the provided app with your own context manager or closing resources within your
domain packages. Running tests with TestClient(app) will automatically exercise the shutdown
path and catch missing aclose() implementations.
Upgrading Downstream Services
Guidance for publishing new versions and upgrading consumer services lives in
docs/UPGRADING.md. Review those steps before bumping the package or
pulling a newer release into htma_server, ingredient_server, or other SPAPS services.
Migrating an Existing Service
See docs/MIGRATION_GUIDE.md for a step-by-step walkthrough of
adopting the shared package inside an existing FastAPI/Celery service. It covers settings
integration, router wiring, database session management, Celery bootstraps, and the final
cleanup checklist.
Release Workflow
- Use the GitHub Action Publish Python Server Quickstart (
.github/workflows/python-server-quickstart-release.yml) to cut releases. It reuses the genericpython-package-releaseworkflow alongsidescripts/manage_python_package_version.py. - Ensure the repository secret
PYPI_SERVER_QUICKSTART_TOKENholds the PyPI API token for this package. - For manual bumps, dispatch the workflow and choose the bump type (major/minor/patch). For automated publishes, pushing a commit that updates
packages/python-server-quickstart/pyproject.tomlwill trigger the workflow.
Status
- Initial package scaffold
- Shared application factories
- Shared Celery bootstrap
- Shared middleware, logging, and settings base classes
- Health endpoint helpers
- Documentation and usage examples
Repository Integration
The root package.json includes lint:python-server-quickstart, typecheck:python-server-quickstart,
and test:python-server-quickstart commands. These run automatically via npm run prepush, so make sure
the editable install step above has been executed before pushing commits.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spaps_server_quickstart-0.0.2.tar.gz.
File metadata
- Download URL: spaps_server_quickstart-0.0.2.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3b9c7aa00769b77630bf241e8253a4bce7eccfc3b19f1916e827817d289dd3f
|
|
| MD5 |
06f4d6ebfa61af5780768cd548da0fa3
|
|
| BLAKE2b-256 |
3f99c59aef3a9bff67c83a009fc5c48661236a41d318b293d686a3f2e98bf469
|
File details
Details for the file spaps_server_quickstart-0.0.2-py3-none-any.whl.
File metadata
- Download URL: spaps_server_quickstart-0.0.2-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31f8904d65e24edc7a0fb5dbd1f333ea083d1bdc8e8d506b428d7e2f5f09797d
|
|
| MD5 |
c3a932c681d06214d01934f428388af4
|
|
| BLAKE2b-256 |
d8222c7155b679eb83adfd802f88d7a980775213bfb4e64ed5614b0a134c0c5c
|