man-group / man-group/pytest-plugins

pytest-virtualenv requires setuptools to install

Open
#155 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
597
Forks
89
PR merge metrics
No merged PRs in 30d

Description

In the goal of removing implicit dependencies on setuptools out of the tool chains, I've stumbled on an issue where pytest-virtualenv, by virtue of its dependency on termcolor, requires setuptools to install (even when installing using pip). That package does not have a wheel, does not define a pyproject.toml, and thus pip falls back to the implicit 'build with setuptools'.

To replicate, build a virtualenv without setuptools and then install the package:

python -m venv env
env/bin/pip uninstall -y setuptools
env/bin/pip install --no-cache-dir pytest-virtualenv
Collecting pytest-virtualenv
  Downloading https://files.pythonhosted.org/packages/21/7f/0ec1ab9b8fcd4a3a063b97143a97d1c093d01227353b682c9027d14b14c2/pytest_virtualenv-1.7.0-py2.py3-none-any.whl
Collecting virtualenv (from pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/05/f1/2e07e8ca50e047b9cc9ad56cf4291f4e041fa73207d000a095fe478abf84/virtualenv-16.7.9-py2.py3-none-any.whl (3.4MB)
     |████████████████████████████████| 3.4MB 2.0MB/s 
Collecting pytest (from pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/e6/94/29b5a09edc970a2f24742e6186dfe497cd6c778e60e54693215a36852613/pytest-5.3.3-py3-none-any.whl (235kB)
     |████████████████████████████████| 245kB 26.2MB/s 
Collecting pytest-fixture-config (from pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/83/6e/ebc4d3d5c51cc440bdb0adcd274ff2436dc6814ed1cc2cbc6d5386aaf85c/pytest_fixture_config-1.7.0-py2.py3-none-any.whl
Collecting pytest-shutil (from pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/26/b7/ef48a8f1f81ae4cd6f22992f6ffb7e9bf030d6e6654e2e626a05aaf5e880/pytest_shutil-1.7.0-py2.py3-none-any.whl
Collecting attrs>=17.4.0 (from pytest->pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl
Collecting py>=1.5.0 (from pytest->pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/99/8d/21e1767c009211a62a8e3067280bfce76e89c9f876180308515942304d2d/py-1.8.1-py2.py3-none-any.whl (83kB)
     |████████████████████████████████| 92kB 20.7MB/s 
Collecting more-itertools>=4.0.0 (from pytest->pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/bc/e2/3206a70758a21f9878fcf9478282bb68fbc66a5564718f9ed724c3f2bb52/more_itertools-8.1.0-py3-none-any.whl (41kB)
     |████████████████████████████████| 51kB 67.3MB/s 
Collecting pluggy<1.0,>=0.12 (from pytest->pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/a0/28/85c7aa31b80d150b772fbe4a229487bc6644da9ccb7e427dd8cc60cb8a62/pluggy-0.13.1-py2.py3-none-any.whl
Collecting wcwidth (from pytest->pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/58/b4/4850a0ccc6f567cc0ebe7060d20ffd4258b8210efadc259da62dc6ed9c65/wcwidth-0.1.8-py2.py3-none-any.whl
Collecting packaging (from pytest->pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/d8/5b/3098db49a61ccc8583ffead6aedc226f08ff56dc03106b6ec54451e27a30/packaging-20.0-py2.py3-none-any.whl
Collecting execnet (from pytest-shutil->pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/d3/2e/c63af07fa471e0a02d05793c7a56a9f7d274a8489442a5dc4fb3b2b3c705/execnet-1.7.1-py2.py3-none-any.whl
Collecting contextlib2 (from pytest-shutil->pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/85/60/370352f7ef6aa96c52fb001831622f50f923c1d575427d021b8ab3311236/contextlib2-0.6.0.post1-py2.py3-none-any.whl
Collecting termcolor (from pytest-shutil->pytest-virtualenv)
  Downloading https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /Users/jaraco/code/public/pypa/setuptools/env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-install-nsnw5epl/termcolor/setup.py'"'"'; __file__='"'"'/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-install-nsnw5epl/termcolor/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-install-nsnw5epl/termcolor/
    Complete output (3 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the documented virtualenv and pip commands, then inspect pytest-shutil/setup.py and the termcolor installation path. Confirm which dependency metadata causes the setuptools requirement. Done means pytest-virtualenv installs successfully in an environment where setuptools has been removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.