You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to have a first party Python dependency built with a different resolve? We have two services,
service1
service2
They each have their own resolves, so that when service1 updates its version of FastAPI, for example, it doesn't trigger a change in service2.
service1 also contains some shared code that service2 depends on. When trying to set up the dependency directly in Pants, it gives an error:
09:45:37.50 [WARN] Pants cannot infer owners for the following imports in the target service1/file.py:
* dependency 1
* dependency 2
* dependency 3
If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/2.25/docs/using-pants/troubleshooting-common-issues#import-errors-and-missing-dependencies for common problems.
09:45:37.52 [WARN] The target service2/file.py imports `third party dependency`, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['service2#dependency', 'service1#dependency'].
Please explicitly include the dependency you want in the `dependencies` field of service2/file.py, or ignore the ones you do not want by prefixing with `!` or `!!` so that one or no targets are left.
Alternatively, you can remove the ambiguity by deleting/changing some of the targets so that only 1 target owns this module. Refer to https://www.pantsbuild.org/2.25/docs/using-pants/troubleshooting-common-issues#import-errors-and-missing-dependencies.
I tried to create a python_distribution target for service1 and have service2 depend on that but it resulted in:
Engine traceback:
in `test` goal
NoCompatibleResolveException: The target service2/file.py uses the `resolve` `service2`, but some of its dependencies are not compatible with that resolve:
* src/service1/file.py (service1)
* ....
* ....
All dependencies must work with the same `resolve`. To fix this, either change the `resolve=` field on those dependencies to `service2`, or change the `resolve=` of the target src/service2/file.py. If those dependencies should work with multiple resolves, use the `parametrize` mechanism with the `resolve=` field or manually create multiple targets for the same entity.
For more information, see https://www.pantsbuild.org/2.25/docs/python/overview/lockfiles#multiple-lockfiles.
Is there a way to do this? Alternatively, is this just a really bad idea?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to have a first party Python dependency built with a different resolve? We have two services,
service1service2They each have their own resolves, so that when
service1updates its version of FastAPI, for example, it doesn't trigger a change inservice2.service1also contains some shared code thatservice2depends on. When trying to set up the dependency directly in Pants, it gives an error:I tried to create a
python_distributiontarget forservice1and haveservice2depend on that but it resulted in:Is there a way to do this? Alternatively, is this just a really bad idea?
Beta Was this translation helpful? Give feedback.
All reactions