Skip to content

[Feature Request] gazelle python file generation mode #1323

@mark64

Description

@mark64

🚀 feature request

Relevant Rules

gazelle python BUILD file generator.

Description

I have a repo organized as follows:

  • a
    • b
      • d
        • e.py
    • c.py
    • f.py
    • m
      • n.py
      • o.py
      • p.py

I'd like to generate BUILD files that have an individual py_library for each python file. As I understand it, the existing package generation mode will make py_librarys for //a:a, //a:b, //a/b:d, and //a:m in the example above.

Instead, I'd like a file generation mode that makes py_librarys for //a:c, //a/b/d:e, //a:f, //a/m:n, //a/m:o, //a/m:p. This would let me preserve the existing repo structure and file imports in different files (from a.b.d import e).

Describe the solution you'd like

See above.

With enough pointers I could potentially take on the modifications, but wondering if there's reasons this isn't implemented.

Describe alternatives you've considered

I could reorganize my imports to match what the existing package rules expect. However, that would be a huge undertaking and break our existing Pants BUILD rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions