Modules#
An overview of the packages that make up pun.
The API reference below is generated automatically from the source docstrings.
Core (pun.core)#
Always-included infrastructure.
Configurations for the project.
- pydantic settings pun.core.config.Settings[source]#
Bases:
BaseSettingsApplication settings using pydantic-settings.
Settings can be configured via environment variables or .env file. All settings are prefixed with the project name.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Config:
extra: str = ignore
env_prefix: str = PUN_
env_file: str = .env
env_file_encoding: str = utf-8
- Fields:
- field config_dir: Path = PosixPath('/home/runner/.pun')#
Configuration directory
- pun.core.config.get_settings()[source]#
Return the cached settings singleton.
Cached so all callers share one instance; tests can reset or override it via
get_settings.cache_clear()instead of patching an import-time value.- Returns:
The cached settings instance.
- Return type:
Directory configurations for the project.
- pun.core.dirs.HOME_IS_RESOLVABLE: bool = True#
Whether the user’s home directory could be resolved at import time.
When
Falsethe project has no user-owned directory to write to, so file logging is disabled incore/logging_setup.pyrather than falling back to a predictable shared location.
- pun.core.dirs.CONFIG_FILE_PATH: Path = PosixPath('/home/runner/.pun/config.json')#
Path to the config file.
Set up logging for the project.
This module configures logging for the project, ensuring that log handlers are only added once to prevent duplicate log entries if the module is imported multiple times.
Setup is resilient to a read-only or unavailable $HOME: if the log
directory cannot be created it degrades to console-only logging instead of
raising, so read-only commands (--help, version) stay usable.
- pun.core.logging_setup.get_logger()[source]#
Return the cached project logger.
- Returns:
The cached project logger.
- Return type:
Utilities (pun.utils)#
Shared helper functions.
Utilities package for the project.
CLI (pun.cli)#
Typer command-line interface exposing version and info commands.
CLI application for the project.
The pun command is the single Typer root. Every enabled
component other than the primary (CLI > GUI > TUI > web > MCP > worker) is hung
off it as a lazily-imported subcommand — pun interactive
(TUI), pun web, pun mcp, … — rather
than a separate pun-<name> console script (see https://hasansezertasan.github.io/copier-pyproject/context/components/#secondary-components-are-subcommands-of-one-console-root-not-separate-scripts).
- pun.cli.app.info()[source]#
Display information about the pun application.
- Show application information:
pun info
- Example output:
Application Version: 0.1.0 Python Version: 3.12.0 (CPython) Platform: Darwin
- Raises:
typer.Exit – If the package metadata cannot be found.
- Return type:
None
TUI (pun.tui)#
Textual terminal user interface.
TUI application for the project.
- final class pun.tui.app.InfoApp(message)[source]#
Bases:
App[None]Simple TUI application displaying project info.
Initialize the application.
- CSS: ClassVar[str] = '\n Screen {\n align: center middle;\n background: $surface;\n }\n\n #info-container {\n width: 60;\n height: auto;\n border: solid $primary;\n background: $panel;\n }\n\n Static {\n width: 100%;\n height: auto;\n padding: 1;\n }\n\n #title {\n dock: top;\n height: 3;\n border-bottom: solid $primary;\n background: $boost;\n text-align: center;\n content-align: center middle;\n }\n\n #footer {\n dock: bottom;\n height: 1;\n border-top: solid $primary;\n text-align: center;\n background: $boost;\n }\n '#
Inline CSS, useful for quick scripts. This is loaded after CSS_PATH, and therefore takes priority in the event of a specificity clash.
- exception pun.tui.app.TuiDisplayError[source]#
Bases:
RuntimeErrorRaised when the TUI cannot be displayed.
- pun.tui.app.build_info_message()[source]#
Return a short application information message for display.
- Returns:
A multi-line summary of the project name, version, and platform.
- Return type: