rules_py icon indicating copy to clipboard operation
rules_py copied to clipboard

[FR]: Support for pyi files?

Open antspy opened this issue 8 months ago • 3 comments

What is the current behavior?

Hi,

rules_python has support for pyi_srcs. I saw that however aspect rules_py does not have that. For the time being I am adding the .pyi files to the data field, but I wonder if adding pyi_srcs would be helpful?

Describe the feature

It would also be nice to allow aspect configure to understand .pyi files too and put them in the same library too.

Thank you!

antspy avatar May 09 '25 16:05 antspy

We need to revisit our py_library and consider whether we can consolidate it with rules_python.

arrdem avatar Jun 12 '25 18:06 arrdem

Hey @antspy, now that we've finally addressed some of the WORKSPACE tech debt and upgraded to a reasonable rules_python dep, this is on the table.

What behavior in particular are you looking for here? Are you just expecting that pyi files will get linked into a venv?

arrdem avatar Nov 05 '25 02:11 arrdem

Hi,

This came up because the proto compiler generates both .py files with no types and .pyi files with the actual types, so I need to deal with both of them. Running aspect configure does nothing for pyi files, so I had to manually add them to the data field.

In contrast, rules_python has an explicit pyi_srcs attribute one can use. So it would be nice if aspect rules python would also 'natively' understand pyi files, including support for aspect configure :)

Let me know if this makes sense!

antspy avatar Nov 05 '25 07:11 antspy