create-awesome-python-app 0.3.3-1
“Composable scaffolding CLI for production-ready Python apps”
Archive ships a root-level test treeBegins cache-key equality assertion
SHA-256cc656c245b5c01c75fbe001d4689190a573c3c5aeac107eed98a40b7e5dfbe23
MaleculeH₂(Cm₂Os)Md(Pa)
Evidence
1"""Template catalog fetch and listing."""
2
3from __future__ import annotations
4
5import json
6import os
7import time
8import urllib.error
9import urllib.request
10from dataclasses import dataclass
11from pathlib import Path
12from typing import Any
13
14from create_python_app_core.paths import default_cache_dir, resolve_source
15from rich.console import Console
16
17from create_awesome_python_app import __version__
18from create_awesome_python_app.prompt_style import (
19 custom_template_title,
20 template_title_tokens,
21)
22
23console = Console(stderr=True)
24
25CUSTOM_TEMPLATE_SENTINEL = "__custom_template__"
⋯5 lines
260:34… plates", []):
261 if isinstance(template, dict) and template.get("url") == template_url:
262 return template
263 return None
264
265
266def build_template_choices(data: dict[str, Any]) -> list[Templat …
385:49… []).append(choice)
386 return grouped
387
388
389DEFAULT_CATALOG_URL = "https://raw.githubusercontent.com/Create-Python-App/cpa-templates/main/templates.json"
390CACHE_TTL_SECONDS = 3600
391FETCH_TIMEOUT_SECONDS = 10
392USER_AGENT = f"create-awesome-python-app/{__version__} (https://github.com/Create-Python-App/create-python-app)"
393
394_AUTO_FIXTURE_DIR = Path(__file__).resolve().parents[4]
395_SENTINEL = object()
396_fixture_root_override: Path | None | object = _SENTINEL
397
398_memory_cache: dict[str, Any] | None = None
399_memory_ts: float = 0.0
400
401
402def catalog_url() -> str:
403 return os.environ.get("CPA_CATALOG_URL", DEFAULT_CATALOG_URL)
404
405
406def catalog_cache_path() -> Path:
407 return default_cache_dir() / "catalog" / "templ …
428:11… able / site-packages layouts vary; walk up from this file.
429 for parent in Path(__file__).resolve().parents:
430 if _has_fixture_catalog(parent):
431 return parent
432
433 cwd = Path.cwd()
434 if _has_fixture_catalog(cwd):
435 return cwd
⋯4 lines
455
456
457def _read_json_file(path: Path) -> dict[str, Any]:
458 return json.loads(path.read_text(encoding="utf-8"))
459
460
461def _read_fixture() -> dict[str, Any]:
462 path = fixture_catalog_path()
463 if path is not …
No evidence locations were recorded for this file. Raw result