Package: tox-conda
tox-condais a plugin that provides integration with thecondapackage and environment manager for thetoxautomation tool. It’s like having your cake and
eating it, too!By default,toxcreates isolated environments usingvirtualenvand installs dependencies frompip.In contrast, when using thetox-condaplugintoxwill usecondato create
environments, and will install specified dependencies fromconda. This is
useful for developers who rely oncondafor environment management and
package distribution but want to take advantage of the features provided bytoxfor test automation.tox-condahas not been tested withcondaversion below 4.5.Getting Startedtox-condacan be used in one of two ways: by installing it globally and by
enabling it on a per-project basis. When the plugin is installed globally, the
default behavior oftoxwill be to usecondato create environments. To
use it on a per-project basis instead, usetox’s auto-provisioning feature
to selectively enable the plugin.To enable the use oftox-condaby default, follow theInstallationinstructions. To use the plugin selectively, do not manually install it, but
instead enable it by addingtox-condaas a provisioning requirement to a
project’stoxconfig:[tox]
requires = tox-condaMore information on auto-provisioning can be found in thetox documentation.InstallationThetox-condapackage is available onpypi. To install, simply use the
following command:$ pip install tox-condaTo install from source, first clone the project fromgithub:$ git clone https://github.com/tox-dev/tox-condaThen install it in your environment:$ cd tox-conda
$ pip install .To install indevelopment
mode:$ pip install -e .Thetox-condaplugin expects thattoxandcondaare already installed and
available in your working environment.UsageDetails ontoxusage can be found in thetox documentation.With the plugin enabled and no other changes, thetox-condaplugin will usecondato create environments and usepipto install dependencies that are
given in thetox.iniconfiguration file.tox-condaadds four additional (and optional) settings to the[testenv]section of configuration files:conda_deps, which is used to configure which dependencies are installed
fromcondainstead of frompip. All dependencies inconda_depsare
installed before all dependencies indeps. If not given, no dependencies
will be installed usingconda.conda_channels, which specifies which channel(s) should be used for
resolvingcondadependencies. If not given, only thedefaultchannel will
be used.conda_spec, which specifies aconda-spec.txtfile that lists conda
dependencies to install and will be combined withconda_deps(if given). These
dependencies can be in a general from (e.g.,numpy>=1.17.5) or an explicit
form (eg.,https://conda.anaconda.org/conda-forge/linux-64/numpy-1.17.5-py38h95a1406_0.tar.bz2),however, if the@EXPLICITheader is inconda-spec.txt,allgeneral
dependencies will be ignored, including those given inconda_deps.conda_env, which specifies aconda-env.ymlfile to create a base conda
environment for the test. Theconda-env.ymlfile is self-contained and
if the desired conda channels to use are not given, the default channels will be used.
If theconda-env.ymlspecifies a python version it must be compatible with thebasepythonset for the tox env. Aconda-env.ymlspecifyingpython>=3.8could for example be
used withbasepythonset topy38,py39orpy310.
The aboveconda_deps,conda_channels, andconda_specarguments, if used in
conjunction with aconda-env.ymlfile, will be used toupdatethe environmentafterthe
initial environment creation.conda_create_args, which is used to pass arguments to the commandconda create.
The passed arguments are inserted in the command line before the python package.
For instance, passing--override-channelswill create more reproducible environments
because the channels defined in the user’s.condarcwill not interfer.conda_install_args, which is used to pass arguments to the commandconda install.
The passed arguments are inserted in the command line before the dependencies.
For instance, passing--override-channelswill create more reproducible environments
because the channels defined in the user’s.condarcwill not interfer.Ifmambais installed in the same environment as tox,
you may use it instead of thecondaexecutable by setting the environment variableCONDA_EXE=mambain the shell wheretoxis called.An example configuration file is given below:[tox]
envlist =
    {py35,py36,py37}-{stable,dev}

[testenv]
deps=
    pytest-sugar
    py35,py36: importlib_resources
    dev: git+git://github.com/numpy/numpy
conda_deps=
    pytest<=3.8
    stable: numpy=1.15
conda_channels=
    conda-forge
conda_install_args=
    --override-channels
commands=
    pytest {posargs}More information ontoxconfiguration files can be found in thedocumentation.ContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theMITlicense, “tox-conda” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.