Skip to content

[pull] main from bazel-contrib:main#334

Merged
pull[bot] merged 2 commits intogarymm:mainfrom
bazel-contrib:main
Jul 15, 2025
Merged

[pull] main from bazel-contrib:main#334
pull[bot] merged 2 commits intogarymm:mainfrom
bazel-contrib:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Jul 15, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.3)

Can you help keep this open source service alive? 💖 Please sponsor : )

yushan26 and others added 2 commits July 14, 2025 23:51
…orts (#3077)

A python import may be imported as:
```
from foo.bar.application.\
    pipeline.model import (
    Baz
)
```
However, gazelle fails to resolve this import with the error:
`line 30: "foo.bar.application.pipeline.model\\\n pipeline.mode.Baz" is
an invalid dependency:`

Clean up the imports such that whitespace and \n are removed from the
import path.

---------

Co-authored-by: yushan <yushan@uber.com>
Co-authored-by: Douglas Thor <dougthor42@users.noreply.github.com>
Fixes #2994.

Please go over this with a fine-toothed comb! This is my first
contribution to `rules_python` / the gazelle plugin, and while I've
worked in Gazelle before, I'm pretty unfamiliar with the Python plugin's
architecture.

This adds support in the Gazelle plugin for generating
`py_proto_library` rules automatically, if there are any `proto_library`
rules detected in a given package. We do this via a new Gazelle
directive, `python_generate_proto`, which defaults to `true`, and
controls whether these rules are generated.

See the tests in `testdata/directive_python_generate_proto` for
examples.

By default, we source the `py_proto_library` rule from the `@protobuf`
repository. I think this the intended long-term home of the rule? Users
are expected to use `gazelle:map_kind` to change this if need be.

I haven't done anything here to support resolution of imports of
`py_proto_library`. I think this is worth landing first, to save folks
from having to maintain these by hand. But this should lay the
foundation for resolving that in
#1703.

---------

Co-authored-by: Douglas Thor <dougthor42@users.noreply.github.com>
@pull pull Bot locked and limited conversation to collaborators Jul 15, 2025
@pull pull Bot added the ⤵️ pull label Jul 15, 2025
@pull pull Bot merged commit dd6550f into garymm:main Jul 15, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants