Pants: Using a newer version of `pylint`

Created on 26 May 2021  路  2Comments  路  Source: pantsbuild/pants

I'm trying to use a newer version of pylint with Pants. Even though I've got pylint set to version 2.8.2 in requirements.txt/poetry.lock, it seems that it kept getting built with version >=2.4.4,<2.5. After looking around in the docs, I discovered that that's the default pylint version in Pants. There's apparently an option to set an alternative version in pants.toml, which I'm able to use to lint my codebase using a more recent version of pylint.

However, I'd like to understand:

  1. Why does Pants have a default version of pylint at all instead of always using the most recent version (or the version specified in e.g. requirements.txt)?
  2. Related to the previous question: what, if any, are the risks of using a newer pylint version in Pants?

Most helpful comment

Awesome, I'd love to submit a PR :)

All 2 comments

Hey @martimlobao, welcome! Good questions.

Why does Pants have a default version of pylint at all

Mostly for stability for users, that we want to avoid the problem of your CI breaking overnight because of a new release. If it's unconstrainted, it's more susceptible to breaking on you.

We periodically update the default version, though, and then indicate that in the changelog as a User API Change.

what, if any, are the risks of using a newer pylint version in Pants?

There shouldn't be :) In fact, we'd love a patch to update the default version of Pylint if you're interested! It's nothing more than updating this line to be >=2.8.2,<2.9

https://github.com/pantsbuild/pants/blob/955ee9509348b4d31395d03b145f410d0d3ba40d/src/python/pants/backend/python/lint/pylint/subsystem.py#L21

See https://www.pantsbuild.org/docs/contributor-overview for a contributor guide. You could skip the parts about building the rust engine and testing things locally, given that this is a one line change.

(No worries if not interested)

Awesome, I'd love to submit a PR :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pierrechevalier83 picture pierrechevalier83  路  4Comments

KLFrost picture KLFrost  路  4Comments

Eric-Arellano picture Eric-Arellano  路  7Comments

stuhood picture stuhood  路  4Comments

ns-cweber picture ns-cweber  路  7Comments