0

I would like to upload my package to PyPI using setuptools. Unfortunately only __init__.py gets packaged, and files it imports are not packaged. As a result my package is distributed incomplete and fails on import. My file structure is as following:

./
./mypkg/__init__.py
./mypkg/folder1/class_a.py
./setup.py
./upload.sh

I am using following setup.py:

import setuptools

setuptools.setup(
    name="mypkg",
    version="0.0.2",
    packages=['mypkg'],
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
)

Edit: The question is different from Why do I need to include sub-packages in setup.py in that it looks for any solutions to the problem, and linked question discusses the technical reasons for one of the possible solutions.

2

1 Answer 1

1

solution was to list the needed directories like:

import setuptools

setuptools.setup(
    ...
    packages=['mypkg', 'mypkg.folder1'],
    ...
)

Further reading: Why do I need to include sub-packages in setup.py

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.