Skip to main content

flasklet

A few nice things for Flask: typed flash messages, convention-based blueprint auto-discovery, route auto-importing, and helpers for rendering partials, blocks, and macros from Python.

Typed configuration

flasklet.config gives Flask apps a typed, environment-backed settings object instead of untyped app.config dict lookups.

from flasklet import config


class Settings(config.Config, prefix="BOXMINDER_"):
	base_url: str = config.from_env(default="/")
	flush_interval_seconds: int = config.from_env(default=60)


def create_app() -> Flask:
	app = Flask(__name__)
	settings = config.load(Settings)
	config.init_app(app, settings, flask_keys={"APPLICATION_ROOT": "base_url"})
	return app

A field's variable name defaults to the field name uppercased, prefixed with the class-level prefix (here BOXMINDER_BASE_URL and BOXMINDER_FLUSH_INTERVAL_SECONDS). Pass a name to from_env to override it. The prefix is inherited by subclasses. load(Settings, prefix=...) prepends a further prefix at load time.

load reads the environment when called (inside the app factory, not at import time) and converts values to the field's declared type: str, int, float, bool, Path, Optional[T], list[T], and NewType wrappers. A bool accepts only the exact strings true and false; a list is split on commas, with an empty variable meaning the empty list. A required field with a missing variable, or a value that cannot be converted, raises with the offending variable named.

Request-time access is typed through the generic read_config, passing the settings class:

config.read_config(Settings).base_url

Metadata

Release files for flasklet 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flasklet 1.2.0
File Size Uploaded
flasklet-1.2.0.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flasklet 1.2.0
File Interpreter ABI Platform
flasklet-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.3 kB

Release files / flasklet-1.2.0.tar.gz

Download URL flasklet-1.2.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3a58edbb63dc7bdf072fe742de1fda0d421e308b0f3bc891c04efee26d60a337
BLAKE2b-256 checksum
How to use checksums
6da1ca32cbb0b6a27ad1462207ed44df582b801c1f184b1b00b2c17ba7bb66da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / flasklet-1.2.0-py3-none-any.whl

Download URL flasklet-1.2.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d70ee497a68db712613cf716763ac8fa8b35463f449d7557d5ee0bceca902a7e
BLAKE2b-256 checksum
How to use checksums
2fd4f7240bcff906c62b512d0dc4dc1474dbcd7e3086e8ca0d48e6663fa28af6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

3.0.1

2 release files

3.0.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

This release

1.2.0 This release

2 release files

1.1.1

2 release files

1.0.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page