Is it possible to create a source distribution with python setup.py sdist
without having to use some sort of __init__.py
files in every (sub)package (python 3.5+)? I really would like to just use namespace packages to avoid any redundancy and overhead. All nested .py
-files in all subpackages should be included.
So take the following project structure (I tried to be analogous to pytest documentation):
setup.py:
from setuptools import setup, find_packages
setup(
version="0.0.1",
name="py_import_test",
package_dir={"": "src"},
packages=find_packages(where='src')
)
In main.py
I use something like
import py_import_test.p1.helloworld
# do something with helloworld-module
When I python setup.py sdist
with the above project structure, I get no source files at all in the resulting .tar.gz. It only works, if there is __init__.py
under py_import_test
, p1
and possible further subpackages.
All in all, my goal is to have some standalone application package, that I can use to test against and easily install my package to a remote server. For this purpose, I would like to have the source tree as lean as possible and utilize up-to-date python packaging patterns.
Apart from my question regarding __init__.py
: Would the procedure above be considered a good/modern practise?
Greetings
__init__.py
files into the directories and they will magically become packages. Don't worry, they do not byte!