Skip to content

Commands

Env-spec management CLI.

======================================================================================================================== Name: pymodeller/env/cli.py Description: CLI entry-point for env-spec operations: example, check, diff, codegen, drift. Uses Typer for CLI parsing and a Service-based approach for logic.

Functions:

Name Description
banner_full

Create a banner.

check

Validate current .env file against the specification.

codegen

Generate typed Pydantic models for the environment.

drift

Check drift between YAML spec and generated code.

example

Generate a template .env.example from the YAML spec.

generate_env

Generate .env and env. files from the YAML spec.

print_diff

Show the results.

setup

Generate models from yaml and .env.example.

show_master_diff

Show diff.

show_version

Show version.

sync

Check if generated models are in sync with the YAML spec.

yaml_file

Generate environments.yaml from the YAML spec.

banner_full

banner_full(message: str, color: str = 'green') -> None

Create a banner.

check

check(
    spec: Path = pymodeller_models, env: Path = env
) -> Exit

Validate current .env file against the specification.

codegen

codegen(
    spec: Path = pymodeller_models,
    pydantic_out: Path = pydantic_folder,
    peewee_out: Path = peewee_folder,
    pydantic_master: Path | None = pydantic_out,
    peewee_master: Path = peewee_out,
) -> Exit

Generate typed Pydantic models for the environment.

drift

drift(
    spec: Path = spec,
    data_model: Path | None = pydantic_out,
) -> Exit

Check drift between YAML spec and generated code.

example

example(
    spec: Path = spec,
    out: Path = env_example,
    secrets_only: bool = False,
) -> Exit

Generate a template .env.example from the YAML spec.

generate_env

generate_env(
    env_name: str, spec_path: Path = environment_file
) -> Exit

Generate .env and env. files from the YAML spec.

print_diff

print_diff(name: str, diff: dict) -> None

Show the results.

setup

setup() -> Exit

Generate models from yaml and .env.example.

show_master_diff

show_master_diff(master_diff: dict) -> None

Show diff.

show_version

show_version(value: bool) -> Exit | None

Show version.

sync

sync(spec: Path = spec) -> Exit

Check if generated models are in sync with the YAML spec.

yaml_file

yaml_file(
    spec: Path = pymodeller_models,
    out: Path = environment_file,
) -> Exit

Generate environments.yaml from the YAML spec.