0

I have a Python project organized as below:

foo -
    |
    |--foo/
    |    |
    |    |--first.py
    |    |--second.py
    |    |--...
    |--README
    |--requirements.txt
    |--scripts/
    |        |
    |        |-script1.sh
    |        |-script2.py
    |--docker/
    |       |
    |       |--compose_files/
    |       |              |
    |       |              |-first.yml
    |       |              |-second.yml
    |       |              |-files/
    |       |                    |
    |       |                    |-some text files...
    |       |-dockerfiles/
    |                   |
    |                   |-some other files...
    |--service.py
    |--setup.py

All the files here, including those in docker/ are needed for packaging. But by default, running setup.py just packages foo/ and scripts/. To include docker/, I took suggestion here: yaml file not getting copied when installing from setup.py and How to include docs directory in python distribution. I did recursive-include docker * and I can see docker subdirectory in the output of python setup.py sdist.

But after I uploaded it to testPyPi and reinstalled via pip, the docker/ is absent in venv/lib/python3.6/site-packages. Since docker is one of requirements, I thought it could probably be overwritten by installing the docker there.

Then I renamed the docker/ to docker-internal/ and verified it shows up in the output of python setup.py sdist. But again, after I uploaded it to testPyPi and reinstalled, the docker-internal/ is missing.

Does anyone has some idea of what's going on here? How to make those files present in venv/lib/python3.6/site-packages?

This is how setup.py looks like:

setup(
    name='foo',
    version=VERSION_NUM,
    description='some text',
    long_description=(
        'some longer text'
    ),
    url='our website url',
    author='yibol',
    author_email='',
    license='Apache License 2.0',
    keywords='',
    packages=find_packages(exclude=["tests*"]),
    classifiers=[
        "Programming Language :: Python :: 3 :: Only",
        "Programming Language :: Python :: 3.6",
        "License :: OSI Approved :: Apache Software License",
    ],
    py_modules=['service'],
    python_requires='~=3.6',
    cmdclass={'install': Install},
    include_package_data=True,
    install_requires=get_requirements('requirements.txt'),
    entry_points={
        'console_scripts': [
            'a list of commands and corresponding modules',
        ]
    },
    zip_safe=False,
)

The setup.cfg contains no relevant information. I noticed there is a pyvenv.cfg, which contains following:

home = /Library/Frameworks/Python.framework/Versions/3.6/bin
include-system-site-packages = false
version = 3.6.0

Thank you so much!

Yibo Liu
  • 71
  • 6
  • Show your `setup.py` and/or `setup.cfg`so that we can help. – sinoroc Oct 22 '20 at 11:40
  • @sinoroc I added above. Thank you so much! – Yibo Liu Oct 22 '20 at 20:50
  • Two things: ***1.*** After you make changes in `setup.py`, make sure to clean all build artifacts, before starting a new build. ***2.*** Have you tried adding an (empty) `__init__.py` file in each of the directories containing the data you want to distribute? – sinoroc Oct 23 '20 at 13:52
  • @sinoroc Problem solved! Thank you again! – Yibo Liu Oct 23 '20 at 20:55

0 Answers0