0

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?

Dustin Ingram
  • 20,502
  • 7
  • 59
  • 82
Jordan Kowal
  • 1,444
  • 8
  • 18

2 Answers2

3

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"].

Allan Chain
  • 2,345
  • 1
  • 14
  • 29
0

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.

Orsiris de Jong
  • 2,819
  • 1
  • 26
  • 48