`tox` warning when running default configuration
alexcoca opened this issue ยท 6 comments
Hello,
I am testing this as a potential way to structure a project I'm working on. First of all - awesome job.
I've set up my repository and made a few changes to the environment files and so on and I tested to see that tox
works with some dummy test file and dummy test function before adding my code to the repository. When I run the command tox
, the test passes but I get the following warning:
The way I understand this is that the extras field under [testenv]
basically means that tox
executes pip install[testing]
since extras
is bound to testing
and there is an entry in the setup.cfg
to install the dependencies. Hence, I don't understand exactly what tox
complains about? Should I go and explicitly add deps to [testenv]
?
Many thanks for great work, it's a massive help!
Relevant testenv config.
[testenv]
description = invoke pytest to run automated tests
isolated_build = True
setenv =
TOXINIDIR = {toxinidir}
passenv =
HOME
extras =
testing
commands =
pytest {posargs}
Relevant part of setup.cfg
[options.extras_require]
# Add here additional requirements for extra features, to install with:
# `pip install sgd-utils[PDF]` like:
# PDF = ReportLab; RXP
# Add here test requirements (semicolon/line-separated)
testing =
setuptools
pytest>=6.2.3, <7.0.0
pytest-cov
Please provide any additional information below.
I created my environment using the command:
conda env create -f environment.yml
where the environment file is
name: my_package_name
channels:
- defaults
- conda-forge
- pytorch
# - fastai
dependencies:
- python>=3.8, <3.9
- pip
# BASICS
# VISUALIZATION
- matplotlib
- seaborn
# OTHER TOOLS
- pip:
- -e . # install git checkout of sgd-utils in editable mode
# add here only pip-packages that are not available in conda/conda-forge!
# or use if your preferred way of installing packages is pip in a conda env :)
and then updating with
conda env update -f dev_environment.yml
where the dev_environment.yml
file is
name: my_package_name
channels:
- defaults
- conda-forge
- pytorch
dependencies:
- pip:
# - jupyterlab
- pytest>=6.2.3, <7.0.0
- pytest-cov
- tox
- pre_commit
- nbdime
#- nbstripout
- sphinx
- recommonmark
- flake8>=3.9.1, <4.0.0
Versions and main components
- PyScaffold Version: 4.0.1
- dsproject extension: 0.6.1
- Python Version: 3.8.8
- Operating system: Windows 10 (but working in WSL 1)
- How did you install PyScaffold: pip
Hi @alexcoca, my best guess is that it has something to do with the fact that you are using the pip version of tox, pyscaffold and all the other tools instead of the conda equivalents. There are subtle differences in those packages between conda and pip, especially for packages that do some environment magic like tox. With the default environment.yml
which comes with PyScaffold dsproject extension I could not reproduce these errors. Here is what I did in detail:
conda activate test # some new and totally clean conda environment with Python 3.8
conda install -c conda-forge pyscaffoldext-dsproject
putup --dsproject test_dsproject
cd test_dsproject
conda env create -f environment.yml
conda activate test_dsproject
vim tests/test_sth.py # imported test_dsproject and wrote some dummy unit test
tox # does not show any warnings
Could you change dev_environment.yml
that it reflects the default environment.yml
in terms of tox, pytest, etc.?
Hi @FlorianWilhelm,
Apologies for the delay, was snowed under. I will do early next week and update here! Thanks so much for your support!
Hi @alexcoca, any news on this issue? Have you had time to test it out again?
Hi @FlorianWilhelm,
I have not had time but I am setting a new project as we speak and intend to have the dev requirements separately. I will follow the instructions and report back with findings!
@FlorianWilhelm, I have followed your advice and put the development dependencies under -dependencies
rather than -pip
. tox
now runs warning free ๐! Thank you so much for your help and sorry for the delay.
Your work is very valuable for machine learning research.
Thanks for reporting back. I'll close this issue now.