:py:mod:`requirements` ====================== .. py:module:: conda.env.specs.requirements .. autoapi-nested-parse:: Define requirements.txt spec. Classes ------- .. autoapisummary:: conda.env.specs.requirements.RequirementsSpec .. py:class:: RequirementsSpec(filename: str | None = None, name: str | None = None, **kwargs) Bases: :py:obj:`conda.plugins.types.EnvironmentSpecBase` Reads dependencies from requirements files (including explicit files) and returns an Environment object from it. Initialize the requirements specification. :param filename: Path to the requirements file :param name: (Deprecated) Name of the environment :param kwargs: Additional arguments .. py:property:: name .. py:property:: environment :type: conda.env.env.EnvironmentYaml Build an environment from the requirements file. This method reads the file as a generator and passes it directly to EnvironmentYaml. :return: An Environment object containing the package specifications :raises ValueError: If the file cannot be read .. py:property:: env :type: conda.models.environment.Environment Build an environment from the requirements file. :return: An Environment object containing the package specifications :raises ValueError: If the file cannot be read .. py:attribute:: msg :type: str | None .. py:attribute:: extensions :type: ClassVar[set[str]] .. py:method:: _valid_file() -> bool Check if the file exists. :return: True if the file exists, False otherwise .. py:method:: _valid_name() -> bool Check if the name is valid. :return: True if the name is valid, False otherwise .. py:method:: can_handle() -> bool Validates that this spec can process the environment definition. This checks if: * a filename was provided * the file has a supported extension :return: True if the file can be handled, False otherwise