Organize documentation into topic folders (Claude, Python, Zscaler, Project template)

This commit is contained in:
2026-05-25 17:37:23 +02:00
parent 295a01aaa4
commit 46c4173440
22 changed files with 1203 additions and 0 deletions
View File
+7
View File
@@ -0,0 +1,7 @@
"""Auto-generated version - DO NOT EDIT MANUALLY!
This file is automatically generated from pyproject.toml.
Serves as fallback for cases when TOML is not available.
"""
__version__ = "0.1.0"
+81
View File
@@ -0,0 +1,81 @@
"""
Generic application constants template.
Usage in your project:
1. Copy this file to src/constants.py
2. Fill in APP_NAME and APP_FULL_NAME
3. Import VERSION, APP_TITLE, DEFAULT_DEBUG where needed
Version loading priority:
1. pyproject.toml [project] version (preferred)
2. src/_version.py __version__ (generated fallback for frozen builds)
3. "0.0.0" (last resort)
Debug mode:
Controlled exclusively via .env: ENV_DEBUG=true
Accepted true-values: true, 1, yes (case-insensitive)
"""
import os
import tomllib
from pathlib import Path
from dotenv import load_dotenv
from loguru import logger
load_dotenv()
# ---------------------------------------------------------------------------
# Version
# ---------------------------------------------------------------------------
_ROOT = Path(__file__).parent.parent
_PYPROJECT = _ROOT / "pyproject.toml"
_VERSION_FILE = Path(__file__).parent / "_version.py"
def _load_version() -> str:
# 1. pyproject.toml
try:
with open(_PYPROJECT, "rb") as f:
version = tomllib.load(f)["project"]["version"]
# Write fallback for frozen/PyInstaller builds
_VERSION_FILE.write_text(
f'"""Auto-generated — do not edit manually."""\n__version__ = "{version}"\n',
encoding="utf-8",
)
return version
except (FileNotFoundError, KeyError):
pass
# 2. _version.py
try:
from src._version import __version__ # type: ignore[import]
return __version__
except ImportError:
pass
# 3. last resort
return "0.0.0"
# ---------------------------------------------------------------------------
# Debug mode
# ---------------------------------------------------------------------------
def _load_debug() -> bool:
return os.getenv("ENV_DEBUG", "false").lower() in ("true", "1", "yes")
# ---------------------------------------------------------------------------
# Public constants ← fill in APP_NAME / APP_FULL_NAME for each project
# ---------------------------------------------------------------------------
APP_NAME: str = "MyApp"
APP_FULL_NAME: str = "My Application"
_VERSION_NUMBER: str = _load_version()
DEFAULT_DEBUG: bool = _load_debug()
VERSION: str = f"v{_VERSION_NUMBER}" + ("DEV" if DEFAULT_DEBUG else "")
APP_TITLE: str = f"{APP_FULL_NAME} {VERSION}"