8000 Support gazelle plugin when using bzlmod by aignas · Pull Request #961 · bazel-contrib/rules_python · GitHub
[go: up one dir, main page]

Skip to content

Support gazelle plugin when using bzlmod #961

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

Closed
wants to merge 8 commits into from

Conversation

aignas
Copy link
Collaborator
@aignas aignas commented Jan 2, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

gazelle does not work with rules_python when using bzlmod.

What is the new behavior?

gazelle works with rules_python when using bzlmod.

Does this PR introduce a breaking change?

  • Yes
  • No

Change summary

  • Add gazelle target definition and fix bzlmod dependencies

    Since with bzlmod we have isolation of module workspace, we only need to add gazelle to the example and there is no need to setup the go toolchain, which is an improvement over non-bzlmod usage.

  • Add modules_map generation based on the whl list

    Even though I am changing the contents of the all_requirements and all_whl_requirements in bzlmod usecases, I believe these variables where not previously usable under bzlmod, so it should be fine.

  • Add gazelle_python_manifest generation to the example

    The manifest generation part did not need any changes.

  • Allow configuring the pip dependency naming convention

    This also allows us to support the multi-platform Python builds as described in https://www.youtube.com/watch?v=Bjaiu8tZZhs. The alias targets may be defined under //third_party/pip:$distribution_name$_pkg, so using the newly added gazelle directives allows the alias targets to be used by gazelle.

aignas added 3 commits January 2, 2023 18:19
Gazelle operates on plain strings and before we do any refactoring we
should start with the plain string of the requirement first. This shows,
that bzlmod and non-bzlmod usage of gazelle introduces differences in
BUILD.bazel files, but maybe this can be resolved later.
@aignas aignas marked this pull request as draft January 2, 2023 09:21
@aignas aignas marked this pull request as ready for review January 2, 2023 10:39
@aignas
Copy link
Collaborator Author
aignas commented Jan 3, 2023

Will split into multiple PRs with separate tests

@aignas aignas closed this Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0