Code Monkey home page Code Monkey logo

tox-pipenv's People

Contributors

almogcohen avatar asottile avatar chenl avatar chibacchie avatar gaborbernat avatar jugmac00 avatar pyup-bot avatar saxix avatar thedrow avatar tonybaloney avatar toxeus avatar uhurusurfa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tox-pipenv's Issues

Use --dev flag in install

First of all, thanks for this plugin, very handy, simplifies pipenv usage in tox a lot.

Due the existence of the dev packages in Pipfiles, I think that this plugin should use it, so the call to pipenv would be:

pipenv install --dev

In my case I use pytest for testing, is a develompent dependency, no a distribution one, so, when I run tox, the test environment fails because pytest isn't installed. Of course, I can add pytest as dependency in tox config, but using pipenv for this is more elegant solution IMHO.

What do you think?

Thanks!

Add example to readme.

Please could you provide an example tox.ini to help explain how to use this plugin? I'm struggling to get tox to use pipenv instead of pip.

Cheers

Migrate to tox-dev and v4 support

Hello, would you consider moving the project under the tox-dev umbrella? See documentation under https://tox.readthedocs.io/en/rewrite/plugins.html#adoption-of-a-plugin-under-tox-dev-github-organization

Furthermore, tox v4 is getting ready and we'd like to make sure this plugin is supported from day 1, we're collecting feature gaps for this under tox-dev/tox#1974. Would be great if you could join our development chat under https://discord.gg/tox so we can assist with this. If you do so please drop in a line in the #plugin chat with the name of the repository you maintain. Thanks!

Initial Update

Hi 👊

This is my first visit to this fine repo, but it seems you have been working hard to keep all dependencies updated so far.

Once you have closed this issue, I'll create separate pull requests for every update as soon as I find one.

That's it for now!

Happy merging! 🤖

Editable option seems to be not taken in count

Hello,
First of all, thanks for this project !

I use tox with tox-pipenv inside the virtualenv of the project to run tests. I know that it's originally designed to be used outside the virtualenv but I admint that it's easier not to exit the virtualenv each time I run tox.

Everything is working nicely besides a warning "WARNING:test command found but not installed in testenv" but I think it's related to the issue #6 (even if this warning is appearing since the first time for me).
My problem is that it seems to change the editable option of a package in the virtualenv. Before running tox I have a pip list like this :

....
flake8                   3.5.0
gibica                   0.5.0     /Users/matthieu/Documents/Informatique/python/gibica
idna                     2.7
...

And after have run tox :

...
flake8                   3.5.0
gibica                   0.5.0
idna                     2.7
...

My Pipfile looks like this :

...

[packages]
click = "*"
gibica = {editable = true, path = "."}

[dev-packages]
"flake8" = "*"
tox = "*"
tox-pipenv = "*"
pytest = "*"
pytest-cov = "*"
coverage = "*"
coveralls = "*"
mypy = "*"
bumpversion = "*"
black = "*"
Sphinx = "*"
sphinx_rtd_theme = "*"
gibica = {editable = true, path = "."}

...

So I don't know why but It seems that tox-pipenv modifies the actual virtualenv and doesn't handle the editable option properly... or maybe I miss something !

After a pipenv install --dev inside the virtualenv the package is in editable option again.

Have a good day,
Matthieu.

EDIT:

Oh and this is the content of my tox.ini configuration file :

[tox]
envlist = format, lint, type, test

[testenv]
commands =
    format: black --py36 --line-length 88 --skip-string-normalization gibica tests
    lint: flake8 gibica tests
    type: mypy gibica
    test: py.test --cov=gibica

Why is this package size so big?

Im curious why is this package size so big? :)

machtfit-oscar-1s_6MTPE ❯ pip install tox-pipenv
Collecting tox-pipenv
  Downloading tox-pipenv-1.4.0.tar.gz (18.0MB)
    100% |████████████████████████████████| 18.0MB 69kB/s

Warnings are emitted when running tox for the second time

Because of #5 I tried to run tox without this plugin first.
I get the following warnings:

WARNING:test command found but not installed in testenv
  cmd: /home/omer/.local/share/virtualenvs/myproject--RkZn49j/bin/python
  env: /home/omer/Documents/Projects/myproject/.tox/py36
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
py36 inst: /home/omer/Documents/Projects/myproject/.tox/dist/myproject-0.1.0.zip
WARNING:test command found but not installed in testenv
  cmd: /home/omer/.local/share/virtualenvs/myproject--RkZn49j/bin/pip
  env: /home/omer/Documents/Projects/myproject/.tox/py36
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
WARNING:test command found but not installed in testenv
  cmd: /home/omer/.local/share/virtualenvs/myproject--RkZn49j/bin/pip
  env: /home/omer/Documents/Projects/myproject/.tox/py36
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.

After that, pytest runs normally.

pipenv doesn't create the virtual environments in the correct place

Always ends up in some random location

actionid: py36
msg: getenv
cmdargs: ['/Users/anthonyshaw/repo/tox-pipenv/env/bin/python', '-m', 'pipenv', '--python', '/Users/anthonyshaw/repo/tox-pipenv/env/bin/python3.6']

Virtualenv already exists!
Removing existing virtualenv…
Creating a virtualenv for this project…
Using /Users/anthonyshaw/repo/tox-pipenv/env/bin/python3.6 to create virtualenv…
Already using interpreter /Users/anthonyshaw/repo/tox-pipenv/env/bin/python3.6
Using real prefix '/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/anthonyshaw/.local/share/virtualenvs/py36-aZKsJk1C/bin/python3.6
Also creating executable in /Users/anthonyshaw/.local/share/virtualenvs/py36-aZKsJk1C/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /Users/anthonyshaw/.local/share/virtualenvs/py36-aZKsJk1C
Requirements.txt found, instead of Pipfile! Converting…
Warning: Your Pipfile now contains pinned versions, if your requirements.txt did. 
We recommend updating your Pipfile to specify the "*" version, instead.

Clarify core concepts for tox-pipenv usage

Even though there is an issue #7 (Add example into readme), I feel, there are some open questions which is good to have clarified before writing any sort of documentation.

Namely:

How to install

Probably into system python or into the same virtualenv, where is tox installed.

Is pipsi tox-pipenv sufficient?

Initiate Pipfile and Pipfile.lock

Is user expected to create Pipfile and Pipfile.lock before creating and using tox.ini?

Probably yes.

Putting files under source control

Is Pipfile.lock expected to be under source control? According to pipenv doc Pipfile.lock is not recommended under source control if it is going to be used under multiple Python versions.

Role of requirements.txt file

Often, tox users use requirements.txt which is then referenced from within tox.ini file as deps.

Is this expected usage?

Caveat: if the requirements.txt file is created before first pipenv usage, it will be automatically used. It may surprise some users.

Is tox.ini deps section really in control?

It seems to me, that with tox-pipenv the Pipfile is always used for any of created virtualenvs and it includes the --dev dependencies..

This sounds contradicting "explicit is better than implicit".

I would prefer similar usage to existing -rrequirements.txt in deps section where I could explicitly require certain dependencies. Alternatively a directive such as installfrompipfile which would take any of options for pipenv install e.g. nothing (to install all except --dev), --dev to install all incl. --dev), or explicit package names (so we need a list value).

Take into account, that tox.ini is often used for multiple purposes:

  • run a test (so production and --dev section of Pipfile are good fit
  • just run, but do not test (only production section is relevant)
  • build Sphinx doc (completely different story).

Are we installing into tox managed venvs or into pipenvone?

pipenv allows installing packages into it's own virtualenv. But if there is an activated one, it installs into the activated one.

I feel, we shall install into the tox created virtualenv.

To me it seems (after quick test) that it installs into it's own pipenv virtualenv located in .venv directory. This prevents development scenario, where tox is used to create multiple virtualenvs and developer can easily switch from one to another without recreating them.

Do we really need special tox-pipenv plugin?

Sorry for this stupid question.

After elaborating the previous conceptual question I have found alternative method for coexistence of tox.ini and Pipfile.*:

Simply add into commands section the pipenv install --dev or pipenv instal jinja2 or whatever. As it runs under activated virtual environment it prints out:

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project.

Conclusions?

We are still in search of proper tox and pipenv usage as pipenv is still very fresh. I appreciate the effort put into integrating tox and pipenv as tox is really my very favourite tool. Please, read my comments as contribution to the discussion, not as disregarding your effort.

Do not use pipenv for packages specified in tox.ini

I've been trying to convert one of my Django apps to use pipenv and I'm hitting issues with tox because, as I switch to it, I lose the ability for tox to pick up the app's dependencies which were previously in setup.cfg, setup.py or requirements.txt.

I tried this plugin hoping it would help, and maybe I'm misunderstanding what problem it's trying to solves, so if I am, forgive this ticket, though there is still an unsolved problem then.

Here's a typical Django app using tox and pipenv:

  1. Dependencies for the project itself are defined in Pipfile
  2. A lockfile is distributed alongside the Pipfile
  3. tox.ini will look something like this:
[tox]
skipsdist = True
envlist = py36-django{20,master}, flake8, mypy

[testenv]
commands = pytest --showlocals {posargs}
deps =
	django20: Django>=2.0,<2.1
	djangomaster: https://github.com/django/django/archive/master.tar.gz
	pytest
	pytest-django
	coveralls

[testenv:flake8]
skip_install = True
commands = flake8
deps =
	flake8
	flake8-isort
	flake8-quotes

[testenv:mypy]
commands = mypy --ignore-missing-imports
deps =
	mypy

Now there's a fundamental conflict between tox and pipenv here. pipenv will install what's in the production lockfile. tox will attempt to install django 2.0, then django 2.1, django master, etc. tox will also install flake8 and mypy for the other environments, which will add them to the Pipfile and the lockfile. The --skip-lock argument to pipenv will prevent the lockfile from being updated at least, but they still shouldn't be added to the pipfile.

Fundamentally, all pipenv does is call pip and update the pipfile/lockfile accordingly. We want pipenv to create the environment, but not to install the packages provided by tox otherwise you will end up with modified pipfiles.

So my suggestion is something like this:

  1. Call pipenv to create the initial virtualenv (including the packages) unless skip_install = True.
  2. Afterwards, let tox use pip as it normally would to install the extra packages specified in tox deps.

Does that make sense, or am I completely off the mark?

LocalPath object has no attribute endswith

With the following tox.ini on a centos 7 machine I get an error when tox-pipenv is installed

[tox]
minversion = 1.8
envlist = py{27}-ansible{23,24}
skipsdist = true

[testenv]
passenv = *
deps =
    molecule==2.8
    ansible23: ansible==2.3
    ansible24: ansible==2.4
commands =
    molecule test
$ tox
py27-ansible23 create: /home/user1/ansible-module/.tox/py27-ansible23
Traceback (most recent call last):
  File "/home/user1/.local/bin/tox", line 11, in <module>
    sys.exit(cmdline())
  File "/home/user1/.local/lib/python2.7/site-packages/tox/session.py", line 40, in main
    retcode = Session(config).runcommand()
  File "/home/user1/.local/lib/python2.7/site-packages/tox/session.py", line 392, in runcommand
    return self.subcommand_test()
  File "/home/user1/.local/lib/python2.7/site-packages/tox/session.py", line 558, in subcommand_test
    if self.setupenv(venv):
  File "/home/user1/.local/lib/python2.7/site-packages/tox/session.py", line 457, in setupenv
    status = venv.update(action=action)
  File "/home/user1/.local/lib/python2.7/site-packages/tox/venv.py", line 169, in update
    self.hook.tox_testenv_create(action=action, venv=self)
  File "/home/user1/.local/lib/python2.7/site-packages/pluggy/__init__.py", line 617, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/user1/.local/lib/python2.7/site-packages/pluggy/__init__.py", line 222, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/user1/.local/lib/python2.7/site-packages/pluggy/__init__.py", line 216, in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
  File "/home/user1/.local/lib/python2.7/site-packages/pluggy/callers.py", line 201, in _multicall
    return outcome.get_result()
  File "/home/user1/.local/lib/python2.7/site-packages/pluggy/callers.py", line 77, in get_result
    _reraise(*ex)  # noqa
  File "/home/user1/.local/lib/python2.7/site-packages/pluggy/callers.py", line 180, in _multicall
    res = hook_impl.function(*args)
  File "/home/user1/.local/lib/python2.7/site-packages/tox_pipenv/plugin.py", line 22, in tox_testenv_create
    pipfile_path = os.path.join(venv.path, 'Pipfile')
  File "/usr/lib64/python2.7/posixpath.py", line 77, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'LocalPath' object has no attribute 'endswith'

pipenv, tox and tox-pipenv were installed by user

$ pip freeze --user
backports.shutil-get-terminal-size==1.0.0
certifi==2018.1.18
configparser==3.5.0
enum34==1.1.6
flake8==3.5.0
idna==2.6
mccabe==0.6.1
pathlib==1.0.1
pew==1.1.2
pipenv==9.0.1
pluggy==0.6.0
py==1.5.2
pycodestyle==2.3.1
pyflakes==1.6.0
shutilwhich==1.1.0
tox==2.9.1
tox-pipenv==1.2.1
virtualenv==15.1.0
virtualenv-clone==0.2.6

Tox envbindir mismatch using the tox-pipenv plugin

tox version = 3.5.3
tox-pipenv version = 1.8.0

Running tox using tox-pipenv produces the following output:

WARNING: test command found but not installed in testenv
cmd: /Users/myself/workspace/project/venv/bin/python
env: /Users/myself/workspace/project/.tox/py36
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.

Tests pass correctly, but the above warning indicates that my venv's python binary was used instead of that installed in the tox envbindir.
Digging a bit into tox code, I found the following in config.py:

def get_envbindir(self):
    """Path to directory where scripts/binaries reside."""
    if tox.INFO.IS_WIN and "jython" not in self.basepython and "pypy" not in self.basepython:
        return self.envdir.join("Scripts")
    else:
        return self.envdir.join("bin")

where envdir points to "/Users/myself/workspace/project/.tox/py36", whereas tox-pipenv creates the virtual environment in /Users/myself/workspace/project/.tox/py36/.venv

If I try to override envdir in my tox.ini to point to .tox/py36/.venv, then tox creates .tox/py36/.venv/.venv :)

Adding "python" to whitelist_externals suppresses the warning, but I wonder if envdir shouldn't point to the actual environment directory instead.

Support `-p` / `--pipfile` for deps section

If I'm not totally mistaken a -p / --pipfile option is not yet supported by this tox plugin. (This feature has been discussed in #37 (comment) and tox-dev/tox#417 (comment), for example.)

I'm having a hard time accepting the fact that I need to continue using requirements.txt when I have a Pipfile. Can we add this feature here to make it easier to use Tox and Pipfile together (obsoleting the need for requirements.txt, obviously)?

RequirementError after installing package as editable

I couldn't find any other posts about the same issue, which means maybe it's user error. However, I was trying a pretty straightforward setup and ran into issues. Starting with installing the local package:

pipenv install -e .

The following entry is created in Pipfile:

foopkg = {editable = true, path = "."}

But when running tox, the folling error pops up

pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from '.'

Is there a workaround for this? There is nothing notable in tox.ini

[testenv]
commands =
  pytest tests/

tox 3.8.1 breaks us

To reproduce:

docker run --rm -it -v $(pwd):$(pwd) -w $(pwd) python:3.7-slim /bin/bash
pip3 install -U tox tox-pipenv
tox

Workaround, fall back to tox 3.7.0:

pip3 install tox==3.7.0

Error:

Traceback (most recent call last):
  File "/usr/local/bin/tox", line 10, in <module>
    sys.exit(cmdline())
  File "/usr/local/lib/python3.7/site-packages/tox/session/__init__.py", line 42, in cmdline
    main(args)
  File "/usr/local/lib/python3.7/site-packages/tox/session/__init__.py", line 63, in main
    retcode = session.runcommand()
  File "/usr/local/lib/python3.7/site-packages/tox/session/__init__.py", line 187, in runcommand
    return self.subcommand_test()
  File "/usr/local/lib/python3.7/site-packages/tox/session/__init__.py", line 215, in subcommand_test
    run_sequential(self.config, self.venv_dict)
  File "/usr/local/lib/python3.7/site-packages/tox/session/commands/run/sequential.py", line 9, in run_sequential
    if venv.setupenv():
  File "/usr/local/lib/python3.7/site-packages/tox/venv.py", line 584, in setupenv
    status = self.update(action=action)
  File "/usr/local/lib/python3.7/site-packages/tox/venv.py", line 242, in update
    self.hook.tox_testenv_create(action=action, venv=self)
  File "/usr/local/lib/python3.7/site-packages/pluggy/hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 68, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 62, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.7/site-packages/tox_pipenv/plugin.py", line 64, in tox_testenv_create
    venv.session.make_emptydir(venv.path)
AttributeError: 'VirtualEnv' object has no attribute 'session'

Project development

@asottile @dcrosta @nicoddemus @gaborbernat @obestwalter @rpkilby @The-Compiler
If you need someone to pick up the project and continue the great work you guys have done let me know.
There is a key fix that needs doing for tox >= 3.8 and has been a PR for many months now and it would make this project usable again.
So - happy to help if you neeed it otherwise would appreciate anyone jumping in and doing some of the PR reviews and merge.

Having an Issue running Tox

Whenever I try to run pipenv run tox it tries to run /venv/bin/python -m pipenv graph. Basically the same as running pipenv inside pipenv failing because pipenv isn't a dependency. I have a temporary work around by installing pipenv as a --dev dependency, but was wondering if this was an issue with how tox gets executed from within pipenv due to how tox-pipenv works?

jacobhowell@Jacobs-MacBook-Pro-2 ~/N/nal-ml> pipenv run tox
Loading .env environment variables…
ERROR: invocation failed (exit code 1), logfile: /Users/jacobhowell/NotActivelyLooking/nal-ml/.tox/py36/log/py36-4.log
ERROR: actionid: py36
msg: envreport
cmdargs: ['/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/bin/python3.6', '-m', 'pipenv', 'graph']


ERROR:  Traceback (most recent call last):
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/pipenv/vendor/pipdeptree.py", line 16, in <module>
    from pipenv.vendor.pip_shims import get_installed_distributions, FrozenRequirement
ModuleNotFoundError: No module named 'pipenv'


Traceback (most recent call last):
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/bin/tox", line 11, in <module>
    sys.exit(run_main())
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/tox/session.py", line 40, in run_main
    main(args)
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/tox/session.py", line 46, in main
    retcode = Session(config).runcommand()
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/tox/session.py", line 415, in runcommand
    return self.subcommand_test()
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/tox/session.py", line 610, in subcommand_test
    self.runenvreport(venv)
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/tox/session.py", line 622, in runenvreport
    packages = self.hook.tox_runenvreport(venv=venv, action=action)
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/pluggy/hooks.py", line 258, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/pluggy/manager.py", line 67, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/pluggy/manager.py", line 61, in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/pluggy/callers.py", line 201, in _multicall
    return outcome.get_result()
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/pluggy/callers.py", line 76, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/pluggy/callers.py", line 180, in _multicall
    res = hook_impl.function(*args)
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/tox_pipenv/plugin.py", line 167, in tox_runenvreport
    output = venv._pcall(args, venv=False, action=action, cwd=basepath)
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/tox/venv.py", line 409, in _pcall
    redirect=redirect, ignore_ret=ignore_ret)
  File "/Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/lib/python3.6/site-packages/tox/session.py", line 212, in popen
    "%s (see %s)" % (invoked, outpath), ret)
tox.InvocationError: InvocationError for command /Users/jacobhowell/.local/share/virtualenvs/nal-ml-OzYvifs4/bin/python3.6 -m pipenv graph (see /Users/jacobhowell/NotActivelyLooking/nal-ml/.tox/py36/log/py36-4.log) (exited with code 1)

Cannot run tox for the first time with this plugin installed

I'm not doing anything unusual. I just run tox with pipenv run tox and I get the following error:

GLOB sdist-make: /home/omer/Documents/Projects/myproject/setup.py
py36 create: /home/omer/Documents/Projects/myproject/.tox/py36
ERROR: Error creating virtualenv. Note that spaces in paths are not supported by virtualenv. Error details: FileNotFoundError(2, 'No such file or directory')
__________________________________________________________________________________ summary __________________________________________________________________________________
ERROR:   py36: Error creating virtualenv. Note that spaces in paths are not supported by virtualenv. Error details: FileNotFoundError(2, 'No such file or directory')

deps required to activate virtualenv

I'm new to pipenv and thought I'd try tox-pipenv as well. However, it looks like tox-pipenv doesn't install the virtualenv managed by pipenv unless there are specified deps. Perhaps this is intentional, but I thought I'd be able to run tox with my dev dependencies (per #2) without needing to specify any additional deps.

Example

File: tox.ini

[tox]
envlist = pylint
skipsdist=True

[testenv:py36]
changedir = app
commands = python manage.py --settings=myapp.settings.test

In my application, this results in ModuleNotFoundError: No module named 'django' even though django is in my Pipfile and Pipfile.lock. However, simply adding deps = requests (an unrelated package) will cause tox-pipenv to work.

I think the culprit may be here ... should the pipenv be installed regardless? ... but I'm not too familiar with this project.

Add support for tox 3.7.0

With the new tox version out, venv._getresolvedeps() was completely removed in favor of venv. get_resolved_dependencies.

As of now, the following error will raise when trying a tox run

py36 recreate: /app/.tox/py36
Traceback (most recent call last):
  File "/usr/local/bin/tox", line 11, in <module>
    sys.exit(cmdline())
  File "/usr/local/lib/python3.6/dist-packages/tox/session.py", line 47, in cmdline
    main(args)
  File "/usr/local/lib/python3.6/dist-packages/tox/session.py", line 54, in main
    retcode = build_session(config).runcommand()
  File "/usr/local/lib/python3.6/dist-packages/tox/session.py", line 467, in runcommand
    return self.subcommand_test()
  File "/usr/local/lib/python3.6/dist-packages/tox/session.py", line 590, in subcommand_test
    self.run_sequential()
  File "/usr/local/lib/python3.6/dist-packages/tox/session.py", line 597, in run_sequential
    if self.setupenv(venv):
  File "/usr/local/lib/python3.6/dist-packages/tox/session.py", line 509, in setupenv
    status = venv.update(action=action)
  File "/usr/local/lib/python3.6/dist-packages/tox/venv.py", line 222, in update
    self.hook.tox_testenv_install_deps(action=action, venv=self)
  File "/usr/local/lib/python3.6/dist-packages/pluggy/hooks.py", line 284, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 68, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 62, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.6/dist-packages/tox_pipenv/plugin.py", line 80, in tox_testenv_install_deps
    deps = venv._getresolvedeps()
AttributeError: 'VirtualEnv' object has no attribute '_getresolvedeps'

Error while installing tox-pipenv

Hi,

I'm trying to install tox-pipenv with pipenv, however I have the following error:

lib/python3.6/site-packages/pipenv/resolver.py", line 71, in main
    sources=project.pipfile_sources,
AttributeError: 'Project' object has no attribute 'pipfile_sources'

I must confess I'm not sure it's related to tox-pipenv itself or to pipenv but pipenv install works with other packages.

Environment

pipenv --version
pipenv, version 2018.05.18

Step to reproduces

pip install -U --user pipenv
mkdir tmp && cd tmp
pipenv install tox-pipenv

Discussion: Use of the Pipenv.lock

If we're trying to use tox and pipenv to have a reproducible build I feel like we should be using Pipfile.lock when installing the dependencies via pipenv sync

This way when the tox builds run in CI or locally it should be reproducible and faster since the whole dependency graph does not need to be determined all over again.

The changes here I don't think are significant. I'd be willing to put together a patch, I just want to know if this is desired before I put in the effort.

FileNotFoundError when restarting test with usedevelop=True

Traceback

(helloworld-py-lNkW4Xyt) sandbox/helloworld-py » tox -e py36
py36 create: /home/avmo/src/sandbox/helloworld-py/.tox/py36
WARNING:test command found but not installed in testenv
  cmd: /scratch/avmo/opt/helloworld-py-lNkW4Xyt/bin/python
  env: /home/avmo/src/sandbox/helloworld-py/.tox/py36
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
py36 develop-inst: /home/avmo/src/sandbox/helloworld-py
WARNING:test command found but not installed in testenv
  cmd: /scratch/avmo/opt/helloworld-py-lNkW4Xyt/bin/pip
  env: /home/avmo/src/sandbox/helloworld-py/.tox/py36
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
WARNING:test command found but not installed in testenv
  cmd: /scratch/avmo/opt/helloworld-py-lNkW4Xyt/bin/pip
  env: /home/avmo/src/sandbox/helloworld-py/.tox/py36
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
py36 installed: ----------------------------------------,Error when trying to get requirement for VCS system Command "git config --get-regexp remote\..*\.url" failed with error code 1 in /home/avmo/src/sandbox/helloworld-py, falling back to uneditable format,Could not determine repository location of /home/avmo/src/sandbox/helloworld-py,## !! Could not determine repository location,HelloWorld==0.1,pew==1.1.2,pipenv==11.0.2,pluggy==0.6.0,py==1.5.2,six==1.11.0,tox==2.9.1,tox-pipenv==1.4.0,virtualenv==15.1.0,virtualenv-clone==0.3.0
py36 runtests: PYTHONHASHSEED=None
py36 runtests: commands[0] | python test.py
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
______________________________________________________________________________________________ summary _______________________________________________________________________________________________
  py36: commands succeeded
  congratulations :)
(helloworld-py-lNkW4Xyt) sandbox/helloworld-py » tox -e py36
WARNING:test command found but not installed in testenv
  cmd: /scratch/avmo/opt/helloworld-py-lNkW4Xyt/bin/python
  env: /home/avmo/src/sandbox/helloworld-py/.tox/py36
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
ERROR: invocation failed (errno 2), args: [local('/home/avmo/src/sandbox/helloworld-py/.tox/py36/bin/python'), '/home/avmo/src/sandbox/helloworld-py/setup.py', '--name'], cwd: /home/avmo/src/sandbox/helloworld-py
Traceback (most recent call last):
  File "/scratch/avmo/opt/helloworld-py-lNkW4Xyt/bin/tox", line 11, in <module>
    sys.exit(cmdline())
  File "/scratch/avmo/opt/helloworld-py-lNkW4Xyt/lib/python3.6/site-packages/tox/session.py", line 40, in main
    retcode = Session(config).runcommand()
  File "/scratch/avmo/opt/helloworld-py-lNkW4Xyt/lib/python3.6/site-packages/tox/session.py", line 392, in runcommand
    return self.subcommand_test()
  File "/scratch/avmo/opt/helloworld-py-lNkW4Xyt/lib/python3.6/site-packages/tox/session.py", line 563, in subcommand_test
    self.developpkg(venv, self.config.setupdir)
  File "/scratch/avmo/opt/helloworld-py-lNkW4Xyt/lib/python3.6/site-packages/tox/session.py", line 489, in developpkg
    venv.developpkg(setupdir, action)
  File "/scratch/avmo/opt/helloworld-py-lNkW4Xyt/lib/python3.6/site-packages/tox/venv.py", line 249, in developpkg
    if not self._needs_reinstall(setupdir, action):
  File "/scratch/avmo/opt/helloworld-py-lNkW4Xyt/lib/python3.6/site-packages/tox/venv.py", line 222, in _needs_reinstall
    returnout=True, env=env)
  File "/scratch/avmo/opt/helloworld-py-lNkW4Xyt/lib/python3.6/site-packages/tox/session.py", line 140, in popen
    stdout=stdout, stderr=subprocess.STDOUT)
  File "/scratch/avmo/opt/helloworld-py-lNkW4Xyt/lib/python3.6/site-packages/tox/session.py", line 228, in _popen
    stdout=stdout, stderr=stderr, env=env)
  File "/usr/lib64/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '.tox/py36/bin/python': '.tox/py36/bin/python'

Steps to reproduce

git clone https://github.com/ashwinvis/helloworld-py.git
cd helloworld-py
pipenv install -e .
pipenv shell
tox -e py36  # Some warnings like "WARNING:test command found but not installed in testenv"
tox -e py36  # FileNotFoundError

Workarounds as of now

  1. Run tests simply as tox without the -e py36 option
  2. Set usedevelop=False in tox.ini

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.