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

Fix dist build #6139

Merged
merged 2 commits into from
Aug 24, 2018
Merged

Fix dist build #6139

merged 2 commits into from
Aug 24, 2018

Conversation

rpkilby
Copy link
Member

@rpkilby rpkilby commented Aug 23, 2018

There is some incompatibility with tox/pytest/virtualenv that causes the 'dist' build to fail. By using the builtin venvs, the issue is bypassed.

I'm also too lazy to figure out why exactly this is happening.

@carltongibson
Copy link
Collaborator

Thanks @rpkilby!

(Build still failing though... 😐)

I didn't have time to dig into this. It was fine. What changed?

@rpkilby
Copy link
Member Author

rpkilby commented Aug 23, 2018

virtualenv/venv was not the cause, that was just correlated to how I was calling tox. The actual issue appears to be a change in tox 3. bisected to tox-dev/tox#935

@rpkilby
Copy link
Member Author

rpkilby commented Aug 23, 2018

Note that the first call to tox raises an exception, while the second call succeeds. e.g., what I saw when changing from virtualenv to venv.

@carltongibson
Copy link
Collaborator

The actual issue appears to be a change in tox 3.

So is the temporary fix to pin the tox version?

@rpkilby
Copy link
Member Author

rpkilby commented Aug 23, 2018

More info in tox-dev/tox#935 (comment) and pypa/pip#4621 (comment).

Basically, this should be fixable by mucking with pkg_resources. That said, the better fix is to move runtests.py out of the same directory as rest_framework. This would be a slightly larger change, since this would rework how we test coverage/distributions.

@carltongibson
Copy link
Collaborator

Right, good digging! 👏

  • We'll need to run any reorganisation past @tomchristie. PING 🙂(General thought is that the tools shouldn't really dictate/break a setup that's been working for years... — but things change, so maybe.)
  • What's the quickest duct-tape-for-today whilst we work it out? (dist build is useful — I'm a convert to that so it'd be good to have it working in the meantime.)

Thanks for the effort! 🏆

@rpkilby
Copy link
Member Author

rpkilby commented Aug 23, 2018

It should be possible to do this without any significant reorganization - just some config changes and moving runtests.py into tests. My laptop is out of juice for the evening - I'll whip this up tomorrow.

Note to self, will need to usedevelop for builds to retain coverage stats. dist build will be simplified, as we can remove the --no-pkgroot hackery.

@codecov-io
Copy link

codecov-io commented Aug 24, 2018

Codecov Report

Merging #6139 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #6139   +/-   ##
=======================================
  Coverage   96.18%   96.18%           
=======================================
  Files         128      128           
  Lines       17624    17624           
  Branches     1459     1459           
=======================================
  Hits        16951    16951           
  Misses        465      465           
  Partials      208      208

tox now invokes pip as a python module instead of through its entry
point. "python -m" adds the current directory to the PYTHONPATH, picking
up the .egg-info/ metadata directory, tricking pip into thinking that
the package is already installed (and thus not installing the wheel).
Deleting the metadata directory fixes this.
@rpkilby
Copy link
Member Author

rpkilby commented Aug 24, 2018

I was wrong. Running the test suite from tests only solves half the issue. This doesn't fix dependency installation, as python -m adds the current directory (the package root) and picks up its .egg-info directory. The simplest fix is to just delete the metadata.

@rpkilby rpkilby merged commit c4b068c into encode:master Aug 24, 2018
@rpkilby rpkilby deleted the fix-testing branch August 24, 2018 22:57
rpkilby added a commit to rpkilby/django-rest-framework-filters that referenced this pull request Feb 7, 2019
ref: encode/django-rest-framework#6139
tox now invokes pip as a python module instead of through its entry
point. "python -m" adds the current directory to the PYTHONPATH, picking
up the .egg-info/ metadata directory, tricking pip into thinking that
the package is already installed (and thus not installing the wheel).
Deleting the metadata directory fixes this.
rpkilby added a commit to rpkilby/django-rest-framework-filters that referenced this pull request Feb 7, 2019
ref: encode/django-rest-framework#6139
tox now invokes pip as a python module instead of through its entry
point. "python -m" adds the current directory to the PYTHONPATH, picking
up the .egg-info/ metadata directory, tricking pip into thinking that
the package is already installed (and thus not installing the wheel).
Deleting the metadata directory fixes this.
adamchainz added a commit to adamchainz/django-rest-framework that referenced this pull request Oct 9, 2020
This was added in encode#6139. However it seems [tox-venv is no longer maintained](https://github.com/tox-dev/tox-venv), the related [virtualenv issue has been closed](pypa/virtualenv#355), and I suspect with the virtualenv rewrite fixed the problem with site.py and the warnings referred to for the DRF tests.
tomchristie pushed a commit that referenced this pull request Oct 9, 2020
This was added in #6139. However it seems [tox-venv is no longer maintained](https://github.com/tox-dev/tox-venv), the related [virtualenv issue has been closed](pypa/virtualenv#355), and I suspect with the virtualenv rewrite fixed the problem with site.py and the warnings referred to for the DRF tests.
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
* Use tox-venv to reduce warnings in output

* Remove .egg-info/ to allow wheel installation

tox now invokes pip as a python module instead of through its entry
point. "python -m" adds the current directory to the PYTHONPATH, picking
up the .egg-info/ metadata directory, tricking pip into thinking that
the package is already installed (and thus not installing the wheel).
Deleting the metadata directory fixes this.
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
This was added in encode#6139. However it seems [tox-venv is no longer maintained](https://github.com/tox-dev/tox-venv), the related [virtualenv issue has been closed](pypa/virtualenv#355), and I suspect with the virtualenv rewrite fixed the problem with site.py and the warnings referred to for the DRF tests.
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

Successfully merging this pull request may close these issues.

3 participants