Another distribution question (possibly Python 101...
# general
b
Another distribution question (possibly Python 101): my directory structure for my repo looks like:
Copy code
src
├── clients
│   ├── app
|       ├── BUILD
│       └── app
|           ├── BUILD
|           ├── __init__.py
│           └── app.py
The first
BUILD
contains the packaging target:
Copy code
python_distribution(
    name="app_dist",
    dependencies=["src/clients/app/app"],
    ....
This successfully builds the distribution, but then when I import it, I have to
import <http://clients.app.app|clients.app.app>
- how do I set it so that the generated packages ignore the top-level directories? Ultimately, I want users to be able to
import app
.
1
c
This is controlled by the
source roots
: https://www.pantsbuild.org/docs/source-roots You likely want to include
src/clients/*
in your source roots in order to get
import app
to work.
b
src/clients/*
or
src/clients
?
c
with
src/clients
the import would be
import <http://app.app|app.app>
as the first
app
is not part of the root. If you have stuff in clients not to be a source root, you could list them explicitly, like ``"src/clients/app", "src/clients/other"` ..
b
Gotcha, thanks!
c
you’re welcome 🙂