Skip to content

Pyproject

If you are working with a project using a pyproject.toml file, you can add configuration options for whl2conda in the [tool.whl2conda] section of the file rather than using command line options.

The easiest way to start with these options, is to generate default options with comments using:

$ whl2conda config --generate-pyproject my-project-dir/

This is safe to use on an existing pyproject file and will not overwrite any existing options.

In general, whl2conda command line options will override options specified in the pyproject.toml file.

The available options are described below.

pyproject.toml options

conda-name

Overrides name of conda package generated by whl2conda. If empty, default is taken from project.name (or tool.poetry.name if build backend is poetry).

This is overridden by the --name convert option.

wheel-dir

The default directory for whl2conda to look for wheels. Specified relative to the project root. If not specified, defaults to 'dist'.

Overridden by the --wheel-dir convert option.

out-dir

The default directory for writing conda packages. If not specified, this will be the wheel directory.

Overridden by the --out-dir convert option.

conda-format

The default output conda package format. Valid values are:

  • "V1" / ".tar.bz2": original .tar.bz2 package format
  • "V2" / ".conda": new V2 .conda package format
  • "TREE": output package as directory tree (for debugging)

Overridden by the --format convert option.

dependency-rename

An optional list of pypi/conda rename patterns. Each entry should be a two element list of the form:

   ["<pypi-name-pattern>", "<conda-name>"]',

Where <pypi-name-pattern> may either just be the pypi package name or is a Python regular expression that will match the full name, and where <conda-name> can contain substitution expressions. For example, to rename all acme-<foo> packages to acme.<foo>:

   ["acme-(.*)", "acme.$1"]

extra-dependencies

An optional list of extra conda dependencies.

tests

An optional list of package tests, using the v1 recipe tests schema used by rattler-build, so a test list can be copied verbatim between this section and a recipe.yaml file. For example:

[[tool.whl2conda.tests]]
python = { imports = ["widget"], pip_check = true }

[[tool.whl2conda.tests]]
script = ["pytest test"]
requirements = { run = ["pytest >=7"] }
files = { source = ["test", "conftest.py"] }

The supported test elements are python tests (imports and pip_check) and script tests (commands with optional requirements.run dependencies and files.source files, which are resolved relative to the project directory). Unlike rattler-build, all test elements are run in a single shared test environment.

These tests are run by the whl2conda test command against a generated conda package.

test-python

An optional list of python versions (e.g. ["3.10", "3.14"]) against which the package tests are run, once per version. If empty, a single test environment is created letting the solver choose the python version.