fastfoundry-settings
Pydantic-settings building blocks for the fastfoundry ecosystem — opinionated, typed defaults so every FastAPI service configures settings the same way.
Part of the fastfoundry.* namespace (fastfoundry-postgres, fastfoundry-redis, …).
Install
pip install fastfoundry-settings
Requires Python 3.12+. boto3 (for the AWS Secrets Manager source) ships as a dependency.
Usage
from fastfoundry.settings import BaseAppSettings
class Settings(BaseAppSettings):
project: str = "billing"
debug: bool = False
settings = Settings()
Set values through FF_-prefixed environment variables (or a .env / .env.local file) —
e.g. FF_DEBUG=true.
BaseAppSettings ships these model_config defaults (override model_config to change any):
| Setting | Value | Effect |
|---|---|---|
env_prefix |
FF_ |
env vars are read under the FF_ prefix (override per app) |
env_file |
(".env", ".env.local") |
loads local env files if present (.env.local overrides) |
env_nested_delimiter |
__ |
FF_DB__HOST populates settings.db.host |
case_sensitive |
False |
FF_DEBUG and ff_debug both match |
extra |
allow |
unknown env vars are kept rather than raising |
It also declares the fields that drive AWS Secrets Manager (below): use_aws_secrets,
region, and project.
Escaped secrets
EscapedSecretStr is a SecretStr | None that restores literal \n/\t to real characters
before wrapping — handy for a PEM or JWT key supplied on a single line. "" and None
become None.
from fastfoundry.settings import BaseAppSettings, EscapedSecretStr
class Settings(BaseAppSettings):
jwt_private_key: EscapedSecretStr = None
AWS Secrets Manager
Built on pydantic-settings' own AWSSecretsManagerSettingsSource (boto3 ships with the
package, so it works out of the box):
from fastfoundry.settings import BaseAppSettings
class Settings(BaseAppSettings):
project: str = "myservice"
region: str | None = "eu-central-1" # optional; defaults to boto3's resolution
database_dsn: str | None = None
api_key: str | None = None
# FF_USE_AWS_SECRETS=true -> loads the secret named "myservice"
settings = Settings()
- The source is added only when
use_aws_secretsresolves truthy (setFF_USE_AWS_SECRETS=true, or pass it to the constructor). - The secret id comes from
aws_secret_id(cls, resolved) -> str—projectby default. Override it for a richer scheme (e.g. an environment-prefixed"{env}/{project}"). TheSecretStringis a JSON object whose keys have theFF_prefix stripped and match fields case-insensitively. - It sits just below init args and above the environment — a secret overrides an env var,
while an explicit constructor argument still wins. Precedence (highest first): init, AWS,
environment,
.env, file secrets. - Secret values equal to
"REPLACE_ME"or""are dropped, so a Terraform-seeded placeholder falls through to a lower source instead of impersonating a real value.
Settings singleton
Build one settings object at start-up and read it anywhere. set_cfg takes the settings
class and builds it (forwarding **kwargs); services wrap base_cfg in a typed accessor:
from typing import cast
from fastfoundry.settings import BaseAppSettings, base_cfg, set_cfg
class Settings(BaseAppSettings):
project: str = "myservice"
debug: bool = False
def cfg() -> Settings:
return cast("Settings", base_cfg())
def main() -> None:
set_cfg(Settings) # build + register once, at start-up
if cfg().debug: # read the typed singleton anywhere
...
set_cfg(Settings, **kwargs)— build the class (with optional init overrides) and register it as the process-wide singleton; a later call replaces it.base_cfg()— return the registered instance (raisesRuntimeErrorifset_cfghas not run).
Not thread-safe; register during single-threaded start-up.
Development
mise run install # uv sync --dev
mise run lint # ruff check
mise run typecheck # mypy --strict
mise run test # pytest
mise run build # uv build (sdist + wheel)
Versions are derived from git tags (hatch-vcs) and released automatically by
semantic-release on main; nothing is hand-written into pyproject.toml.
License
MIT
Metadata
Release files for fastfoundry-settings 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastfoundry_settings-2.0.0.tar.gz | 8.1 kB | With provenance | Details for fastfoundry_settings-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastfoundry_settings-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for fastfoundry_settings-2.0.0-py3-none-any.whl |
Total release size: 14.7 kB
Release files / fastfoundry_settings-2.0.0.tar.gz
| Download URL | fastfoundry_settings-2.0.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe1a8df1d78d2816bbb21b0b93aad294fdfe58d5f0249dc36718c5a03b2e8244
|
|
BLAKE2b-256 checksum How to use checksums |
b49841f824284bc4f52c286e2f4caca386a6016ed9c0e94f4bc45675fa5cc211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.
Transparency logRelease files / fastfoundry_settings-2.0.0-py3-none-any.whl
| Download URL | fastfoundry_settings-2.0.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80bfbf00adc0549eb157987d2416036bbbc58eb1557a90f3145d0a0b50953757
|
|
BLAKE2b-256 checksum How to use checksums |
3a0911968d3754c7a3e6c5644551a31f3c163211f26cf4b1591843801ca5e483
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.
Transparency logSecurity for fastfoundry-settings 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for fastfoundry_settings-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.