high-psychiatrist-4761
06/25/2025, 6:20 AM.
├── pants.toml
├── src
│ └── python
│ ├── lib1
│ │ ├── __init__.py
│ │ ├── BUILD
│ │ ├── lib1.py
│ │ └── pyproject.toml
│ ├── package1
│ │ ├── __init__.py
│ │ ├── BUILD
│ │ ├── package1.py
│ │ └── pyproject.toml
│ └── package2
│ ├── __init__.py
│ ├── BUILD
│ ├── package2.py
│ └── pyproject.toml
└── test
└── python
└── tests
├── __init__.py
└── package1
├── __init__.py
├── BUILD
├── pyproject.toml
└── test_package1.py
Basically both package1 and package2 depends on lib1. I want to publish package1 and package2 as lib, but keep lib1 as internal lib which won’t publish. And the package 1 in test folder is to test package 1. I can run pants generate-lockfiles
and pants test test/python/tests/package1:tests
without any problem. But when I do pants package src/python/package1:dist
, I got the following error:
% pants package src/python/package1:dist
21:35:50.43 [ERROR] 1 Exception encountered:
Engine traceback:
in `package` goal
NoOwnerError: No python_distribution target found to own src/python/lib1/__init__.py. Note that the owner must be in or above the owned target's directory, and must depend on it (directly or indirectly). See <https://www.pantsbuild.org/2.25/docs/python/overview/building-distributions> for how python_sources targets are mapped to distributions. See <https://www.pantsbuild.org/2.25/docs/python/overview/building-distributions>.
Could you pls let me know what the problem is and how to fix it? Also I am not quite sure for lib1, in package1 or package2, should I put lib1 dependency in the BUILD file as my current code, or I can put it in the pyproject.toml like below (tested, not work. Not sure if it is path issue)?
dependencies = [
"tornado==6.4.2",
"lib1 @ file:///${PROJECT_ROOT}/../lib1"
]
Pls help. thank you!happy-kitchen-89482
06/25/2025, 2:58 PMhappy-kitchen-89482
06/25/2025, 2:58 PMhappy-kitchen-89482
06/25/2025, 2:59 PMhappy-kitchen-89482
06/25/2025, 2:59 PMhappy-kitchen-89482
06/25/2025, 3:00 PMhappy-kitchen-89482
06/25/2025, 3:00 PMfile://
in a pyproject.toml like that.happy-kitchen-89482
06/25/2025, 3:00 PMpython_sources()
in a BUILD filehigh-psychiatrist-4761
06/25/2025, 3:02 PMhappy-kitchen-89482
06/25/2025, 3:06 PMhappy-kitchen-89482
06/25/2025, 3:06 PMhappy-kitchen-89482
06/25/2025, 3:07 PMhappy-kitchen-89482
06/25/2025, 3:07 PMhigh-psychiatrist-4761
06/25/2025, 3:12 PMhigh-psychiatrist-4761
06/25/2025, 4:44 PMhappy-kitchen-89482
06/25/2025, 10:33 PMhigh-psychiatrist-4761
06/25/2025, 11:12 PMhappy-kitchen-89482
06/26/2025, 3:54 AMhappy-kitchen-89482
06/26/2025, 3:54 AMhappy-kitchen-89482
06/26/2025, 3:54 AMhigh-psychiatrist-4761
06/26/2025, 3:59 AMhappy-kitchen-89482
06/26/2025, 3:04 PMhappy-kitchen-89482
06/26/2025, 3:05 PMhappy-kitchen-89482
06/26/2025, 3:05 PMhappy-kitchen-89482
06/26/2025, 3:06 PMhappy-kitchen-89482
06/26/2025, 3:06 PMhigh-psychiatrist-4761
06/26/2025, 3:11 PMhappy-kitchen-89482
06/26/2025, 9:23 PM