Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gazelle example that mixes internal and third party deps #1386

Closed
FrankPortman opened this issue Aug 22, 2023 · 6 comments
Closed

Gazelle example that mixes internal and third party deps #1386

FrankPortman opened this issue Aug 22, 2023 · 6 comments
Labels
Can Close? Will close in 30 days if there is no new activity gazelle Gazelle plugin related issues need: repro Needs a minimal reproduction

Comments

@FrankPortman
Copy link

FrankPortman commented Aug 22, 2023

🚀 feature request

Relevant Rules

rules_python, specifically the Gazelle capabilities: https://github.com/bazelbuild/rules_python/tree/main/gazelle

Description

I'm able to follow the README to enable Gazelle for my monorepo. However, it seems that updating the manifest file only looks at third party libraries. In order to avoid issues when running bazel run //:gazelle for internal dependencies (linked via deps in BUILD files), I have to manually add a bunch of directives to resolve between an attempted import and an internal dep.

Describe the solution you'd like

A happy path for resolving both internal and third party dependencies without having to manually list all internal deps as resolve directives.

@cbournhonesque-sc
Copy link

I have the same issue; python gazelle doesn't update the BUILD files to include my internal dependencies.

Could you please share the directives you added to solve this?

@FrankPortman
Copy link
Author

Sure, it's nothing special. Just stuff like this:

# gazelle:resolve_regexp py py foo.* //foo/python/foo

I just did this while debugging and trying to set up Gazelle but I don't consider this a scalable solution. I figure there must be a way for Gazelle to crawl my internal deps the same way it did a great job at constructing the third party dep tree. One other detail I should mention is that I am setting up via single WORKSPACE file and not via bzlmod. If switching to bzlmod to manage 3rd party python dependencies magically fixes the internal dependency issue, then I will happily switch to that. Just holding off on that migration for now until I get some input here. Thanks!

@aignas
Copy link
Collaborator

aignas commented Nov 5, 2023

Could you please post a minimal reproduction for us to better understand why you need to add the gazelle directives? That is usually not needed.

@aignas aignas added the need: repro Needs a minimal reproduction label Nov 5, 2023
@FrankPortman
Copy link
Author

@aignas just wanted to acknowledge your comment - I appreciate you responding. I will try to come up with a reproducible example when I have a bit of downtime over the next week.

In the meantime, do you mind just confirming - if following the gazelle/autodeps instructions correctly, it should build manifests for not just third party libraries but also internal targets, is that correct? I might give it one more try on my $dayjob codebase - perhaps using bzlmod, which I wasn't before - before trying to make a standalone reproducible example.

Copy link

github-actions bot commented May 5, 2024

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_python!

@github-actions github-actions bot added the Can Close? Will close in 30 days if there is no new activity label May 5, 2024
@aignas aignas added the gazelle Gazelle plugin related issues label Jun 4, 2024
@aignas
Copy link
Collaborator

aignas commented Jun 4, 2024

#1842 could be something that may be useful once you try this again. Closing this as there are plenty of users using the plugin with internal and external dependencies and we have test coverage for the feature working, so it's likely a setup issue.

@aignas aignas closed this as not planned Won't fix, can't repro, duplicate, stale Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can Close? Will close in 30 days if there is no new activity gazelle Gazelle plugin related issues need: repro Needs a minimal reproduction
Projects
None yet
Development

No branches or pull requests

3 participants