Skip to main content

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 generic python-package-release workflow alongside scripts/manage_python_package_version.py.
  • Ensure the repository secret PYPI_SERVER_QUICKSTART_TOKEN holds 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.toml will 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spaps_server_quickstart-0.0.1.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spaps_server_quickstart-0.0.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file spaps_server_quickstart-0.0.1.tar.gz.

File metadata

  • Download URL: spaps_server_quickstart-0.0.1.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for spaps_server_quickstart-0.0.1.tar.gz
Algorithm Hash digest
SHA256 988b2b19ebf20718c6d9132883dcc251edaea627d650b57e595b136d8ff0d419
MD5 d85a29d41ebd054a65628071b11a992f
BLAKE2b-256 c13608748797ae428309a56558033cfe10803e25f61bb5aa9931e9f19b82b019

See more details on using hashes here.

File details

Details for the file spaps_server_quickstart-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for spaps_server_quickstart-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 83d47a851bf07dbd8f7277483a51c3488cc08bed49bd42e973284c1cd3abc2e4
MD5 548bbd9b173ab6ec32512effff219184
BLAKE2b-256 8cd66f1603dd799a02db575e2ece055c5810649744a3d83f19c1d3f6975f0c2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page