Public API

Whey extension for creating Conda packages for Python projects.

Classes:

CondaBuilder(project_dir, config[, …])

Builds Conda packages using metadata read from pyproject.toml.

class CondaBuilder(project_dir, config, build_dir=None, out_dir=None, *, verbose=False, colour=None)[source]

Bases: WheelBuilder

Builds Conda packages using metadata read from pyproject.toml.

Parameters
  • project_dir (PathPlus) – The project to build the distribution for.

  • build_dir (Union[str, Path, PathLike, None]) – The (temporary) build directory. Default <project_dir>/build/wheel.

  • out_dir (Union[str, Path, PathLike, None]) – The output directory. Default <project_dir>/dist.

  • verbose (bool) – Enable verbose output. Default False.

Methods:

build()

Build the Conda distribution.

build_conda()

Build the Conda distribution.

create_conda_archive(wheel_contents_dir[, …])

Create the conda archive.

get_runtime_requirements()

Returns a list of the project’s runtime requirements.

write_conda_about()

Write the conda about.json file.

write_conda_index([build_number])

Write the conda index.json file.

write_license(dest_dir[, dest_filename])

Write the LICENSE file.

Attributes:

default_build_dir

Provides a default for the build_dir argument.

info_dir

The info directory in the build directory for Conda builds.

build()

Build the Conda distribution.

Return type

str

Returns

The filename of the created archive.

build_conda()[source]

Build the Conda distribution.

Return type

str

Returns

The filename of the created archive.

create_conda_archive(wheel_contents_dir, build_number=1)[source]

Create the conda archive.

Parameters
  • wheel_contents_dir (Union[str, Path, PathLike]) – The directory containing the installed contents of the wheel.

  • build_number (int) – Default 1.

Return type

str

Returns

The filename of the created archive.

property default_build_dir

Provides a default for the build_dir argument.

Return type

PathPlus

get_runtime_requirements()[source]

Returns a list of the project’s runtime requirements.

Return type

List[ComparableRequirement]

property info_dir

The info directory in the build directory for Conda builds.

Return type

PathPlus

write_conda_about()[source]

Write the conda about.json file.

write_conda_index(build_number=1)[source]

Write the conda index.json file.

Parameters

build_number (int) – Default 1.

write_license(dest_dir, dest_filename='LICENSE')[source]

Write the LICENSE file.

Parameters
  • dest_dir (PathPlus) – The directory to write the file into.

  • dest_filename (str) – The name of the file to write in dest_dir. Default 'LICENSE'.

whey_conda.config

Configuration for whey-conda.

Classes:

WheyCondaParser()

Parser for the [tool.whey-conda] table from pyproject.toml.

class WheyCondaParser[source]

Bases: AbstractConfigParser

Parser for the [tool.whey-conda] table from pyproject.toml.

Attributes:

keys

The keys to parse from the TOML file.

Methods:

parse(config[, set_defaults])

Parse the TOML configuration.

parse_conda_channels(config)

Parse the conda-channels key, giving a list of required conda channels to build and use the package.

parse_conda_description(config)

Parse the conda-description key, giving the description of the package.

parse_conda_extras(config)

Parse the conda-extras key, giving a list of extras (see optional-dependencies) to include as requirements in the Conda package.

property keys

The keys to parse from the TOML file.

Return type

List[str]

parse(config, set_defaults=False)[source]

Parse the TOML configuration.

Parameters
Return type

Dict[str, Any]

parse_conda_channels(config)[source]

Parse the conda-channels key, giving a list of required conda channels to build and use the package.

The default value is [].

Example:

[tool.whey-conda]
conda-channels = [
    "domdfcoding",
    "conda-forge",
    "bioconda",
]
Parameters

config (Dict[str, Any]) – The unparsed TOML config for the [tool.whey-conda] table.

Return type

List[str]

parse_conda_description(config)[source]

Parse the conda-description key, giving the description of the package.

You can use a single %s in the description, which will be substituted with the value of the description key from pyproject.toml.

The default value is '%s'.

Example:

[tool.whey-conda]
conda-description = "Fantastic Spam!"
Parameters

config (Dict[str, Any]) – The unparsed TOML config for the [tool.whey-conda] table.

Return type

str

parse_conda_extras(config)[source]

Parse the conda-extras key, giving a list of extras (see optional-dependencies) to include as requirements in the Conda package.

  • The special keyword 'all' indicates all extras should be included.

  • The special keyword 'none' indicates no extras should be included.

The default value is 'none'.

Examples:

[tool.whey-conda]
conda-extras = [ "test", "doc",]

[tool.whey-conda]
conda-extras = "all"
Return type

Union[Literal['all'], Literal['none'], List[str]]