Git Product home page Git Product logo

tox-conda's Introduction

tox-conda

tox-conda is a plugin that provides integration with the conda package and environment manager for the tox automation tool. It's like having your cake and eating it, too!

By default, tox creates isolated environments using virtualenv and installs dependencies from pip.

In contrast, when using the tox-conda plugin tox will use conda to create environments, and will install specified dependencies from conda. This is useful for developers who rely on conda for environment management and package distribution but want to take advantage of the features provided by tox for test automation.

Installation

The tox-conda package is available on pypi. To install, simply use the following command:

$ pip install tox-conda

To install from source, first clone the project from github:

$ git clone https://github.com/drdavella/tox-conda

Then install it in your environment:

$ cd tox-conda
$ pip install .

To install in development mode:

$ pip install -e .

The tox-conda plugin expects that tox and conda are already installed and available in your working environment.

Usage

Details on tox usage can be found in the tox documentation.

With the plugin installed and no other changes, the tox-conda plugin will use conda to create environments and use pip to install dependencies that are given in the tox.ini configuration file.

tox-conda adds two additional (and optional) settings to the [testenv] section of configuration files:

  • conda_deps, which is used to configure which dependencies are installed from conda instead of from pip. All dependencies in conda_deps are installed before all dependencies in deps. If not given, no dependencies will be installed using conda.
  • conda_channels, which specifies which channel(s) should be used for resolving conda dependencies. If not given, only the default channel will be used.

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
commands=
    pytest {posargs}

More information on tox configuration files can be found in the documentation.

tox-conda's People

Contributors

drdavella avatar

Stargazers

Zhao Xiaohong avatar  avatar

tox-conda's Issues

deps and conda_deps

So I wanted to see if I could just pip install everything and had nothing but deps in my tox env. (I wanted to race pip vs conda installs on Travis).

But here if you don't have conda_deps it conda installs and then seems to pip install the same package list.
Is that meant to happen?

tox issue?

Not sure if tox got an update but recently our tox-conda builds output this:

...
  File "/opt/hostedtoolcache/Python/3.7.0/x64/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/opt/hostedtoolcache/Python/3.7.0/x64/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/hostedtoolcache/Python/3.7.0/x64/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/opt/hostedtoolcache/Python/3.7.0/x64/lib/python3.7/site-packages/tox_conda/plugin.py", line 100, in tox_testenv_create
    venv.session.make_emptydir(venv.path)
AttributeError: 'VirtualEnv' object has no attribute 'session'

An example of the full trackback is here: https://dev.azure.com/sunpy/sunpy/_build/results?buildId=1350&view=logs

I am not sure what to make of this error.

Make use of tox-conda optional

Currently if tox-conda is installed and conda-deps is defined, this raises an error.
To make it easier to share a tox config for conda and non-conda envs, it would be useful to either continue with the default tox process, or maybe better to have a setting to activate tox-conda on a per env basis ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.