pypa / pypa/setuptools

Package considered zip_safe although package_data is used

Open
#386 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug major
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Originally reported by: xflr6 (Bitbucket: xflr6, GitHub: xflr6)


The description of zip_safe inference in the docs:

it will consider the project unsafe if it contains any C extensions or datafiles whatsoever.

suggests that a package with a setup.py like this

from setuptools import setup, find_packages

setup(
    name='spam',
    version='0.1.dev0',
    packages=find_packages(),
    package_data={'spam': ['spam.txt']},
)

should be considered zip_safe=False.
However, when such a package is installed via python setup.py install, it ends up as a zipped egg:

copying build/lib.linux-i686-2.7/spam/spam.txt -> build/bdist.linux-i686/egg/spam
copying build/lib.linux-i686-2.7/spam/__init__.py -> build/bdist.linux-i686/egg/spam
(...)
Processing spam-0.1.dev0-py2.7.egg
Copying spam-0.1.dev0-py2.7.egg to /tmp/venv/lib/python2.7/site-packages
Adding spam 0.1.dev0 to easy-install.pth file

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 with the zip_safe inference used by setup.py install, and reproduce the issue using the shown setup.py with package_data and spam.txt. Compare the behavior with the documentation's claim about data files; done means the inference and installed egg behavior agree with the documented expectation.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.