cursus.core.utils.hybrid_path_resolution¶
Hybrid Path Resolution System for Cursus.
This module implements the hybrid strategy deployment path resolution system that works across Lambda/MODS bundled, development monorepo, and pip-installed separated deployment scenarios.
The hybrid approach uses two complementary strategies: 1. Package Location Discovery (Primary) - Uses Path(__file__) from cursus package 2. Working Directory Discovery (Fallback) - Uses Path.cwd() for traversal
- class HybridResolutionMetrics[source]¶
Bases:
objectTrack hybrid resolution performance metrics.
- class HybridResolutionConfig[source]¶
Bases:
objectConfiguration for hybrid resolution rollout.
- resolve_anchor(anchor)[source]¶
Normalize a file-or-directory anchor into a project-root path string.
This is the single shared normalizer used by every entry point (the DAG compiler, ExecutionDocumentGenerator, DAGConfigFactory, the scaffold, …) so
anchor_file=__file__andproject_root=<dir>collapse to the same project root and resolve identically everywhere.A file (e.g.
__file__of the module defininggenerate_pipeline()) resolves to its parent directory — the project folder.A directory (e.g.
Path(__file__).parent) resolves to itself.A path that does not exist yet but is “file-shaped” (has a suffix) is treated as a file and reduced to its parent, so
anchor_file=__file__works even before the module is materialized on disk.
- set_project_root(project_root)[source]¶
Push the project folder for caller-hook (Strategy 0) path resolution.
Accepts either a project directory (
Path(__file__).parent) or a file (__file__) — both are normalized to the project root viaresolve_anchor(), so callers may push whichever they have on hand.
- class HybridPathResolver[source]¶
Bases:
objectHybrid path resolver that works across all deployment scenarios.
This class implements the core hybrid resolution algorithm that uses Package Location Discovery first, then Working Directory Discovery as fallback.
- resolve_path(project_root_folder, relative_path)[source]¶
Hybrid path resolution: Package location first, then working directory discovery.
This method implements the core hybrid resolution algorithm that works across all deployment scenarios: - Lambda/MODS bundled: Package location discovery - Development monorepo: Monorepo structure detection - Pip-installed separated: Working directory discovery fallback