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

pypi tarball contains __pycache__ directory #161

Closed
swt2c opened this issue Jun 14, 2017 · 6 comments
Closed

pypi tarball contains __pycache__ directory #161

swt2c opened this issue Jun 14, 2017 · 6 comments

Comments

@swt2c
Copy link
Contributor

swt2c commented Jun 14, 2017

The tarball (for 1.17.1, for example) hosted on pypi contains a pycache directory inside the testing directory. This can cause problems when trying to run the tests, such as this:

_________________ ERROR collecting testing/test_looponfail.py __________________
import file mismatch:
imported module 'test_looponfail' has this __file__ attribute:
  /home/travis/build/pytest-dev/pytest-xdist/testing/test_looponfail.py
which is not the same as the test file we want to collect:
  /builddir/build/BUILD/pytest-xdist-1.17.1/testing/test_looponfail.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules

I can just remove the pycache directory, but it would be helpful to just remove it from the tarball.

@nicoddemus
Copy link
Member

Definitely, thanks for the report.

@nicoddemus
Copy link
Member

I was about to open a PR with a fix for this by adding at the end of MANIFEST.in:

recursive-exclude *.pyc

And that did get rid of the .pyc files in the testing folder.

But looking more into it, it seems the MANIFEST.in file is redundant. After removing MANIFEST.in, here's the contents of my SOURCES.txt after running python setup.py sdist (and make sure there's no egg-info and dist folders left over):

.gitignore
.travis.yml
CHANGELOG.rst
HOWTORELEASE.rst
ISSUES.txt
LICENSE
OVERVIEW.md
README.rst
appveyor.yml
dev-requirements.txt
pyproject.toml
setup.cfg
setup.py
tox.ini
.github/PULL_REQUEST_TEMPLATE.md
changelog/_template.rst
example/boxed.txt
pytest_xdist.egg-info/PKG-INFO
pytest_xdist.egg-info/SOURCES.txt
pytest_xdist.egg-info/dependency_links.txt
pytest_xdist.egg-info/entry_points.txt
pytest_xdist.egg-info/not-zip-safe
pytest_xdist.egg-info/requires.txt
pytest_xdist.egg-info/top_level.txt
testing/acceptance_test.py
testing/conftest.py
testing/test_boxed.py
testing/test_dsession.py
testing/test_looponfail.py
testing/test_newhooks.py
testing/test_plugin.py
testing/test_remote.py
testing/test_slavemanage.py
xdist/__init__.py
xdist/_version.py
xdist/boxed.py
xdist/dsession.py
xdist/looponfail.py
xdist/newhooks.py
xdist/plugin.py
xdist/remote.py
xdist/slavemanage.py

This list looks right to me. Am I missing something? @RonnyPfannschmidt any thoughts?

@RonnyPfannschmidt
Copy link
Member

Looks good, setuptools-scm makes the file list

@nicoddemus
Copy link
Member

You mean that it will automatically include the version controlled files into the sdist? That's brilliant, I didn't know that (there's no mention of it in the docs). 😁

So in summary if one uses setuptools_scm one doesn't need a MANIFEST.in file in general, correct?

nicoddemus added a commit to nicoddemus/pytest-xdist that referenced this issue Jun 14, 2017
As discussed in pytest-dev#161, setuptools_scm will automatically
add all version controlled files to the package, so
MANIFEST.in is no longer needed

Fix pytest-dev#161
@RonnyPfannschmidt
Copy link
Member

@nicoddemus manifest excludes are sometimes nice, github/global ci metadata is not usefull for a sdist

@nicoddemus
Copy link
Member

manifest excludes are sometimes nice, github/global ci metadata is not usefull for a sdist

Agreed, but IMHO not worth having to maintain a MANIFEST.in file and related linting like we do in pytest just because of those files. 😁

I'm opening a PR in pytest doing the same in a few minutes.

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Jun 14, 2017
Because setuptools_scm already includes all version-controlled files
in an sdist, we don't need to maintain a MANIFEST.in file and anymore

See pytest-dev/pytest-xdist#161
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

3 participants