cold-soccer-63228
05/23/2022, 9:57 PMariadne plugin and jinja2 plugin to infer some dependencies when using these libraries.
I'm following Building in-repo plugins with Pants so that I can write tests for my plugins. But if I add the path to my plugins to the [source] part of my pants.toml, I start seeing errors like the following.
The target path/to/first_party.py imports `ariadne.make_executable_schema`, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['//:requirements#ariadne', 'pants-plugins/ariadne/__init__.py'].
Please explicitly include the dependency you want in the `dependencies` field of path/to/first_party.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/v2.11/docs/troubleshooting#import-errors-and-missing-dependencies>.
It would be a huge headache to manually do what the error message suggests for every BUILD file.
One alternative I'm thinking is publishing these in-repo plugins to PyPI, and then referencing them in our codebase, but that has the downside of slowing down the iteration cycle šhundreds-father-404
05/23/2022, 10:02 PMpants_plugins.ariadne? What is the file path currently to your register.py?cold-soccer-63228
05/23/2022, 10:10 PMsrc/
āāā BUILD
āāā pants.toml
āāā first_party/
ā āāā ...
āāā pants-plugins/
āāā ariadne/
ā āāā goals/
ā ā āāā ...
ā āāā dependency_inference/
ā ā āāā ...
ā āāā register.py
āāā jinja2
āāā goals/
ā āāā ...
āāā dependency_inference/
ā āāā ...
āāā register.pycold-soccer-63228
05/23/2022, 10:10 PMpants-plugins/pants_plugins/ariadne?
If I do that, where does the register.py go?hundreds-father-404
05/23/2022, 10:13 PMregister.py will be nested. The backend_package will become my_plugins.ariadne and my_plugins.jinja2 for example. (You want to make sure you still have [source].root_patterns set to /pants-plugins for this to work)cold-soccer-63228
05/23/2022, 10:16 PMpants-plugins besides a single nested pants_plugins directory.
src/
āāā ...
āāā pants-plugins/
āāā pants_plugins/
āāā ariadne/
ā āāā ...
ā āāā register.py
āāā jinja2/
āāā ...
āāā register.py
Then, in `pants.toml`:
[sources]
root_patterns = [
..,
"pants-plugins",
]hundreds-father-404
05/23/2022, 10:17 PM__init__.py files places alsocold-soccer-63228
05/23/2022, 10:17 PM