Skip to content

API Reference

Auto-generated from docstrings using mkdocstrings.

Main

python_template.main

Entry point for python-template.

main()

Run the main application.

This is the CLI entry point configured in pyproject.toml under [project.scripts].

Source code in src/python_template/main.py
def main() -> None:
    """Run the main application.

    This is the CLI entry point configured in ``pyproject.toml``
    under ``[project.scripts]``.
    """
    print("Hello from python-template!")

Config

python_template.config

Typed configuration using dataclasses.

Define your project's configuration here. Dataclasses provide type safety, default values, and easy serialization without external dependencies.

Usage

from python_template.config import Config

config = Config() config = Config(seed=42, data_dir="data/processed")

Config dataclass

Project configuration.

Source code in src/python_template/config.py
@dataclass
class Config:
    """Project configuration."""

    # Paths
    data_dir: Path | str = Path("data")
    output_dir: Path | str = Path("output")

    # Reproducibility
    seed: int = 42

    def __post_init__(self) -> None:
        self.data_dir = Path(self.data_dir)
        self.output_dir = Path(self.output_dir)