pz-cli 5.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pz_cli-5.0.0.dist-info/METADATA +51 -0
- pz_cli-5.0.0.dist-info/RECORD +399 -0
- pz_cli-5.0.0.dist-info/WHEEL +4 -0
- pz_cli-5.0.0.dist-info/entry_points.txt +5 -0
- pz_core/__init__.py +64 -0
- pz_core/__main__.py +7 -0
- pz_core/app.py +45 -0
- pz_core/assembly/__init__.py +17 -0
- pz_core/assembly/app_discovery.py +1240 -0
- pz_core/assembly/apps/__init__.py +25 -0
- pz_core/assembly/apps/compiler.py +824 -0
- pz_core/assembly/apps/providers.py +188 -0
- pz_core/assembly/cli/__init__.py +9 -0
- pz_core/assembly/cli/compiler.py +166 -0
- pz_core/assembly/diagnostics/__init__.py +21 -0
- pz_core/assembly/diagnostics/checks.py +257 -0
- pz_core/assembly/diagnostics/dev_sources.py +569 -0
- pz_core/assembly/events/__init__.py +5 -0
- pz_core/assembly/events/compiler.py +219 -0
- pz_core/assembly/extensions/__init__.py +5 -0
- pz_core/assembly/extensions/compiler.py +696 -0
- pz_core/assembly/infra/__init__.py +6 -0
- pz_core/assembly/infra/compiler.py +272 -0
- pz_core/assembly/lifecycle/__init__.py +5 -0
- pz_core/assembly/lifecycle/compiler.py +95 -0
- pz_core/assembly/middlewares/__init__.py +19 -0
- pz_core/assembly/middlewares/compiler.py +508 -0
- pz_core/assembly/project/__init__.py +7 -0
- pz_core/assembly/project/compiler.py +9 -0
- pz_core/assembly/project/context.py +17 -0
- pz_core/assembly/project/discovery.py +227 -0
- pz_core/assembly/resources/__init__.py +19 -0
- pz_core/assembly/resources/compiler.py +310 -0
- pz_core/assembly/resources/settings.py +129 -0
- pz_core/assembly/routes/__init__.py +7 -0
- pz_core/assembly/routes/compiler.py +400 -0
- pz_core/assembly/runtime_manifests/__init__.py +13 -0
- pz_core/assembly/runtime_manifests/compiler.py +159 -0
- pz_core/assembly/settings/__init__.py +17 -0
- pz_core/assembly/settings/compiler.py +786 -0
- pz_core/assembly/settings/host_project_overrides.py +82 -0
- pz_core/assembly/settings/host_runtime_endpoint.py +207 -0
- pz_core/authoring/__init__.py +79 -0
- pz_core/authoring/app_init_service.py +946 -0
- pz_core/authoring/app_versions.py +814 -0
- pz_core/authoring/cli.py +192 -0
- pz_core/authoring/commands.py +1810 -0
- pz_core/authoring/conflicts.py +180 -0
- pz_core/authoring/dev_bindings.py +916 -0
- pz_core/authoring/dev_git.py +1087 -0
- pz_core/authoring/dev_import.py +1061 -0
- pz_core/authoring/dev_manifest.py +522 -0
- pz_core/authoring/dev_sources.py +1638 -0
- pz_core/authoring/env_cli.py +454 -0
- pz_core/authoring/files.py +109 -0
- pz_core/authoring/ide_projection.py +1129 -0
- pz_core/authoring/naming.py +58 -0
- pz_core/authoring/official_dev_sources.py +432 -0
- pz_core/authoring/official_sources.json +156 -0
- pz_core/authoring/orchestration_service.py +558 -0
- pz_core/authoring/project_default.jsonc +53 -0
- pz_core/authoring/project_defaults.py +88 -0
- pz_core/authoring/project_metadata_service.py +199 -0
- pz_core/authoring/project_settings_checks.py +51 -0
- pz_core/authoring/project_settings_cli.py +299 -0
- pz_core/authoring/project_settings_service.py +1700 -0
- pz_core/authoring/project_state.py +399 -0
- pz_core/authoring/publish_git.py +423 -0
- pz_core/authoring/publish_lock.py +188 -0
- pz_core/authoring/publish_source.py +195 -0
- pz_core/authoring/release.py +1382 -0
- pz_core/authoring/repo_keys.py +29 -0
- pz_core/authoring/root_cli.py +28 -0
- pz_core/authoring/scaffold_service.py +325 -0
- pz_core/authoring/sync_service.py +787 -0
- pz_core/authoring/templates/app/__init__.py +1 -0
- pz_core/authoring/templates/app/api.py +25 -0
- pz_core/authoring/templates/app/apps.py +31 -0
- pz_core/authoring/templates/app/auth_package_init.py +14 -0
- pz_core/authoring/templates/app/auth_readme.py +29 -0
- pz_core/authoring/templates/app/configs_package_init.py +14 -0
- pz_core/authoring/templates/app/default_env.py +18 -0
- pz_core/authoring/templates/app/default_jsonc.py +25 -0
- pz_core/authoring/templates/app/locales_readme.py +25 -0
- pz_core/authoring/templates/app/migrations_readme.py +19 -0
- pz_core/authoring/templates/app/models.py +14 -0
- pz_core/authoring/templates/app/package_init.py +8 -0
- pz_core/authoring/templates/app/pages_base.py +161 -0
- pz_core/authoring/templates/app/pages_readme.py +25 -0
- pz_core/authoring/templates/app/public.py +31 -0
- pz_core/authoring/templates/app/pyproject.py +77 -0
- pz_core/authoring/templates/app/readme.py +74 -0
- pz_core/authoring/templates/app/settings.py +46 -0
- pz_core/authoring/templates/app/static_app_js.py +24 -0
- pz_core/authoring/templates/app/static_readme.py +31 -0
- pz_core/authoring/templates/app/template_config_page.py +23 -0
- pz_core/authoring/templates/app/template_index_html.py +28 -0
- pz_core/authoring/templates/app/templates_readme.py +32 -0
- pz_core/authoring/templates/app/urls.py +36 -0
- pz_core/authoring/templates/app/views.py +36 -0
- pz_core/authoring/templates/project/__init__.py +1 -0
- pz_core/authoring/templates/project/agents.py +51 -0
- pz_core/authoring/templates/project/apps_container_readme.py +37 -0
- pz_core/authoring/templates/project/main_py.py +59 -0
- pz_core/authoring/templates/project/project_env.py +19 -0
- pz_core/authoring/templates/project/pyproject.py +26 -0
- pz_core/authoring/templates/project/pz_env_env.py +65 -0
- pz_core/authoring/templates/project/pz_env_jsonc.py +69 -0
- pz_core/authoring/templates/project/pz_jsonc.py +12 -0
- pz_core/authoring/templates/project/readme.py +94 -0
- pz_core/authoring/templates/project/root_gitkeep.py +8 -0
- pz_core/authoring/templates/shared/__init__.py +5 -0
- pz_core/authoring/templates/shared/text.py +10 -0
- pz_core/authoring/venv_service.py +87 -0
- pz_core/authoring/workspace.py +167 -0
- pz_core/cli.py +291 -0
- pz_core/cli_options.py +74 -0
- pz_core/core/__init__.py +3 -0
- pz_core/core/errors/__init__.py +5 -0
- pz_core/core/errors/models.py +117 -0
- pz_core/core/events/__init__.py +5 -0
- pz_core/core/events/registry.py +54 -0
- pz_core/core/extensions/__init__.py +51 -0
- pz_core/core/extensions/registry.py +790 -0
- pz_core/core/health/__init__.py +6 -0
- pz_core/core/health/contracts.py +10 -0
- pz_core/core/middlewares/__init__.py +6 -0
- pz_core/core/middlewares/models.py +24 -0
- pz_core/core/routing/__init__.py +5 -0
- pz_core/core/routing/models.py +21 -0
- pz_core/core/settings_contracts.py +25 -0
- pz_core/docs/README.md +20 -0
- pz_core/docs/distribution-README.md +438 -0
- pz_core/docs/pz/345/221/275/344/273/244/346/200/273/350/247/210.md +1011 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/00-pz/346/236/266/346/236/204/346/200/273/347/272/262.md +240 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/01-/347/233/256/345/275/225/344/270/216/345/210/206/345/261/202/350/247/204/350/214/203.md +216 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/02-/345/214/205/344/270/216/345/210/206/345/217/221/350/247/204/350/214/203.md +403 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/03-App/346/234/200/345/260/217/345/255/220/345/214/205/350/247/204/350/214/203.md +571 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/04-Settings/344/270/216/351/205/215/347/275/256/350/247/204/350/214/203.md +1177 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/05-/350/265/204/346/272/220/344/270/216/350/277/220/350/241/214/347/233/256/345/275/225/350/247/204/350/214/203.md +575 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/06-/346/225/260/346/215/256/345/272/223/344/270/216/345/217/257/351/200/211/345/237/272/347/241/200/350/256/276/346/226/275/350/247/204/350/214/203.md +499 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/07-App/346/233/277/346/215/242/350/247/204/350/214/203.md +206 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/08-/345/271/263/345/217/260/347/272/247App/344/270/216/350/277/220/350/241/214/346/227/266/345/215/225/344/276/213/350/247/204/350/214/203.md +445 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/09-CLI/344/270/216Worker/345/205/245/345/217/243/350/247/204/350/214/203.md +950 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/10-/346/265/213/350/257/225/344/270/216/345/245/221/347/272/246/350/247/204/350/214/203.md +1001 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/11-/344/273/223/345/272/223/347/234/237/347/233/270/346/272/220/345/234/260/345/233/276.md +102 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/12-/346/236/204/345/273/272/344/270/216/345/217/221/345/270/203/346/243/200/346/237/245/346/270/205/345/215/225.md +171 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/13-/346/255/243/345/274/217Facade/346/200/273/350/241/250.md +402 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/14-/345/210/206/345/261/202/344/270/216/346/211/251/345/261/225/350/247/204/350/214/203.md +550 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/15-/345/255/220/345/214/205/345/274/200/345/217/221/344/275/277/347/224/250/346/211/213/345/206/214.md +1004 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/16-/346/211/251/345/261/225/347/202/271/346/255/243/345/274/217/345/215/217/350/256/256/346/270/205/345/215/225.md +352 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/17-pz.protocols.v1/346/255/243/345/274/217/345/215/217/350/256/256.md +266 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/18-/346/211/251/345/261/225/347/202/271/345/206/262/347/252/201/350/243/201/345/206/263/346/200/273/350/241/250.md +131 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/19-/351/224/231/350/257/257/347/240/201/344/270/216/350/257/212/346/226/255/345/215/217/350/256/256.md +176 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/20-/347/247/201/346/234/211/345/214/205/344/273/223/344/270/216/347/273/237/344/270/200/350/256/244/350/257/201/351/203/250/347/275/262/350/247/204/350/214/203.md +243 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/21-contrib/347/272/246/345/256/232/344/270/216Provider/346/216/245/345/205/245/350/247/204/350/214/203.md +365 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/22-/345/244/232/345/233/275/350/257/255/350/250/200/350/265/204/346/272/220/346/262/273/347/220/206/344/270/216/346/214/211/351/234/200/345/212/240/350/275/275/350/247/204/350/214/203.md +912 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/23-/351/246/226/345/261/217/345/261/225/347/244/272/344/270/216/351/246/226/345/270/247/347/250/263/345/256/232/350/247/204/350/214/203.md +269 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/24-pz/345/220/257/345/212/250/344/270/216/350/277/220/350/241/214/346/227/266/347/274/226/350/257/221/346/265/201/347/250/213.md +245 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/25-/351/235/242/345/220/221/345/257/271/350/261/241/345/274/200/345/217/221/350/247/204/350/214/203.md +300 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/README.md +98 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/00-legacy_core/346/240/207/345/207/206pip/345/214/205/345/214/226/351/207/215/346/236/204/346/200/273/347/272/262.md +1073 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/01-/347/233/256/345/275/225/344/270/216/345/210/206/345/261/202/351/207/215/346/236/204/346/211/247/350/241/214/346/226/271/346/241/210.md +224 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/02-/345/214/205/344/270/216/345/210/206/345/217/221/350/247/204/350/214/203-/345/220/253/345/216/206/345/217/262/345/217/243/345/276/204.md +671 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/13-/344/270/200/346/254/241/346/200/247/345/256/236/346/226/275/346/270/205/345/215/225.md +387 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/14-/345/255/220/345/214/205/351/200/202/351/205/215/346/224/271/351/200/240/346/270/205/345/215/225.md +592 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/15-infra/350/243/201/345/211/252/344/270/216/350/220/275/344/275/215/346/270/205/345/215/225.md +81 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/19-core/345/215/225/344/270/200/346/255/243/345/274/217/346/226/271/346/241/210/346/224/266/346/225/233/346/211/247/350/241/214/346/270/205/345/215/225.md +161 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/25-/345/215/217/350/256/256/345/210/260/346/272/220/347/240/201/345/267/256/350/267/235/346/270/205/345/215/225.md +377 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/26-cutover/345/256/214/345/267/245/346/243/200/346/237/245/346/270/205/345/215/225.md +117 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/29-/345/244/232/345/233/275/350/257/255/350/250/200/350/265/204/346/272/220/346/262/273/347/220/206/344/270/216/346/214/211/351/234/200/345/212/240/350/275/275/350/247/204/350/214/203-/345/220/253/350/277/201/347/247/273/347/255/226/347/225/245.md +956 -0
- pz_core/docs/pz/350/247/204/350/214/203/344/270/216/344/275/277/347/224/250/archive//344/270/255/351/227/264/346/200/201/99-/350/265/204/346/272/220/346/224/266/345/217/243/345/220/216/347/273/255TODO.md +84 -0
- pz_core/docs//345/217/221/347/211/210/345/211/215/346/270/205/345/215/225-4.0.11.md +84 -0
- pz_core/docs//346/226/260/346/211/213/346/214/207/345/215/227.md +422 -0
- pz_core/infra/__init__.py +17 -0
- pz_core/infra/db/__init__.py +23 -0
- pz_core/infra/db/contracts.py +73 -0
- pz_core/infra/health/__init__.py +5 -0
- pz_core/infra/health/contracts.py +8 -0
- pz_core/infra/kv/__init__.py +5 -0
- pz_core/infra/kv/contracts.py +17 -0
- pz_core/infra/observability/__init__.py +23 -0
- pz_core/infra/observability/contracts.py +142 -0
- pz_core/infra/resilience/__init__.py +5 -0
- pz_core/infra/resilience/contracts.py +17 -0
- pz_core/infra/resources/__init__.py +5 -0
- pz_core/infra/resources/contracts.py +16 -0
- pz_core/infra/settings/__init__.py +17 -0
- pz_core/infra/settings/models.py +81 -0
- pz_core/infra/storage/__init__.py +5 -0
- pz_core/infra/storage/ports.py +27 -0
- pz_core/project_root_commands.py +282 -0
- pz_core/project_runtime_cli.py +344 -0
- pz_core/project_sources.py +253 -0
- pz_core/pz_launcher.py +209 -0
- pz_core/root_cli.py +70 -0
- pz_core/runtime/__init__.py +229 -0
- pz_core/runtime/access.py +86 -0
- pz_core/runtime/adapters/__init__.py +5 -0
- pz_core/runtime/adapters/base.py +18 -0
- pz_core/runtime/asyncio_bridge.py +18 -0
- pz_core/runtime/bindings/__init__.py +5 -0
- pz_core/runtime/bindings/container.py +50 -0
- pz_core/runtime/cli/__init__.py +5 -0
- pz_core/runtime/cli/_args.py +67 -0
- pz_core/runtime/cli/app_commands.py +417 -0
- pz_core/runtime/cli/check.py +214 -0
- pz_core/runtime/cli/db.py +297 -0
- pz_core/runtime/cli/main.py +89 -0
- pz_core/runtime/cli/resources.py +280 -0
- pz_core/runtime/discovery.py +23 -0
- pz_core/runtime/environment_integrity.py +157 -0
- pz_core/runtime/errors.py +5 -0
- pz_core/runtime/events.py +87 -0
- pz_core/runtime/facades/__init__.py +38 -0
- pz_core/runtime/facades/_capabilities.py +46 -0
- pz_core/runtime/facades/cache.py +103 -0
- pz_core/runtime/facades/database.py +71 -0
- pz_core/runtime/facades/events.py +380 -0
- pz_core/runtime/facades/health.py +101 -0
- pz_core/runtime/facades/mail.py +121 -0
- pz_core/runtime/facades/observability.py +102 -0
- pz_core/runtime/facades/providers.py +75 -0
- pz_core/runtime/facades/resources.py +52 -0
- pz_core/runtime/facades/storage.py +296 -0
- pz_core/runtime/health/__init__.py +5 -0
- pz_core/runtime/health/service.py +102 -0
- pz_core/runtime/host.py +188 -0
- pz_core/runtime/host_runner.py +282 -0
- pz_core/runtime/http/__init__.py +20 -0
- pz_core/runtime/http/app.py +576 -0
- pz_core/runtime/http_timing.py +173 -0
- pz_core/runtime/invocation.py +29 -0
- pz_core/runtime/json_safe.py +47 -0
- pz_core/runtime/lifecycle/__init__.py +25 -0
- pz_core/runtime/lifecycle/manager.py +533 -0
- pz_core/runtime/plan.py +214 -0
- pz_core/runtime/plan_context.py +33 -0
- pz_core/runtime/plan_snapshot.py +177 -0
- pz_core/runtime/registries/__init__.py +27 -0
- pz_core/runtime/registries/capabilities.py +101 -0
- pz_core/runtime/registries/providers.py +396 -0
- pz_core/runtime/resource_assets.py +344 -0
- pz_core/runtime/run_cli.py +211 -0
- pz_core/runtime/settings.py +888 -0
- pz_core/runtime/worker/__init__.py +21 -0
- pz_core/runtime/worker/engine.py +921 -0
- pz_core/runtime/worker/runtime.py +25 -0
- pz_core/testing/__init__.py +15 -0
- pz_core/testing/doc_route_contracts.py +305 -0
- pz_core/utils/__init__.py +44 -0
- pz_core/utils/env.py +65 -0
- pz_core/utils/project_jsonc/__init__.py +29 -0
- pz_core/utils/project_jsonc/document.py +420 -0
- pz_core/utils/project_settings.py +99 -0
- pz_foundation/__init__.py +50 -0
- pz_foundation/_contracts.py +81 -0
- pz_foundation/_errors.py +34 -0
- pz_foundation/api.py +14 -0
- pz_foundation/apps.py +127 -0
- pz_foundation/auth/__init__.py +1 -0
- pz_foundation/cache_control.py +233 -0
- pz_foundation/cli/__init__.py +2 -0
- pz_foundation/cli/workers.py +565 -0
- pz_foundation/configs/__init__.py +0 -0
- pz_foundation/configs/default.env +15 -0
- pz_foundation/configs/default.jsonc +452 -0
- pz_foundation/db/__init__.py +94 -0
- pz_foundation/db/aerich_executor.py +664 -0
- pz_foundation/db/config.py +358 -0
- pz_foundation/db/connection_manager.py +689 -0
- pz_foundation/db/connection_probe.py +204 -0
- pz_foundation/db/database.py +1291 -0
- pz_foundation/db/deps.py +47 -0
- pz_foundation/db/lifecycle_status.py +85 -0
- pz_foundation/db/migrations.py +477 -0
- pz_foundation/db/mysql.py +57 -0
- pz_foundation/db/postgresql.py +409 -0
- pz_foundation/db/production_pool_fallback.py +143 -0
- pz_foundation/db/public.py +45 -0
- pz_foundation/db/session.py +369 -0
- pz_foundation/db/sqlite.py +15 -0
- pz_foundation/db/tortoise_manager.py +724 -0
- pz_foundation/db/tortoise_psycopg.py +148 -0
- pz_foundation/docs/README.md +18 -0
- pz_foundation/docs/distribution-README.md +319 -0
- pz_foundation/docs/infra/350/243/201/345/211/252/344/270/216/350/220/275/344/275/215/350/257/264/346/230/216.md +39 -0
- pz_foundation/docs//345/205/254/345/274/200/345/205/215/350/264/271/346/216/245/345/217/243/351/230/262/346/273/245/347/224/250/344/270/216/344/272/272/346/234/272/346/240/241/351/252/214.md +680 -0
- pz_foundation/docs//350/256/276/350/256/241/346/226/207/346/241/243.md +288 -0
- pz_foundation/docs//350/267/257/347/224/261/344/270/216URL/345/244/204/347/220/206/350/247/204/350/214/203.md +119 -0
- pz_foundation/health.py +105 -0
- pz_foundation/host/__init__.py +11 -0
- pz_foundation/host/builder.py +34 -0
- pz_foundation/host/cache_runtime.py +44 -0
- pz_foundation/host/db/__init__.py +17 -0
- pz_foundation/host/db/aerich_config.py +36 -0
- pz_foundation/host/db/config.py +106 -0
- pz_foundation/host/db/connection_manager.py +48 -0
- pz_foundation/host/db/deps.py +5 -0
- pz_foundation/host/db/orm_retry_patch.py +566 -0
- pz_foundation/host/db/request_adapter.py +325 -0
- pz_foundation/host/db/router.py +28 -0
- pz_foundation/host/db/session.py +284 -0
- pz_foundation/host/db/tortoise_manager.py +10 -0
- pz_foundation/host/idempotency.py +132 -0
- pz_foundation/host/lifespan.py +247 -0
- pz_foundation/host/redis_runtime.py +100 -0
- pz_foundation/host/web.py +790 -0
- pz_foundation/infra_provider.py +236 -0
- pz_foundation/kv/__init__.py +25 -0
- pz_foundation/kv/cache.py +1166 -0
- pz_foundation/kv/deps.py +84 -0
- pz_foundation/kv/public.py +25 -0
- pz_foundation/kv/redis_manager.py +1531 -0
- pz_foundation/lazy_exports.py +43 -0
- pz_foundation/lazy_imports.py +124 -0
- pz_foundation/lifecycle.py +392 -0
- pz_foundation/managed_workers.py +1117 -0
- pz_foundation/middlewares/__init__.py +26 -0
- pz_foundation/middlewares/_settings.py +250 -0
- pz_foundation/middlewares/analytics.py +124 -0
- pz_foundation/middlewares/cache_control.py +156 -0
- pz_foundation/middlewares/compression.py +202 -0
- pz_foundation/middlewares/cors.py +62 -0
- pz_foundation/middlewares/geo_country.py +44 -0
- pz_foundation/middlewares/inner_router.py +50 -0
- pz_foundation/middlewares/rate_limited/__init__.py +3 -0
- pz_foundation/middlewares/rate_limited/key_limiter.py +115 -0
- pz_foundation/middlewares/request_logging.py +104 -0
- pz_foundation/middlewares/route_owner.py +309 -0
- pz_foundation/middlewares/security_csrf.py +44 -0
- pz_foundation/middlewares/security_headers/__init__.py +4 -0
- pz_foundation/middlewares/security_headers/conflicts.py +44 -0
- pz_foundation/middlewares/security_headers/csp_nonce.py +200 -0
- pz_foundation/middlewares/security_headers/security_headers.py +44 -0
- pz_foundation/migrations/__init__.py +1 -0
- pz_foundation/migrations/pz_foundation/__init__.py +1 -0
- pz_foundation/models.py +22 -0
- pz_foundation/notifications/__init__.py +23 -0
- pz_foundation/notifications/email.py +542 -0
- pz_foundation/notifications/public.py +31 -0
- pz_foundation/observability/__init__.py +71 -0
- pz_foundation/observability/http.py +34 -0
- pz_foundation/observability/logger/__init__.py +49 -0
- pz_foundation/observability/logger/_bot_settings.py +126 -0
- pz_foundation/observability/logger/bot_message.py +592 -0
- pz_foundation/observability/logger/core.py +385 -0
- pz_foundation/observability/logger/delivery_audit.py +84 -0
- pz_foundation/observability/logger/feishu_bot.py +199 -0
- pz_foundation/observability/logger/telegram_bot.py +194 -0
- pz_foundation/observability/metrics.py +365 -0
- pz_foundation/observability/runtime.py +68 -0
- pz_foundation/public.py +405 -0
- pz_foundation/resources/__init__.py +12 -0
- pz_foundation/resources/builder.py +900 -0
- pz_foundation/resources/images.py +363 -0
- pz_foundation/root_cli.py +20 -0
- pz_foundation/routing/__init__.py +203 -0
- pz_foundation/routing/canonical.py +486 -0
- pz_foundation/routing/convertors.py +82 -0
- pz_foundation/routing/declarations.py +843 -0
- pz_foundation/routing/exports.py +148 -0
- pz_foundation/routing/loaders.py +138 -0
- pz_foundation/routing/manifest.py +215 -0
- pz_foundation/routing/manifest_provider.py +47 -0
- pz_foundation/routing/mounts.py +101 -0
- pz_foundation/routing/ordering.py +172 -0
- pz_foundation/routing/registry.py +133 -0
- pz_foundation/routing/utils.py +28 -0
- pz_foundation/runtime.py +234 -0
- pz_foundation/settings.py +253 -0
- pz_foundation/settings_normalization.py +130 -0
- pz_foundation/storage/__init__.py +25 -0
- pz_foundation/storage/local.py +209 -0
- pz_foundation/storage/public.py +106 -0
- pz_foundation/storage/s3.py +116 -0
- pz_foundation/storage/service.py +234 -0
- pz_foundation/urls.py +19 -0
- pz_foundation/utils/__init__.py +6 -0
- pz_foundation/utils/merge.py +160 -0
- pz_foundation/worker_replicas.py +55 -0
- pz_settings_center/__init__.py +5 -0
- pz_settings_center/api/__init__.py +5 -0
- pz_settings_center/api/runtime_overrides.py +360 -0
- pz_settings_center/apps.py +28 -0
- pz_settings_center/configs/__init__.py +0 -0
- pz_settings_center/configs/default.env +2 -0
- pz_settings_center/configs/default.jsonc +1 -0
- pz_settings_center/docs/01-settings_center/350/203/275/345/212/233/350/276/271/347/225/214.md +124 -0
- pz_settings_center/docs/README.md +12 -0
- pz_settings_center/docs/distribution-README.md +150 -0
- pz_settings_center/docs//350/256/276/350/256/241/346/226/207/346/241/243.md +48 -0
- pz_settings_center/integration_payload.py +18 -0
- pz_settings_center/project_helpers.py +405 -0
- pz_settings_center/public.py +139 -0
- pz_settings_center/routing_helpers.py +73 -0
- pz_settings_center/runtime_override_provider.py +61 -0
- pz_settings_center/typed_settings.py +324 -0
- pz_settings_center/urls.py +9 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
from pz_core.runtime.errors import PzError
|
|
7
|
+
|
|
8
|
+
_SLUG_RE = re.compile(r"^[a-z][a-z0-9_]*$")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def resolve_project_dir(raw: str | None) -> Path:
|
|
12
|
+
return Path(raw or ".").expanduser().resolve()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def normalize_app_slug(name: object, *, action: str) -> str:
|
|
16
|
+
if not isinstance(name, str) or not name.strip():
|
|
17
|
+
raise PzError(
|
|
18
|
+
code="PZ_SCAFFOLD_NAME_INVALID",
|
|
19
|
+
message="app name must be a non-empty string.",
|
|
20
|
+
stage="cli",
|
|
21
|
+
owner="pz_core.authoring",
|
|
22
|
+
action=action,
|
|
23
|
+
)
|
|
24
|
+
value = name.strip().replace("-", "_")
|
|
25
|
+
if not _SLUG_RE.fullmatch(value):
|
|
26
|
+
raise PzError(
|
|
27
|
+
code="PZ_SCAFFOLD_NAME_INVALID",
|
|
28
|
+
message="app name must be a lowercase snake_case identifier.",
|
|
29
|
+
stage="cli",
|
|
30
|
+
owner="pz_core.authoring",
|
|
31
|
+
action=action,
|
|
32
|
+
)
|
|
33
|
+
return value
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def build_app_id(slug: str) -> str:
|
|
37
|
+
return slug
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def derive_default_local_app_slug(project_dir: Path) -> str:
|
|
41
|
+
candidate = str(project_dir.name or "").strip()
|
|
42
|
+
candidate = re.sub(r"(.)([A-Z][a-z]+)", r"\1_\2", candidate)
|
|
43
|
+
candidate = re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", candidate)
|
|
44
|
+
slug = re.sub(r"[^a-zA-Z0-9]+", "_", candidate).lower()
|
|
45
|
+
slug = re.sub(r"_+", "_", slug).strip("_")
|
|
46
|
+
if not slug:
|
|
47
|
+
slug = "app"
|
|
48
|
+
if not slug[0].isalpha():
|
|
49
|
+
slug = f"app_{slug}"
|
|
50
|
+
return slug
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
__all__ = [
|
|
54
|
+
"build_app_id",
|
|
55
|
+
"derive_default_local_app_slug",
|
|
56
|
+
"normalize_app_slug",
|
|
57
|
+
"resolve_project_dir",
|
|
58
|
+
]
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import re
|
|
5
|
+
import subprocess
|
|
6
|
+
import tomllib
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from pathlib import Path, PurePosixPath
|
|
9
|
+
from typing import Literal
|
|
10
|
+
from urllib.parse import urlparse
|
|
11
|
+
|
|
12
|
+
from pz_core.project_sources import (
|
|
13
|
+
OfficialSourceRoot,
|
|
14
|
+
load_official_source_catalog,
|
|
15
|
+
)
|
|
16
|
+
from pz_core.runtime.errors import PzError
|
|
17
|
+
|
|
18
|
+
from .dev_manifest import DevBinding, DevManifest
|
|
19
|
+
from .project_state import load_dev_manifest, normalize_formal_app_id
|
|
20
|
+
from .repo_keys import build_repo_key
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True, slots=True)
|
|
24
|
+
class ResolvedSource:
|
|
25
|
+
locator: str
|
|
26
|
+
source_kind: Literal["git", "link"]
|
|
27
|
+
repo_key: str | None
|
|
28
|
+
clone_source: str
|
|
29
|
+
binding_kind: Literal["directory", "app"] | None
|
|
30
|
+
subpath: PurePosixPath
|
|
31
|
+
link_name: str
|
|
32
|
+
expected_app_id: str | None
|
|
33
|
+
pending_layout: bool = False
|
|
34
|
+
bootstrap: bool = False
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass(frozen=True, slots=True)
|
|
38
|
+
class _LocatorLeaf:
|
|
39
|
+
app_id: str
|
|
40
|
+
package_root: Path
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _source_unresolved(locator: object, reason: str, *, action: str) -> PzError:
|
|
44
|
+
return PzError(
|
|
45
|
+
code="PZ_DEV_SOURCE_UNRESOLVED",
|
|
46
|
+
message=f"could not resolve dev source locator {locator!r}: {reason}",
|
|
47
|
+
stage="dev",
|
|
48
|
+
owner="pz_core.authoring.official_dev_sources",
|
|
49
|
+
action=action,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _normalize_source_locator(locator: object, *, action: str) -> str:
|
|
54
|
+
if not isinstance(locator, str) or not locator.strip():
|
|
55
|
+
raise _source_unresolved(locator, "expected a non-empty string", action=action)
|
|
56
|
+
return locator.strip()
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _resolved_official_root(locator: str, root: OfficialSourceRoot) -> ResolvedSource:
|
|
60
|
+
return ResolvedSource(
|
|
61
|
+
locator=locator,
|
|
62
|
+
source_kind="git",
|
|
63
|
+
repo_key=root.repo_key,
|
|
64
|
+
clone_source=root.source,
|
|
65
|
+
binding_kind="directory",
|
|
66
|
+
subpath=PurePosixPath("."),
|
|
67
|
+
link_name=root.repo_key,
|
|
68
|
+
expected_app_id=None,
|
|
69
|
+
pending_layout=False,
|
|
70
|
+
bootstrap=root.bootstrap,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _official_root_for_identity(identity: str) -> OfficialSourceRoot | None:
|
|
75
|
+
catalog = load_official_source_catalog()
|
|
76
|
+
direct = catalog.get(identity)
|
|
77
|
+
if direct is not None:
|
|
78
|
+
return direct
|
|
79
|
+
for root in catalog.values():
|
|
80
|
+
if identity == root.source:
|
|
81
|
+
return root
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _resolve_official_locator(locator: str) -> ResolvedSource | None:
|
|
86
|
+
catalog = load_official_source_catalog()
|
|
87
|
+
root = _official_root_for_identity(locator)
|
|
88
|
+
if root is not None:
|
|
89
|
+
return _resolved_official_root(locator, root)
|
|
90
|
+
for candidate in catalog.values():
|
|
91
|
+
child = next(
|
|
92
|
+
(
|
|
93
|
+
item
|
|
94
|
+
for key, item in candidate.children.items()
|
|
95
|
+
if locator in {key, item.expected_app_id}
|
|
96
|
+
),
|
|
97
|
+
None,
|
|
98
|
+
)
|
|
99
|
+
if child is None or child.kind != "app":
|
|
100
|
+
continue
|
|
101
|
+
assert child.expected_app_id is not None
|
|
102
|
+
return ResolvedSource(
|
|
103
|
+
locator=locator,
|
|
104
|
+
source_kind="git",
|
|
105
|
+
repo_key=candidate.repo_key,
|
|
106
|
+
clone_source=candidate.source,
|
|
107
|
+
binding_kind="app",
|
|
108
|
+
subpath=child.subpath,
|
|
109
|
+
link_name=child.expected_app_id,
|
|
110
|
+
expected_app_id=child.expected_app_id,
|
|
111
|
+
pending_layout=False,
|
|
112
|
+
bootstrap=False,
|
|
113
|
+
)
|
|
114
|
+
return None
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def _resolved_manifest_repo(
|
|
118
|
+
locator: str,
|
|
119
|
+
*,
|
|
120
|
+
repo_key: str,
|
|
121
|
+
source: str,
|
|
122
|
+
) -> ResolvedSource:
|
|
123
|
+
official = _official_root_for_identity(repo_key) or _official_root_for_identity(
|
|
124
|
+
source
|
|
125
|
+
)
|
|
126
|
+
return ResolvedSource(
|
|
127
|
+
locator=locator,
|
|
128
|
+
source_kind="git",
|
|
129
|
+
repo_key=repo_key,
|
|
130
|
+
clone_source=source,
|
|
131
|
+
binding_kind="directory",
|
|
132
|
+
subpath=PurePosixPath("."),
|
|
133
|
+
link_name=repo_key,
|
|
134
|
+
expected_app_id=None,
|
|
135
|
+
pending_layout=False,
|
|
136
|
+
bootstrap=False if official is None else official.bootstrap,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _resolved_manifest_binding(
|
|
141
|
+
locator: str,
|
|
142
|
+
*,
|
|
143
|
+
binding_key: str,
|
|
144
|
+
binding: DevBinding,
|
|
145
|
+
manifest: DevManifest,
|
|
146
|
+
) -> ResolvedSource:
|
|
147
|
+
clone_source = binding.source
|
|
148
|
+
if binding.source_kind == "git":
|
|
149
|
+
assert binding.repo_key is not None
|
|
150
|
+
clone_source = manifest.repos[binding.repo_key].source
|
|
151
|
+
return ResolvedSource(
|
|
152
|
+
locator=locator,
|
|
153
|
+
source_kind=binding.source_kind,
|
|
154
|
+
repo_key=binding.repo_key,
|
|
155
|
+
clone_source=clone_source,
|
|
156
|
+
binding_kind=binding.kind,
|
|
157
|
+
subpath=binding.subpath,
|
|
158
|
+
link_name=binding.link.name,
|
|
159
|
+
expected_app_id=binding_key if binding.kind == "app" else None,
|
|
160
|
+
pending_layout=False,
|
|
161
|
+
bootstrap=False,
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def _locator_path_candidate(locator: str) -> Path | None:
|
|
166
|
+
candidate = Path(locator).expanduser()
|
|
167
|
+
try:
|
|
168
|
+
if candidate.exists():
|
|
169
|
+
return candidate.resolve()
|
|
170
|
+
except OSError:
|
|
171
|
+
return None
|
|
172
|
+
return None
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def _canonical_path_candidate(locator: str) -> Path | None:
|
|
176
|
+
candidate = Path(locator).expanduser()
|
|
177
|
+
if not (
|
|
178
|
+
candidate.is_absolute()
|
|
179
|
+
or locator.startswith((".", "~"))
|
|
180
|
+
or "/" in locator
|
|
181
|
+
or "\\" in locator
|
|
182
|
+
):
|
|
183
|
+
return None
|
|
184
|
+
try:
|
|
185
|
+
return candidate.resolve(strict=False)
|
|
186
|
+
except OSError:
|
|
187
|
+
return None
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _resolve_from_manifest(
|
|
191
|
+
locator: str,
|
|
192
|
+
*,
|
|
193
|
+
project_dir: Path,
|
|
194
|
+
) -> ResolvedSource | None:
|
|
195
|
+
manifest = load_dev_manifest(project_dir)
|
|
196
|
+
if manifest is None:
|
|
197
|
+
return None
|
|
198
|
+
binding = manifest.bindings.get(locator)
|
|
199
|
+
if binding is not None:
|
|
200
|
+
return _resolved_manifest_binding(
|
|
201
|
+
locator,
|
|
202
|
+
binding_key=locator,
|
|
203
|
+
binding=binding,
|
|
204
|
+
manifest=manifest,
|
|
205
|
+
)
|
|
206
|
+
repo = manifest.repos.get(locator)
|
|
207
|
+
if repo is not None:
|
|
208
|
+
return _resolved_manifest_repo(
|
|
209
|
+
locator,
|
|
210
|
+
repo_key=locator,
|
|
211
|
+
source=repo.source,
|
|
212
|
+
)
|
|
213
|
+
for repo_key, candidate in manifest.repos.items():
|
|
214
|
+
if locator == candidate.source:
|
|
215
|
+
return _resolved_manifest_repo(
|
|
216
|
+
locator,
|
|
217
|
+
repo_key=repo_key,
|
|
218
|
+
source=candidate.source,
|
|
219
|
+
)
|
|
220
|
+
candidate_path = _canonical_path_candidate(locator)
|
|
221
|
+
if candidate_path is not None:
|
|
222
|
+
for repo_key, candidate in manifest.repos.items():
|
|
223
|
+
checkout = (project_dir / Path(*candidate.checkout.parts)).resolve(
|
|
224
|
+
strict=False
|
|
225
|
+
)
|
|
226
|
+
if candidate_path == checkout:
|
|
227
|
+
return _resolved_manifest_repo(
|
|
228
|
+
locator,
|
|
229
|
+
repo_key=repo_key,
|
|
230
|
+
source=candidate.source,
|
|
231
|
+
)
|
|
232
|
+
for binding_key, candidate in manifest.bindings.items():
|
|
233
|
+
link = (project_dir / Path(*candidate.link.parts)).resolve(strict=False)
|
|
234
|
+
direct_source = (
|
|
235
|
+
Path(candidate.source).resolve(strict=False)
|
|
236
|
+
if candidate.source_kind == "link"
|
|
237
|
+
else None
|
|
238
|
+
)
|
|
239
|
+
if candidate_path in {link, direct_source}:
|
|
240
|
+
return _resolved_manifest_binding(
|
|
241
|
+
locator,
|
|
242
|
+
binding_key=binding_key,
|
|
243
|
+
binding=candidate,
|
|
244
|
+
manifest=manifest,
|
|
245
|
+
)
|
|
246
|
+
return None
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def _inspect_locator_leaf(package_root: Path) -> _LocatorLeaf | None:
|
|
250
|
+
pyproject_path = package_root / "pyproject.toml"
|
|
251
|
+
if not pyproject_path.is_file():
|
|
252
|
+
return None
|
|
253
|
+
try:
|
|
254
|
+
payload = tomllib.loads(pyproject_path.read_text(encoding="utf-8"))
|
|
255
|
+
except (OSError, UnicodeError, tomllib.TOMLDecodeError):
|
|
256
|
+
return None
|
|
257
|
+
project = payload.get("project")
|
|
258
|
+
if not isinstance(project, dict):
|
|
259
|
+
return None
|
|
260
|
+
distribution = project.get("name")
|
|
261
|
+
if not isinstance(distribution, str) or not distribution.strip():
|
|
262
|
+
return None
|
|
263
|
+
app_id = distribution.strip().replace("-", "_")
|
|
264
|
+
try:
|
|
265
|
+
normalized = normalize_formal_app_id(app_id, action="resolve_source_locator")
|
|
266
|
+
except PzError:
|
|
267
|
+
return None
|
|
268
|
+
if normalized != app_id or not (package_root / app_id / "apps.py").is_file():
|
|
269
|
+
return None
|
|
270
|
+
return _LocatorLeaf(app_id=app_id, package_root=package_root.resolve())
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def _discover_locator_leaves(root: Path) -> tuple[_LocatorLeaf, ...]:
|
|
274
|
+
leaves: list[_LocatorLeaf] = []
|
|
275
|
+
for current, dirnames, _filenames in os.walk(root, followlinks=False):
|
|
276
|
+
dirnames[:] = sorted(name for name in dirnames if not name.startswith("."))
|
|
277
|
+
package_root = Path(current)
|
|
278
|
+
leaf = _inspect_locator_leaf(package_root)
|
|
279
|
+
if leaf is None:
|
|
280
|
+
continue
|
|
281
|
+
leaves.append(leaf)
|
|
282
|
+
dirnames.clear()
|
|
283
|
+
leaves.sort(key=lambda item: item.package_root.as_posix())
|
|
284
|
+
return tuple(leaves)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def _locator_git_root(path: Path, *, action: str) -> Path | None:
|
|
288
|
+
if not any((candidate / ".git").exists() for candidate in (path, *path.parents)):
|
|
289
|
+
return None
|
|
290
|
+
argv = ("git", "-C", str(path), "rev-parse", "--show-toplevel")
|
|
291
|
+
try:
|
|
292
|
+
completed = subprocess.run(
|
|
293
|
+
argv,
|
|
294
|
+
check=False,
|
|
295
|
+
capture_output=True,
|
|
296
|
+
text=True,
|
|
297
|
+
)
|
|
298
|
+
except OSError as exc:
|
|
299
|
+
raise PzError(
|
|
300
|
+
code="PZ_DEV_GIT_UNAVAILABLE",
|
|
301
|
+
message="git is required to classify a local source path.",
|
|
302
|
+
stage="dev",
|
|
303
|
+
owner="pz_core.authoring.official_dev_sources",
|
|
304
|
+
action=action,
|
|
305
|
+
) from exc
|
|
306
|
+
if completed.returncode != 0:
|
|
307
|
+
return None
|
|
308
|
+
top_level = (completed.stdout or "").strip()
|
|
309
|
+
if not top_level:
|
|
310
|
+
return None
|
|
311
|
+
candidate = Path(top_level).expanduser().resolve()
|
|
312
|
+
return candidate if candidate.is_dir() else None
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def _normalized_repo_key(identity: str) -> str:
|
|
316
|
+
candidate = build_repo_key(identity).lower().replace("-", "_")
|
|
317
|
+
candidate = re.sub(r"[^a-z0-9_]+", "_", candidate).strip("_")
|
|
318
|
+
if not candidate:
|
|
319
|
+
return "repo"
|
|
320
|
+
if not candidate[0].isalpha():
|
|
321
|
+
return f"repo_{candidate}"
|
|
322
|
+
return candidate
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def _resolved_local_path(
|
|
326
|
+
locator: str,
|
|
327
|
+
path: Path,
|
|
328
|
+
*,
|
|
329
|
+
action: str,
|
|
330
|
+
) -> ResolvedSource:
|
|
331
|
+
if not path.is_dir():
|
|
332
|
+
raise _source_unresolved(
|
|
333
|
+
locator, "local source must be a directory", action=action
|
|
334
|
+
)
|
|
335
|
+
leaves = _discover_locator_leaves(path)
|
|
336
|
+
if not leaves:
|
|
337
|
+
raise _source_unresolved(
|
|
338
|
+
locator,
|
|
339
|
+
"local source contains no formal minimal app",
|
|
340
|
+
action=action,
|
|
341
|
+
)
|
|
342
|
+
git_root = _locator_git_root(path, action=action)
|
|
343
|
+
source_kind: Literal["git", "link"] = "git" if git_root is not None else "link"
|
|
344
|
+
source_root = path if git_root is None else git_root
|
|
345
|
+
repo_key = None if git_root is None else _normalized_repo_key(str(git_root))
|
|
346
|
+
if len(leaves) == 1:
|
|
347
|
+
leaf = leaves[0]
|
|
348
|
+
return ResolvedSource(
|
|
349
|
+
locator=locator,
|
|
350
|
+
source_kind=source_kind,
|
|
351
|
+
repo_key=repo_key,
|
|
352
|
+
clone_source=str(source_root),
|
|
353
|
+
binding_kind="app",
|
|
354
|
+
subpath=PurePosixPath(
|
|
355
|
+
leaf.package_root.relative_to(source_root).as_posix()
|
|
356
|
+
),
|
|
357
|
+
link_name=leaf.app_id,
|
|
358
|
+
expected_app_id=leaf.app_id,
|
|
359
|
+
pending_layout=False,
|
|
360
|
+
bootstrap=False,
|
|
361
|
+
)
|
|
362
|
+
directory_subpath = (
|
|
363
|
+
PurePosixPath(".")
|
|
364
|
+
if git_root is None or path == git_root
|
|
365
|
+
else PurePosixPath(path.relative_to(git_root).as_posix())
|
|
366
|
+
)
|
|
367
|
+
return ResolvedSource(
|
|
368
|
+
locator=locator,
|
|
369
|
+
source_kind=source_kind,
|
|
370
|
+
repo_key=repo_key,
|
|
371
|
+
clone_source=str(source_root),
|
|
372
|
+
binding_kind="directory",
|
|
373
|
+
subpath=directory_subpath,
|
|
374
|
+
link_name=_normalized_repo_key(path.name),
|
|
375
|
+
expected_app_id=None,
|
|
376
|
+
pending_layout=False,
|
|
377
|
+
bootstrap=False,
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def _is_explicit_git_url(locator: str) -> bool:
|
|
382
|
+
parsed = urlparse(locator)
|
|
383
|
+
if parsed.scheme in {"file", "git", "http", "https", "ssh"}:
|
|
384
|
+
return True
|
|
385
|
+
return bool(re.match(r"^[^\s/@]+@[^\s:]+:.+$", locator))
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
def _resolved_pending_remote(locator: str) -> ResolvedSource:
|
|
389
|
+
repo_key = _normalized_repo_key(locator)
|
|
390
|
+
return ResolvedSource(
|
|
391
|
+
locator=locator,
|
|
392
|
+
source_kind="git",
|
|
393
|
+
repo_key=repo_key,
|
|
394
|
+
clone_source=locator,
|
|
395
|
+
binding_kind=None,
|
|
396
|
+
subpath=PurePosixPath("."),
|
|
397
|
+
link_name=repo_key,
|
|
398
|
+
expected_app_id=None,
|
|
399
|
+
pending_layout=True,
|
|
400
|
+
bootstrap=False,
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def resolve_source_locator(
|
|
405
|
+
locator: object,
|
|
406
|
+
*,
|
|
407
|
+
project_dir: Path,
|
|
408
|
+
action: str = "resolve_source_locator",
|
|
409
|
+
) -> ResolvedSource:
|
|
410
|
+
normalized = _normalize_source_locator(locator, action=action)
|
|
411
|
+
existing = _resolve_from_manifest(normalized, project_dir=project_dir)
|
|
412
|
+
if existing is not None:
|
|
413
|
+
return existing
|
|
414
|
+
local_path = _locator_path_candidate(normalized)
|
|
415
|
+
if local_path is not None:
|
|
416
|
+
return _resolved_local_path(normalized, local_path, action=action)
|
|
417
|
+
if _is_explicit_git_url(normalized):
|
|
418
|
+
official = _resolve_official_locator(normalized)
|
|
419
|
+
return (
|
|
420
|
+
official if official is not None else _resolved_pending_remote(normalized)
|
|
421
|
+
)
|
|
422
|
+
official = _resolve_official_locator(normalized)
|
|
423
|
+
if official is not None:
|
|
424
|
+
return official
|
|
425
|
+
raise _source_unresolved(
|
|
426
|
+
normalized,
|
|
427
|
+
"use an existing manifest identity, local path, explicit Git URL, or official source name",
|
|
428
|
+
action=action,
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
__all__ = ["ResolvedSource", "resolve_source_locator"]
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pz": {
|
|
3
|
+
"source": "git@github.com:JiXiangTools/pyzza.git",
|
|
4
|
+
"kind": "directory",
|
|
5
|
+
"bootstrap": true,
|
|
6
|
+
"children": {
|
|
7
|
+
"pz-cli": {
|
|
8
|
+
"kind": "project",
|
|
9
|
+
"subpath": ".",
|
|
10
|
+
"expected_app_id": null
|
|
11
|
+
},
|
|
12
|
+
"pz-settings-center": {
|
|
13
|
+
"kind": "app",
|
|
14
|
+
"subpath": "pz_contrib/pz_settings_center",
|
|
15
|
+
"expected_app_id": "pz_settings_center"
|
|
16
|
+
},
|
|
17
|
+
"pz-foundation": {
|
|
18
|
+
"kind": "app",
|
|
19
|
+
"subpath": "pz_contrib/pz_foundation",
|
|
20
|
+
"expected_app_id": "pz_foundation"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"pz_apps": {
|
|
25
|
+
"source": "git@github.com:JiXiangTools/pyzza_platform.git",
|
|
26
|
+
"kind": "directory",
|
|
27
|
+
"bootstrap": false,
|
|
28
|
+
"children": {
|
|
29
|
+
"pz_account": {
|
|
30
|
+
"kind": "app",
|
|
31
|
+
"subpath": "pz_account",
|
|
32
|
+
"expected_app_id": "pz_account"
|
|
33
|
+
},
|
|
34
|
+
"pz_admin": {
|
|
35
|
+
"kind": "app",
|
|
36
|
+
"subpath": "pz_admin",
|
|
37
|
+
"expected_app_id": "pz_admin"
|
|
38
|
+
},
|
|
39
|
+
"pz_api_access": {
|
|
40
|
+
"kind": "app",
|
|
41
|
+
"subpath": "pz_api_access",
|
|
42
|
+
"expected_app_id": "pz_api_access"
|
|
43
|
+
},
|
|
44
|
+
"pz_auth": {
|
|
45
|
+
"kind": "app",
|
|
46
|
+
"subpath": "pz_auth",
|
|
47
|
+
"expected_app_id": "pz_auth"
|
|
48
|
+
},
|
|
49
|
+
"pz_packaging": {
|
|
50
|
+
"kind": "app",
|
|
51
|
+
"subpath": "pz_packaging",
|
|
52
|
+
"expected_app_id": "pz_packaging"
|
|
53
|
+
},
|
|
54
|
+
"pz_page_center": {
|
|
55
|
+
"kind": "app",
|
|
56
|
+
"subpath": "pz_page_center",
|
|
57
|
+
"expected_app_id": "pz_page_center"
|
|
58
|
+
},
|
|
59
|
+
"pz_preflight": {
|
|
60
|
+
"kind": "app",
|
|
61
|
+
"subpath": "pz_preflight",
|
|
62
|
+
"expected_app_id": "pz_preflight"
|
|
63
|
+
},
|
|
64
|
+
"pz_redirects": {
|
|
65
|
+
"kind": "app",
|
|
66
|
+
"subpath": "pz_redirects",
|
|
67
|
+
"expected_app_id": "pz_redirects"
|
|
68
|
+
},
|
|
69
|
+
"pz_risk_control": {
|
|
70
|
+
"kind": "app",
|
|
71
|
+
"subpath": "pz_risk_control",
|
|
72
|
+
"expected_app_id": "pz_risk_control"
|
|
73
|
+
},
|
|
74
|
+
"pz_seo": {
|
|
75
|
+
"kind": "app",
|
|
76
|
+
"subpath": "pz_seo",
|
|
77
|
+
"expected_app_id": "pz_seo"
|
|
78
|
+
},
|
|
79
|
+
"pz_settings_operator": {
|
|
80
|
+
"kind": "app",
|
|
81
|
+
"subpath": "pz_settings_operator",
|
|
82
|
+
"expected_app_id": "pz_settings_operator"
|
|
83
|
+
},
|
|
84
|
+
"pz_site_ui": {
|
|
85
|
+
"kind": "app",
|
|
86
|
+
"subpath": "pz_site_ui",
|
|
87
|
+
"expected_app_id": "pz_site_ui"
|
|
88
|
+
},
|
|
89
|
+
"pz_asset_service": {
|
|
90
|
+
"kind": "app",
|
|
91
|
+
"subpath": "pz_asset_service",
|
|
92
|
+
"expected_app_id": "pz_asset_service"
|
|
93
|
+
},
|
|
94
|
+
"pz_billing_and_credits": {
|
|
95
|
+
"kind": "app",
|
|
96
|
+
"subpath": "pz_billing_and_credits",
|
|
97
|
+
"expected_app_id": "pz_billing_and_credits"
|
|
98
|
+
},
|
|
99
|
+
"pz_file_service": {
|
|
100
|
+
"kind": "app",
|
|
101
|
+
"subpath": "pz_file_service",
|
|
102
|
+
"expected_app_id": "pz_file_service"
|
|
103
|
+
},
|
|
104
|
+
"pz_llms": {
|
|
105
|
+
"kind": "app",
|
|
106
|
+
"subpath": "pz_llms",
|
|
107
|
+
"expected_app_id": "pz_llms"
|
|
108
|
+
},
|
|
109
|
+
"pz_lottery": {
|
|
110
|
+
"kind": "app",
|
|
111
|
+
"subpath": "pz_lottery",
|
|
112
|
+
"expected_app_id": "pz_lottery"
|
|
113
|
+
},
|
|
114
|
+
"pz_proxies": {
|
|
115
|
+
"kind": "app",
|
|
116
|
+
"subpath": "pz_proxies",
|
|
117
|
+
"expected_app_id": "pz_proxies"
|
|
118
|
+
},
|
|
119
|
+
"pz_task_center": {
|
|
120
|
+
"kind": "app",
|
|
121
|
+
"subpath": "pz_task_center",
|
|
122
|
+
"expected_app_id": "pz_task_center"
|
|
123
|
+
},
|
|
124
|
+
"pz_blog": {
|
|
125
|
+
"kind": "app",
|
|
126
|
+
"subpath": "pz_blog",
|
|
127
|
+
"expected_app_id": "pz_blog"
|
|
128
|
+
},
|
|
129
|
+
"pz_cms": {
|
|
130
|
+
"kind": "app",
|
|
131
|
+
"subpath": "pz_cms",
|
|
132
|
+
"expected_app_id": "pz_cms"
|
|
133
|
+
},
|
|
134
|
+
"pz_pwa": {
|
|
135
|
+
"kind": "app",
|
|
136
|
+
"subpath": "pz_pwa",
|
|
137
|
+
"expected_app_id": "pz_pwa"
|
|
138
|
+
},
|
|
139
|
+
"pz_site_crawler": {
|
|
140
|
+
"kind": "app",
|
|
141
|
+
"subpath": "pz_site_crawler",
|
|
142
|
+
"expected_app_id": "pz_site_crawler"
|
|
143
|
+
},
|
|
144
|
+
"pz_site_essentials": {
|
|
145
|
+
"kind": "app",
|
|
146
|
+
"subpath": "pz_site_essentials",
|
|
147
|
+
"expected_app_id": "pz_site_essentials"
|
|
148
|
+
},
|
|
149
|
+
"pz_site_media": {
|
|
150
|
+
"kind": "app",
|
|
151
|
+
"subpath": "pz_site_media",
|
|
152
|
+
"expected_app_id": "pz_site_media"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|