unidep.utils module#
unidep - Unified Conda and Pip requirements management.
This module provides utility functions used throughout the package.
- class unidep.utils.ParsedPackageStr(name: str, pin: str | None = None, selector: str | None = None)[source]#
Bases:
NamedTupleA package name and version pinning.
- exception unidep.utils.UnsupportedPlatformError[source]#
Bases:
ExceptionRaised when the current platform is not supported.
- unidep.utils.add_comment_to_file(filename, extra_lines=None)[source]#
Add a comment to the top of a file.
- Return type:
- unidep.utils.build_pep508_environment_marker(platforms)[source]#
Generate a PEP 508 selector for a list of platforms.
- Return type:
- unidep.utils.dependencies_filename(folder_or_path)[source]#
Get the path to requirements.yaml or pyproject.toml file.
- Return type:
- unidep.utils.identify_current_platform()[source]#
Detect the current platform.
- Return type:
Literal['linux-64','linux-aarch64','linux-ppc64le','osx-64','osx-arm64','win-64']
- unidep.utils.is_pip_installable(folder)[source]#
Determine if the project is pip installable.
Checks for existence of setup.py or [build-system] in pyproject.toml.
- Return type:
- unidep.utils.parse_package_str(package_str)[source]#
Splits a string into package name, version pinning, and platform selector.
- Return type:
- unidep.utils.remove_top_comments(filename)[source]#
Removes the top comments (lines starting with ‘#’) from a file.
- Return type: