https://pantsbuild.org/ logo
s

swift-river-73520

03/22/2023, 6:18 PM
Hi there, I'm just getting started with splitting up a single-project monorepo into multiple projects, which each subproject defining its requirements using a
pyproject.toml
file & the
poetry_requirements
target. Right now I'm just trying to get tests to run (via
pants test src/python/subproject1::
) for one of the subprojects, but I'm getting the following error on an import from a third-party library (
dropbox
, but I think this is likely to happen with a number of third-party dependencies):
Copy code
ModuleNotFoundError: No module named 'pkg_resources'
I see this resolved issue in the pantsbuild github which seems very similar, but specific to gunicorn. I tried adding
setuptools
to the pyproject.toml file for the subproject and re-ran
generate_lockfiles
before trying the tests again but didn't notice any change. I also tried adding
Copy code
python_sources(
    dependencies=["3rdparty/python#setuptools"]
)
to the BUILD file for the
subproject1
folder (not sure this even makes sense), and also didn't see any changes. Would anyone be able to point me in the right direction?
1
I also tried installing / updating
setuptools
in the base interpreter that seems to be getting used by Pants (some other stackoverflow threads suggested this), to no avail
r

refined-addition-53644

03/22/2023, 6:26 PM
You need to override dependencies for dropbox. For example
Copy code
poetry_requirements(
    name="reqs",
    overrides={
        "dropbox": {"dependencies": [":reqs#setuptools"]},
    },
)
https://www.pantsbuild.org/docs/python-third-party-dependencies#requirements-with-undeclared-dependencies
❤️ 1
s

swift-river-73520

03/22/2023, 6:26 PM
ah cool, I was just stumbling into that!