<#22423 Distribution in python mono repo> New disc...
# github-notifications
c
#22423 Distribution in python mono repo New discussion created by sokui Hi community, I am new to pants. I read the pants docs and also try to search online including asking chatGPT. But I am still struggling to solve my distribution issue. I have the following structure for my python mono repo, and the git repo is here.
Copy code
.
├── 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:
Copy code
% 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)?
Copy code
dependencies = [
  "tornado==6.4.2",
  "lib1 @ file:///${PROJECT_ROOT}/../lib1"
]
Pls help. thank you! pantsbuild/pants