I have a pants project like this: ```druid/ web/ #...
# general
n
I have a pants project like this:
Copy code
druid/
web/ # a Django app
I'm trying to import the
druid
library into the
web
one like this:
Copy code
python_sources(
    name="lib",
    dependencies=[
        "//druid:lib",
        "//:reqs#apple-certifi",
        "//:reqs#boto3",
        "//:reqs#django", # and other deps
        ":templates",
        ":markdown",
        ":django_tailwind",
        ":static_files",
    ],
    overrides={
        "manage.py": {
            "restartable": True,
            "run_goal_use_sandbox": False,
        },
    },
    skip_mypy=True,
    sources=[
        "*.py",
        "config/*.py",
        "config/settings/*.py",
        "apps/**/*.py",
        "components/**/*.py",
    ],
)
locally this works, but in prod when I build the pex I get this error:
Copy code
ModuleNotFoundError: No module named 'druid'
any advice? thanks!
b
Sorry for the trouble. Are there any warnings from pants? What’s the definition of the pex?
n
no worries, here is my PEX definition:
Copy code
pex_binary(
    name="prod_manage",
    dependencies=[
        ":lib",
    ],
    entry_point="prod_manage.py",
)
b
I think the target name is incorrect:
"//druid:lib"
Normally, this would refer to a target called
druid
in the root of your repo, but you’re trying to include the contents of the
druid
directory instead
n
yes that's right I'm trying to include the contents of that directory
how would I include this?
Copy code
python_sources(
    name="lib",
    dependencies=[
        "//:reqs#apple-certifi",
        "//:reqs#pydruid",
        "//:reqs#matplotlib",
        "//:reqs#pandas",
    ],
    sources=[
        "druid/**/*.py",
    ],
    skip_mypy=True,
)
b
If the name of the target is
lib
and it’s in your repo root, you’d include it like this:
Copy code
//:lib
n
the file is
druid/BUILD
wouldn't it be
//druid:lib
?
there is no
//:lib
though I can create one
b
No, because
//
refers to the repo root. Here’s a good resource on how targets are addressed: https://www.pantsbuild.org/2.18/docs/using-pants/key-concepts/targets-and-build-files#target-addresses
n
Copy code
ResolveError: The address //:druid from the `dependencies` field of the target web/manage.py:lib does not exist.

The target name ':druid' is not defined in the directory . Did you mean one of these target names?