-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
pants seems only support an old verision of ruff, without understanding recent ruff config syntax #20707
Comments
Does |
in the lockfile it is ruff 0.3.4, which is expected version as I configed with pyproject.toml; running |
Please post the error message you're seeing. And even more helpful would be a small repo that reproduces the problem. Thanks! |
minimum reproducible example:
pyproject.toml
folder structure:
run
run
|
Hey @Sage0614, thanks for filing an issue and making a reproducer. Pants has default versions of each tool hard-coded to make it easy to get started (and pinned to a specific version for reproducibility and software supply-chain assurance), but, as you observe, this default version becomes outdated as tools release new versions. In the 2.19 release series, the default version is 0.1, but this has been updated in more recent ones (in 2.20.0, releasing soon, it's 0.2, and 2.21 has #20647 which updates to 0.3.0). However, no matter the Pants version, the default versions can be overridden, using a custom lockfile: https://www.pantsbuild.org/2.19/docs/python/overview/lockfiles#lockfiles-for-tools So, something like: [GLOBAL]
pants_version = "2.19.1"
backend_packages = ["pants.backend.python","pants.backend.experimental.python.lint.ruff"]
[python]
interpreter_constraints = [ '>=3.11,<3.12' ]
enable_resolves = true
[python.resolves]
ruff = "3rdparty/python/ruff.lock"
[ruff]
install_from_resolve = "ruff"
config_discovery = true This would then be combined with a BUILD file like: python_requirement(name="ruff", requirements=["ruff==0.3.4"], resolve="ruff") Let us know if this helps. |
the part I am missing is config [ruff] install_from_resolve option. add the configuration solve the problem. thanks! |
It's unfortunate that this wasn't more clear from the docs. Any thoughts on where specifically in the docs this information would have been helpful? |
I look at the doc again and both the lockfiles part and ruff options part does mentioned that install_from_resolve is needed, so it is more of ignorance from my side, where I assume set the lockfile alone would specify the version of the tool, I would say a more helpful way maybe is add an example config of non default tool to https://github.com/pantsbuild/example-python/blob/main/pants.toml, and have some comment about what it does. |
That sounds good. I think it's also unhelpful that we don't indicate the version of these tools anywhere in the docs pages, so I've filed #20722. |
Describe the bug
pants doens't recogize either syntax above, it seems only support ruff to a certain verison, which I didn't find the specific version it support in documentation.
Pants version
2.19.1
OS
linux
Additional info
Add any other information about the problem here, such as attachments or links to gists, if relevant.
The text was updated successfully, but these errors were encountered: