Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test session remove and install dependencies at each call #111

Open
oncleben31 opened this issue Jun 23, 2020 · 2 comments
Open

test session remove and install dependencies at each call #111

oncleben31 opened this issue Jun 23, 2020 · 2 comments

Comments

@oncleben31
Copy link

In the chapter Managing dependencies in Nox sessions with Poetry you explain how we can use poetry to pin the development dependencies and avoid installing some according to the type of test session.

The result is each time I launch now -rs test first poetry uninstall dependencies that pip will re-install just after. It doesn't seem optimal.

Log:

nox > Running session tests-3.7
nox > Re-using existing virtual environment at .nox/tests-3-7.
nox > poetry install --no-dev
Installing dependencies from lock file


Package operations: 0 installs, 0 updates, 14 removals

  - Removing coverage (5.1)
  - Removing importlib-metadata (1.6.1)
  - Removing more-itertools (8.4.0)
  - Removing packaging (20.4)
  - Removing pluggy (0.13.1)
  - Removing py (1.8.2)
  - Removing pyparsing (2.4.7)
  - Removing pytest (5.4.3)
  - Removing pytest-cov (2.10.0)
  - Removing pytest-mock (3.1.1)
  - Removing six (1.15.0)
  - Removing toml (0.10.1)
  - Removing wcwidth (0.2.4)
  - Removing zipp (3.1.0)
  - Installing hypermodern-python (0.1.0)
nox > poetry export --dev --format=requirements.txt --output=/var/folders/v5/wtydb2rx72b74xds_1hc2xr80000gq/T/tmp2tb8qu3a
nox > pip install --constraint=/var/folders/v5/wtydb2rx72b74xds_1hc2xr80000gq/T/tmp2tb8qu3a coverage[toml] pytest pytest-cov pytest-mock
nox > pytest --cov -m not e2e
...
@cjolowicz
Copy link
Owner

cjolowicz commented Jun 24, 2020

Yes, this is a known limitation. There is a better technique for installing the package into Nox sessions, that does not have this issue: Pip-install the core dependencies using poetry export, then build and install a wheel from your package. Take a look at the Hypermodern Python Cookiecutter for how to do this.

Related:

@oncleben31
Copy link
Author

Indeed the new approach in the cookiecutter template is better. Thank you.
The blog post will need an update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants