unidep moduleΒΆ
unidep - Unified Conda and Pip requirements management.
- unidep.create_conda_env_specification(resolved, channels, platforms, selector='sel')[source]ΒΆ
Create a conda environment specification from resolved requirements.
- Return type:
CondaEnvironmentSpec
- unidep.filter_python_dependencies(resolved)[source]ΒΆ
Filter out conda dependencies and return only pip dependencies.
Examples
>>> requirements = parse_requirements("requirements.yaml") >>> resolved = resolve_conflicts( ... requirements.requirements, requirements.platforms ... ) >>> python_deps = filter_python_dependencies(resolved)
- unidep.find_requirements_files(base_dir='.', depth=1, *, verbose=False)[source]ΒΆ
Scan a directory for requirements.yaml and pyproject.toml files.
- unidep.get_python_dependencies(filename='requirements.yaml', *, verbose=False, ignore_pins=None, overwrite_pins=None, skip_dependencies=None, platforms=None, raises_if_missing=True, include_local_dependencies=False)[source]ΒΆ
Extract Python (pip) requirements from a requirements.yaml or pyproject.toml file.
- Return type:
Dependencies
- unidep.parse_local_dependencies(*paths, check_pip_installable=True, verbose=False, raise_if_missing=True, warn_non_managed=True)[source]ΒΆ
Extract local project dependencies from a list of requirements.yaml or pyproject.toml files.
Works by loading the specified local_dependencies list.
Returns a dictionary with the: name of the project folder => list of `Path`s of local dependencies folders.
- unidep.parse_requirements(*paths, ignore_pins=None, overwrite_pins=None, skip_dependencies=None, verbose=False, extras=None)[source]ΒΆ
Parse a list of requirements.yaml or pyproject.toml files.
- Parameters:
paths (
Path) β Paths to requirements.yaml or pyproject.toml files.ignore_pins (
list[str] |None) β List of package names to ignore pins for.overwrite_pins (
list[str] |None) β List of package names with pins to overwrite.skip_dependencies (
list[str] |None) β List of package names to skip.verbose (
bool) β Whether to print verbose output.extras (
Union[list[list[str]],Literal['*'],None]) β List of lists of extras to include. The outer list corresponds to the requirements.yaml or pyproject.toml files, the inner list to the extras to include for that file. If β*β, all extras are included, if None, no extras are included.
- Return type:
ParsedRequirements
- unidep.resolve_conflicts(requirements, platforms=None, optional_dependencies=None)[source]ΒΆ
Resolve conflicts in a dictionary of requirements.
- Parameters:
requirements (
dict[str,list[Spec]]) β Dictionary mapping package names to a list of Spec objects. TypicallyParsedRequirements.requirementsis passed here, which is returned byparse_requirements.platforms (
list[Literal['linux-64','linux-aarch64','linux-ppc64le','osx-64','osx-arm64','win-64']] |None) β List of platforms to resolve conflicts for. TypicallyParsedRequirements.platformsis passed here, which is returned byparse_requirements.optional_dependencies (
dict[str,dict[str,list[Spec]]] |None) β Dictionary mapping package names to a dictionary of optional dependencies. TypicallyParsedRequirements.optional_dependenciesis passed here, which is returned byparse_requirements. If passing this argument, all optional dependencies will be added to the requirements dictionary. Pass None to ignore optional dependencies.
- Return type:
dict[str,dict[Optional[Literal['linux-64','linux-aarch64','linux-ppc64le','osx-64','osx-arm64','win-64']],dict[Literal['conda','pip'],Spec]]]- Returns:
Dictionary mapping package names to a dictionary of resolved metadata.
The resolved metadata is a dictionary mapping platforms to a dictionary
mapping sources to a single Spec object.