Repository navigation
Replies: 2 comments
|
I made this a discussion since I'm not sure if this is a feature request or if I'm simply using it wrong. Looked around and haven't seen any similar discussions before. Happy to make this into a proper issue & feature request if you think it trends more towards that. |
|
I can't think of a way to do this at present. This has been floated before (see #18254). See that issue and the PR it links to for more context. Pants will build the wheel and put it in the sys path for test, run and repl, but it doesn't do anything special for packaging, and it doesn't attempt to figure out conflicting resolves. But you might be able to work around this using the Otherwise, I think we'll have to tackle this more substantially, somehow. |
Uh oh!
There was an error while loading. Please reload this page.
Hi Pants peeps! I have a question on the interaction between
python_requirementandpython_distribution.We’re trying to model an internal Python library as a Pants-built wheel, then consume that wheel from another project in the same repo without first uploading it to an external package registry.
The important constraint: the consuming project should own its dependency versions through its own resolve. The library wheel should behave like a normal pip package artifact whose metadata participates in dependency resolution, rather than forcing the consumer to use the library project’s resolve.
Extra Details
Simplified tree:
We have separate resolves:
The relevant macro is basically:
The consumer currently declares the library as a normal third-party requirement:
But our goal is to consume the locally built libs/dd_internal_pyspark/src/python:dd-internal-pyspark wheel instead of going back and forth between a registry. Something like this
We also tried including it directly as a
dependencyon the python_sources, but this does not give us the behavior we want. Pants treats the distribution’s source/dependency closure as part of the target graph, so all targets need to share the same resolve. That makes the library’s own resolve leak into the consumer.We do not want to solve this by parametrizing the library over every consumer resolve. We want the consumer resolve to remain authoritative, e.g. pyspark_smoke_testing should decide its numpy, pyspark, etc. versions, and the local wheel should participate like a regular package artifact.
TLDR
Is there a Pants-native way to say: build this python_distribution target, then use the resulting wheel as the artifact for a python_requirement in another resolve?
We’re trying to understand what model Pants expects here, especially for monorepos with internal Python packages where consumers should retain independent resolves.
All reactions