I am encountering an issue while uploading my Python package to PyPI. I have followed the standard steps for creating a distribution package using python setup.py sdist and python setup.py bdist_wheel, but the resulting package on PyPI has an unexpected directory structure.
I have a Python project with the following structure:
my_project/
|-- setup.py
|-- my_module/
|-- __init__.py
|-- ...
After running python setup.py sdist and python setup.py bdist_wheel, the dist directory contains both a .tar.gz file and a .whl file.
Upon uploading to PyPI using twine upload dist/*, the package is successfully uploaded, but when users download and install it, they find an unexpected directory structure in their site-packages:
site-packages/
|-- my_project-1.0.0.dist-info/
|-- ...
What should i do?
Edit:
my_project/
|-- setup.py
|-- my_module/
|-- __init__.py
|-- screen.py
|-- test.txt
|-- my_module/
|-- dependency_links.txt
|-- PKG-INFO
|-- requires.txt
|-- SOURCES.txt
|-- top_level.txt
|-- dist/
|-- my_module-1.1.5-py3-none-any.whl
|-- my_module-1.1.5.tar.gz
|-- build/
|-- bdist.win-amd64
|-- lib/
|-- __init__.py
|-- screen.py
site-packages/
|-- my_project-1.0.0.dist-info/
|-- INSTALLER
|-- METADATA
|-- RECORD
|-- REQUESTED
|-- top_level.txt
|-- WHEEL
I figured it out. I had to include this in my setup.py
file:
package_data={
'my_module': ['__init__.py', 'screen.py'],
},