Reputation: 1594
I've turned my personal utility functions into a package to be able to use it across all my projects. As such, I've re-structured the repo, published it on GitHub, and packaged it for PyPI.
However, I can't get it to work. I've installed it using pip install jklib
, but I can't import the subpackages. For example, I get the error No module named 'jklib.django'
I've tried changing the content of all the __init__.py
files with no success. I've already uploaded PyPI packages before successfully, though they didn't have subpackages.
Any ideas?
Upvotes: 0
Views: 1082
Reputation: 3016
Old question, but still interesting. I own a function collection too on Github called ofunctions, and have created a "namespace" package which will install everything, and subpackages which will only install the necessary functions, including its dependencies.
I've managed to create a single setup.py
file which deals with the pacakge itself, and all subpackages and requirements.
In the end, I wanted to achieve the following install syntax to install just a part of the pacakge:
pip install ofunctions.network
Or the whole pacakge via
pip install ofunctions
Have a look at my git repo construction if it helps. Best regards.
Upvotes: 0
Reputation: 2815
Use packages=setuptools.find_packages()
in your setup.py
to include all subpackages. There is only __init__.py
in site_packages/jklib/
when installed if use packages=["jklib"]
.
Upvotes: 3