Skip to content

conda_env ¤

Representation of conda environment.yaml files for bioimageio specifications.

Classes:

Name Description
BioimageioCondaEnv

A special CondaEnv that

CondaEnv

Represenation of the content of a conda environment.yaml file

PipDeps

Pip dependencies to include in conda dependecies

BioimageioCondaEnv pydantic-model ¤

Bases: CondaEnv

A special CondaEnv that - automatically adds bioimageio specific dependencies - sorts dependencies

Show JSON schema:
{
  "$defs": {
    "PipDeps": {
      "description": "Pip dependencies to include in conda dependecies",
      "properties": {
        "pip": {
          "items": {
            "type": "string"
          },
          "title": "Pip",
          "type": "array"
        }
      },
      "title": "PipDeps",
      "type": "object"
    }
  },
  "description": "A special `CondaEnv` that\n- automatically adds bioimageio specific dependencies\n- sorts dependencies",
  "properties": {
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Name"
    },
    "channels": {
      "items": {
        "type": "string"
      },
      "title": "Channels",
      "type": "array"
    },
    "dependencies": {
      "items": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "$ref": "#/$defs/PipDeps"
          }
        ]
      },
      "title": "Dependencies",
      "type": "array"
    }
  },
  "title": "BioimageioCondaEnv",
  "type": "object"
}

Fields:

Validators:

  • _ensure_valid_conda_env_namename
  • _normalize_bioimageio_conda_env

channels pydantic-field ¤

channels: List[str]

dependencies pydantic-field ¤

dependencies: List[Union[str, PipDeps]]

name pydantic-field ¤

name: Optional[str] = None

wo_name property ¤

wo_name

get_pip_deps ¤

get_pip_deps() -> List[str]

Get the pip dependencies of this conda env.

Source code in src/bioimageio/spec/conda_env.py
72
73
74
75
76
77
78
def get_pip_deps(self) -> List[str]:
    """Get the pip dependencies of this conda env."""
    for dep in self.dependencies:
        if isinstance(dep, PipDeps):
            return dep.pip

    return []

CondaEnv pydantic-model ¤

Bases: BaseModel

Represenation of the content of a conda environment.yaml file

Show JSON schema:
{
  "$defs": {
    "PipDeps": {
      "description": "Pip dependencies to include in conda dependecies",
      "properties": {
        "pip": {
          "items": {
            "type": "string"
          },
          "title": "Pip",
          "type": "array"
        }
      },
      "title": "PipDeps",
      "type": "object"
    }
  },
  "description": "Represenation of the content of a conda environment.yaml file",
  "properties": {
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Name"
    },
    "channels": {
      "items": {
        "type": "string"
      },
      "title": "Channels",
      "type": "array"
    },
    "dependencies": {
      "items": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "$ref": "#/$defs/PipDeps"
          }
        ]
      },
      "title": "Dependencies",
      "type": "array"
    }
  },
  "title": "CondaEnv",
  "type": "object"
}

Fields:

Validators:

  • _ensure_valid_conda_env_namename

channels pydantic-field ¤

channels: List[str]

dependencies pydantic-field ¤

dependencies: List[Union[str, PipDeps]]

name pydantic-field ¤

name: Optional[str] = None

wo_name property ¤

wo_name

get_pip_deps ¤

get_pip_deps() -> List[str]

Get the pip dependencies of this conda env.

Source code in src/bioimageio/spec/conda_env.py
72
73
74
75
76
77
78
def get_pip_deps(self) -> List[str]:
    """Get the pip dependencies of this conda env."""
    for dep in self.dependencies:
        if isinstance(dep, PipDeps):
            return dep.pip

    return []

PipDeps pydantic-model ¤

Bases: BaseModel

Pip dependencies to include in conda dependecies

Show JSON schema:
{
  "description": "Pip dependencies to include in conda dependecies",
  "properties": {
    "pip": {
      "items": {
        "type": "string"
      },
      "title": "Pip",
      "type": "array"
    }
  },
  "title": "PipDeps",
  "type": "object"
}

Fields:

  • pip (List[str])

Validators:

  • _remove_empty_and_sortpip

pip pydantic-field ¤

pip: List[str]

__gt__ ¤

__gt__(other: Any)
Source code in src/bioimageio/spec/conda_env.py
25
26
27
28
29
def __gt__(self, other: Any):
    if isinstance(other, PipDeps):
        return len(self.pip) > len(other.pip)
    else:
        return False

__lt__ ¤

__lt__(other: Any)
Source code in src/bioimageio/spec/conda_env.py
19
20
21
22
23
def __lt__(self, other: Any):
    if isinstance(other, PipDeps):
        return len(self.pip) < len(other.pip)
    else:
        return False