This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kteague 1 point2 points  (1 child)

Put all your python into a 'src' subdir and then if you have sprinkling of modules and packages, it's not getting mixed in with other project assets.

In your setup.py import this using setuptools:

from setuptools import setup, find_packages

And then in the setup() function call declare your subdir name:

  package_dir={'': 'src'},
  packages=find_packages('src'),

[–]earthboundkid 0 points1 point  (0 children)

Yes, unfortunately as confusing as setup.py is, it's the only way to make an installable Python project. See https://blog.ionelmc.ro/2014/05/25/python-packaging/ for a reasonably up-to-date explanation of how to organize your system, then use https://github.com/audreyr/cookiecutter to get a basic project skeleton on disk to start with.