requirements#
Define requirements.txt spec.
Classes#
Reads dependencies from requirements files (including explicit files) |
- class RequirementsSpec(filename: str | None = None, **kwargs)#
Bases:
conda.plugins.types.EnvironmentSpecBaseReads dependencies from requirements files (including explicit files) and returns an Environment object from it.
Initialize the requirements specification.
- Parameters:
filename -- Path to the requirements file
kwargs -- Additional arguments
- filename = None#
- can_handle() bool#
Validates that this spec can process the environment definition. This checks if:
a filename was provided
the file exists
the file content is valid for this specifier type
- Returns:
True if the file can be handled, False otherwise
- property env: conda.models.environment.Environment#
Build an environment from the requirements file.
- Returns:
An Environment object containing the package specifications
- Raises:
ValueError -- If the file cannot be read