A batteries-included Python script boilerplate for quickly spinning up new projects.
- Environment management -- layered
.env/.env.localloading viapython-dotenv+pydantic-settings - HTTP client -- unified sync/async wrapper around
httpx(lib/httpx_client.py) - Typed settings -- validated config with sensible defaults (
config/settings.py) - Data directories --
data/input/anddata/output/ready for file I/O scripts
.
βββ main.py # Entry point
βββ config/
β βββ settings.py # Pydantic-based settings (reads from .env)
βββ lib/
β βββ dot_env_loader.py # Layered .env loader
β βββ httpx_client.py # Sync/async HTTP client wrapper
βββ utils/ # Utility functions
β βββ http.py # HTTP utility functions
βββ scripts/ # Standalone helper scripts
βββ data/
β βββ input/ # Raw / source data
β βββ output/ # Generated / processed data
βββ _docs/ # Internal documentation
βββ .env.example # Template for environment variables
βββ pyproject.toml # Project metadata & dependencies (uv)
# 1. Clone / use as template
gh repo create my-script --template code4mk/python-script-template
cd my-script
# 2. Install dependencies (requires uv)
uv sync
# 3. Set up environment variables
cp .env.example .env
# edit .env with your values
# 4. Run
uv run python main.pyEnvironment variables are loaded in order:
.env-- base config.env.local-- local overrides (gitignored)
Define your own settings in config/settings.py and access them anywhere:
from config.settings import settings
print(settings.db_host)See _docs/ for detailed documentation on included utilities.
MIT