I am trying to improve the project structure while adding to a code base. I found a sample structure here which looks like this:
README.rst
LICENSE
setup.py
requirements.txt
sample/__init__.py
sample/core.py
sample/helpers.py
docs/conf.py
docs/index.rst
tests/test_basic.py
tests/test_advanced.py
I notice in particular that requirements.txt
and setup.py
are on a higher level than tests/
and sample/
If I add sample/classes.py
you need only write from classes import MyClass
in sample/core.py
to get it in there. It cannot however so easily be imported into tests/test_basic.py
, does not seem like python 'looks around the corner' like that when importing.
In my case, there is also a MANIFEST.in
on the same level with requirements.txt and some files which are not really python but just set things up for the platform on which this runs.
If classes.py
were on the same level as requirements.txt
I think it would be easily importable by everything in tests/
and in sample/
and their subdirectories, but it may need a __init__.py
That doesn't feel right somehow.
So where should it go if both tests/
and sample/
need to be able to use it?