whey-conda

Whey extension for creating Conda packages for Python projects.

Docs

Documentation Build Status Docs Check Status

Tests

Linux Test Status Windows Test Status macOS Test Status Coverage

PyPI

PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel

Anaconda

Conda - Package Version Conda - Platform

Activity

GitHub last commit GitHub commits since tagged version Maintenance PyPI - Downloads

QA

CodeFactor Grade Flake8 Status mypy status

Other

License GitHub top language Requirements Status

Installation

python3 -m pip install whey-conda --user

Contents

Configuration

whey-conda is configured in the pyproject.toml file defined in PEP 517 and PEP 518.

See also

The whey documentation contains instructions for configuring whey itself.

To enable whey-conda, add the following lines to your pyproject.toml file:

[tool.whey.builders]
binary = "whey_conda"

The whey-conda-specific configuration is defined in the tool.whey-conda table. conda-channels and conda-extras can instead be defined in the tool.mkrecipe table if you also use mkrecipe.

[tool.whey-conda]

All keys are optional.

conda-description

Type: String

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!"
conda-channels

Type: Array of strings

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",]
conda-extras

Type: Array of strings or the strings 'all' or 'none'.

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"

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]]

Downloading source code

The whey-conda source code is available on GitHub, and can be accessed from the following URL: https://github.com/repo-helper/whey-conda

If you have git installed, you can clone the repository with the following command:

git clone https://github.com/repo-helper/whey-conda
Cloning into 'whey-conda'...
remote: Enumerating objects: 47, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 173 (delta 16), reused 17 (delta 6), pack-reused 126
Receiving objects: 100% (173/173), 126.56 KiB | 678.00 KiB/s, done.
Resolving deltas: 100% (66/66), done.
Alternatively, the code can be downloaded in a ‘zip’ file by clicking:
Clone or download –> Download Zip
Downloading a 'zip' file of the source code.

Downloading a ‘zip’ file of the source code

Building from source

The recommended way to build whey-conda is to use tox:

tox -e build

The source and wheel distributions will be in the directory dist.

If you wish, you may also use pep517.build or another PEP 517-compatible build tool.

License

whey-conda is licensed under the MIT License

A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.

Permissions Conditions Limitations
  • Commercial use
  • Modification
  • Distribution
  • Private use
  • Liability
  • Warranty

Copyright (c) 2021 Dominic Davis-Foster

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

View the Function Index or browse the Source Code.

Browse the GitHub Repository