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

python_library_naming_convention Gazelle directive is ignored when python_generation_mode set to "file" #1677

Closed
yechuan51 opened this issue Jan 8, 2024 · 5 comments
Labels
Can Close? Will close in 30 days if there is no new activity gazelle Gazelle plugin related issues help wanted type: feature request

Comments

@yechuan51
Copy link

🐞 bug report

Affected Rule

rules_python

Is this a regression?

I tried earlier version of rules_python, but it appears that earlier version either don't support python_generation_mode=file or produce the same result.

Description

python_library_naming_convention appears to be ignored if python_generation_mode is set to "file" mode. When I set "python_library_naming_convention" to "$package_name$_lib" and "python_generation_mode" to "file", the generated python_library target is still "$package_name".

But once I remove "python_generation_mode" rule, the generated target shows up with the expected name(i.e. foo_lib).

🔬 Minimal Reproduction

I don't yet have the time to produce a minimal reproduction yet. But if needed, I can look into this.

It should be as simple as setting both directive and run Gazelle.

🔥 Exception or Error

python_library_naming_convention is ignored.

🌍 Your Environment

Operating System:

  
MacOS 14.1.2
  

Output of bazel version:

  
Build label: 7.0.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Dec 11 17:00:42 2023 (1702314042)
Build timestamp: 1702314042
Build timestamp as int: 1702314042
  

Rules_python version:

  
0.27.1
  

Anything else relevant?

@aryamccarthy
Copy link

This is also true about py_binary_naming_convention.

@aignas
Copy link
Collaborator

aignas commented Jan 16, 2024

Since in file mode we don't want to name the targets by the package name (we would have clashes if for more than one py_library or py_binary, we would need to add a new token for defining the convention to mean the src file. I think this ticket is a feature request and I am wondering if such a convention is really needed given the discussion in #1664.

@yechuan51 and @aryamccarthy, what are your thoughts? Is it still needed?

@aignas aignas added type: feature request help wanted gazelle Gazelle plugin related issues labels Jan 16, 2024
@yechuan51
Copy link
Author

@aignas

Thank you for the reply.

The issue with py_binary is not currently affecting me, I'm only finding it very inconvinient with the py_library targets. In my previous job, we would have per-file py_library targets with a $package_name$_lib naming convention. So with my current work I'm running Gazelle, and then manually updating the library target names with the _lib suffix.

I personally think that it would be a very useful feature to have for the per-file genertaion mode. Thank you!

Copy link

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 Jul 14, 2024
Copy link

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 13, 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 help wanted type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants