[1min Debug Log] Why Does setup.py Miss Building Files Into Wheel/Egg

Zi Zhao

--

Issue

I have a Python project, which contains some of my notebooks. I was able to package them into a *.whl package, so other people could use pip install *.whl to install them.

Now I have added a new folder olap-analysis to the project, but no matter how I tried, the new folder can never be packaged into the *.whl package.

├── notebooks
│ ├── olap-analysis
│ │ └── page-rank-connection.ipynb // <-- MISSING :(
│ └── visualization
│ ├── __init__.py
│ └── vis-fb-twt-linkn-connection.ipynb
└── setup.py

Resolution

I searched many places, but got no luck from anywhere. Then I calmed down and examined the structure again, I found the __init__.py file really suspicious. Although it is an empty one, but could it be the cause? I added an EMPTY __init__.py to the new folder, like this:

olap-analysis
├── __init__.py
└── page-rank-connection.ipynb

Then I executed the packaging command:

➜  ~ python3 setup.py bdist_wheel

BOOM!! That is it, the key missing part is the __init__.py file.

Keywords: bdist_wheel, python3, missing, package, build

--

--

Zi Zhao

Focus on development productivity. Keep track of IT world.