On this page
Path dependency detection and rewriting for PyPI packages, converting local file references in pyproject.toml to versioned constraints.
#rlsbl.dep_rewrite
#rlsbl.dep_rewrite
Path dependency detection and rewriting for PyPI packages, converting local file references in pyproject.toml to versioned constraints.
#detect_path_deps
def detect_path_deps(pyproject_path)Detect path dependencies in a pyproject.toml file.
Returns a list of dicts with keys: - name: the dependency package name - original: the full original dependency string - line_in_deps: index within the dependencies array - section: "dependencies" or "optional-dependencies.
#rewrite_pyproject_deps
def rewrite_pyproject_deps(content, rewrites)Rewrite path dependencies in pyproject.toml content to versioned constraints.
Args:
content: raw pyproject.toml content stringrewrites: dict mapping package name to version constraint string
(e.g., {"core": ">=1.2.0"})
Returns the modified content as a string with formatting preserved.
#_rewrite_dep_array
def _rewrite_dep_array(dep_array, rewrites)Rewrite path deps in a tomlkit dependency array in place.
#build_rewrite_map
def build_rewrite_map(workspace_root, projects, graph)Build a mapping of dependency names to version constraints.
For each project in the workspace that has a detectable version, adds name: ">=version" to the map. This map is intended to be passed to rewrite_pyproject_deps.
Args:
workspace_root: absolute path to the workspace rootprojects: list of project dicts (each with "name" and "path")graph: a WorkspaceGraph instance (unused currently, reserved for
future constraint refinement)
Returns a dict mapping package name to version constraint string.