-
Notifications
You must be signed in to change notification settings - Fork 543
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
ruff
package does not have an entrypoint generated for it
#1000
Comments
Just encountered this as well. I assume this require fixup in the |
I ran into a similar problem with |
To add some context from the maturin side: maturin doesn't use entrypoints (such as |
About this, for anyone else who finds themselves here, the answer is sorta yes - with one of the approaches from here depending on rules_python version, and then something like package_annotation(
additive_build_content="""
filegroup(
name = "ruff_binary",
srcs = ["bin/ruff"],
)
""",
data = [":ruff_binary"],
patches = ["//path/to/patch:ruff__bin_path.patch"],
patch_args = ["-p1"],
) and the patch being something like diff --git a/ruff/__main__.py b/ruff/__main__.py
index 44384bc..192266e 100644
--- a/ruff/__main__.py
+++ b/ruff/__main__.py
@@ -7,27 +7,11 @@ from pathlib import Path
def find_ruff_bin() -> Path:
"""Return the ruff binary path."""
+ path = Path(__file__).parent.parent.parent / "bin/ruff"
+ if not path.is_file():
+ raise FileNotFoundError(path)
- ruff_exe = "ruff" + sysconfig.get_config_var("EXE")
-
- path = Path(sysconfig.get_path("scripts")) / ruff_exe
- if path.is_file():
- return path
-
- if sys.version_info >= (3, 10):
- user_scheme = sysconfig.get_preferred_scheme("user")
- elif os.name == "nt":
- user_scheme = "nt_user"
- elif sys.platform == "darwin" and sys._framework:
- user_scheme = "osx_framework_user"
- else:
- user_scheme = "posix_user"
-
- path = Path(sysconfig.get_path("scripts", scheme=user_scheme)) / ruff_exe
- if path.is_file():
- return path
-
- raise FileNotFoundError(path)
+ return path
if __name__ == "__main__": |
I think this might be fixed by #1730 |
🐞 bug report
Affected Rule
The issue is caused by the rule:Is this a regression?
I don't know.
Description
A clear and concise description of the problem...rules_python
does not generate an entry point for theruff
package.🔬 Minimal Reproduction
https://github.com/lopopolo/ruff_entry_point_reproducer
🔥 Exception or Error
the results of the suggested query:
There is no entrypoint in the target list.
🌍 Your Environment
Operating System:
Output of
bazel version
:Rules_python version:
Anything else relevant?
ruff is almost entirely written in Rust. The python package only contains an empty
__init__.py
and a__main__.py
which invokes the embeddedruff
binary: https://github.com/charliermarsh/ruff/tree/v0.0.228/python/ruffThe text was updated successfully, but these errors were encountered: