I have a suite of packages that are developed together and bundled into one distribution package.
For sake of argument, let's assume I have Good Reasons for organizing my python distribution package in the following way:
SpanishInqProject/
|---SpanishInq/
| |- weapons/
| | |- __init__.py
| | |- fear.py
| | |- surprise.py
| |- expectations/
| | |- __init__.py
| | |- noone.py
| |- characters/
| |- __init__.py
| |- biggles.py
| |- cardinal.py
|- tests/
|- setup.py
|- spanish_inq.pth
I've added the path configuration file spanish_inq.pth
to add SpanishInq
to the sys.path
, so I can import weapons
, .etc directly.
I want to be able to use setuptools to build wheels and have pip install weapons
, expectations
and characters
inside the SpanishInq
directory, but without making SpanishInq
a package or namespace.
My setup.py:
from setuptools import setup, find_packages
setup(
name='spanish_inq',
packages=find_packages(),
include_package_data=True,
)
With a MANIFEST.in
file containing:
spanish_inq.pth
This has been challenging in a couple of ways:
pip install
has putweapons
etc. directly in thesite-packages
directory, rather than in aSpanishInq
dir.- my
spanish_inq.pth
file ends up in the sys.exec_prefix dir, rather than in my site-packages dir, meaning the relative path in it is now useless.
The first problem I was able to sort of solve by turning SpanishInq into a module (which I'm not happy about), but I still want to be able to import weapons
etc. without SpanishInq as a namespace, and to do this I need SpanishInq added to the sys.path, which is where I was hoping the .pth
file would help...but I can't get it to go where it ought to.
So...
How do I get the .pth
file to install into the site-packages
dir?