Skip to content

Commit

Permalink
Upgrade default Flake8 version to 5.0 (pantsbuild#17226)
Browse files Browse the repository at this point in the history
Closes pantsbuild#17217.

[ci skip-rust]
  • Loading branch information
Eric-Arellano authored Oct 14, 2022
1 parent 00ff58d commit c1eebc9
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 152 deletions.
163 changes: 83 additions & 80 deletions 3rdparty/python/flake8.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build-support/bin/_generate_all_lockfiles_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def update_internal_lockfiles(specified: list[str] | None) -> None:
args = [
"./pants",
"--concurrent",
f"--python-interpreter-constraints={repr(PythonSetup.default_interpreter_constraints)}",
# `generate_all_lockfiles.sh` will have overridden this option to solve the chicken
# and egg problem from https://github.com/pantsbuild/pants/issues/12457. We must
# restore it here so that the lockfile gets generated properly.
Expand Down
2 changes: 1 addition & 1 deletion build-support/flake8/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ extend-ignore:

[flake8:local-plugins]
extension =
PANTSBIN = bin_name_checker:check_for_hardcoded_pants_bin_name
PNT10 = bin_name_checker:check_for_hardcoded_pants_bin_name
2 changes: 1 addition & 1 deletion build-support/flake8/bin_name_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def visit_Constant(self, node: ast.Constant) -> None:
yield (
lineno,
colno,
"PANTSBIN Don't hardcode `./pants`, use `from pants.util.docutil.bin_name` instead",
"PNT10 Don't hardcode `./pants`, use `from pants.util.docutil.bin_name` instead",
None,
)

Expand Down
4 changes: 2 additions & 2 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ args = ["--wrap-summaries=100", "--wrap-descriptions=100"]
[flake8]
config = "build-support/flake8/.flake8"
extra_requirements.add = [
"flake8-2020>=1.6.0,<1.7.0",
"flake8-2020>=1.7.0,<2",
"flake8-no-implicit-concat",
"flake8-comprehensions>=3.8.0,<4.0",
"flake8-comprehensions>=3.10.0,<4.0",
]
lockfile = "3rdparty/python/flake8.lock"
source_plugins = ["build-support/flake8"]
Expand Down
129 changes: 67 additions & 62 deletions src/python/pants/backend/python/lint/flake8/flake8.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
//
// --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
// {
// "version": 2,
// "version": 3,
// "valid_for_interpreter_constraints": [
// "CPython<4,>=3.7"
// ],
// "generated_with_requirements": [
// "flake8<4.0,>=3.9.2"
// ]
// "flake8<5.1,>=5.0.4"
// ],
// "manylinux": "manylinux2014",
// "requirement_constraints": [],
// "only_binary": [],
// "no_binary": []
// }
// --- END PANTS LOCKFILE METADATA ---

Expand All @@ -27,178 +31,179 @@
"artifacts": [
{
"algorithm": "sha256",
"hash": "bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907",
"url": "https://files.pythonhosted.org/packages/fc/80/35a0716e5d5101e643404dabd20f07f5528a21f3ef4032d31a49c913237b/flake8-3.9.2-py2.py3-none-any.whl"
"hash": "7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248",
"url": "https://files.pythonhosted.org/packages/cf/a0/b881b63a17a59d9d07f5c0cc91a29182c8e8a9aa2bde5b3b2b16519c02f4/flake8-5.0.4-py2.py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b",
"url": "https://files.pythonhosted.org/packages/9e/47/15b267dfe7e03dca4c4c06e7eadbd55ef4dfd368b13a0bab36d708b14366/flake8-3.9.2.tar.gz"
"hash": "6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db",
"url": "https://files.pythonhosted.org/packages/ad/00/9808c62b2d529cefc69ce4e4a1ea42c0f855effa55817b7327ec5b75e60a/flake8-5.0.4.tar.gz"
}
],
"project_name": "flake8",
"requires_dists": [
"configparser; python_version < \"3.2\"",
"enum34; python_version < \"3.4\"",
"functools32; python_version < \"3.2\"",
"importlib-metadata; python_version < \"3.8\"",
"mccabe<0.7.0,>=0.6.0",
"pycodestyle<2.8.0,>=2.7.0",
"pyflakes<2.4.0,>=2.3.0",
"typing; python_version < \"3.5\""
"importlib-metadata<4.3,>=1.1.0; python_version < \"3.8\"",
"mccabe<0.8.0,>=0.7.0",
"pycodestyle<2.10.0,>=2.9.0",
"pyflakes<2.6.0,>=2.5.0"
],
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7",
"version": "3.9.2"
"requires_python": ">=3.6.1",
"version": "5.0.4"
},
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "7401a975809ea1fdc658c3aa4f78cc2195a0e019c5cbc4c06122884e9ae80c23",
"url": "https://files.pythonhosted.org/packages/d2/a2/8c239dc898138f208dd14b441b196e7b3032b94d3137d9d8453e186967fc/importlib_metadata-4.12.0-py3-none-any.whl"
"hash": "057e92c15bc8d9e8109738a48db0ccb31b4d9d5cfbee5a8670879a30be66304b",
"url": "https://files.pythonhosted.org/packages/22/51/52442c59db26637681148c21f8984eed58c9db67053a0a4783a047010c98/importlib_metadata-4.2.0-py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "637245b8bab2b6502fcbc752cc4b7a6f6243bb02b31c5c26156ad103d3d45670",
"url": "https://files.pythonhosted.org/packages/1a/16/441080c907df829016729e71d8bdd42d99b9bdde48b01492ed08912c0aa9/importlib_metadata-4.12.0.tar.gz"
"hash": "b7e52a1f8dec14a75ea73e0891f3060099ca1d8e6a462a4dff11c3e119ea1b31",
"url": "https://files.pythonhosted.org/packages/c7/7c/126a8686399ebe256b5e4343ea80b6f2ee91549969da2eef0bb2891b8d24/importlib_metadata-4.2.0.tar.gz"
}
],
"project_name": "importlib-metadata",
"requires_dists": [
"flufl.flake8; extra == \"testing\"",
"importlib-resources>=1.3; python_version < \"3.9\" and extra == \"testing\"",
"ipython; extra == \"perf\"",
"jaraco.packaging>=9; extra == \"docs\"",
"jaraco.packaging>=8.2; extra == \"docs\"",
"packaging; extra == \"testing\"",
"pep517; extra == \"testing\"",
"pyfakefs; extra == \"testing\"",
"pytest-black>=0.3.7; platform_python_implementation != \"PyPy\" and extra == \"testing\"",
"pytest-black>=0.3.7; (platform_python_implementation != \"PyPy\" and python_version < \"3.10\") and extra == \"testing\"",
"pytest-checkdocs>=2.4; extra == \"testing\"",
"pytest-cov; extra == \"testing\"",
"pytest-enabler>=1.3; extra == \"testing\"",
"pytest-enabler>=1.0.1; extra == \"testing\"",
"pytest-flake8; extra == \"testing\"",
"pytest-mypy>=0.9.1; platform_python_implementation != \"PyPy\" and extra == \"testing\"",
"pytest-perf>=0.9.2; extra == \"testing\"",
"pytest>=6; extra == \"testing\"",
"pytest-mypy; (platform_python_implementation != \"PyPy\" and python_version < \"3.10\") and extra == \"testing\"",
"pytest>=4.6; extra == \"testing\"",
"rst.linker>=1.9; extra == \"docs\"",
"sphinx; extra == \"docs\"",
"typing-extensions>=3.6.4; python_version < \"3.8\"",
"zipp>=0.5"
],
"requires_python": ">=3.7",
"version": "4.12"
"requires_python": ">=3.6",
"version": "4.2"
},
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
"url": "https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl"
"hash": "6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e",
"url": "https://files.pythonhosted.org/packages/27/1a/1f68f9ba0c207934b35b86a8ca3aad8395a3d6dd7921c0686e23853ff5a9/mccabe-0.7.0-py2.py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f",
"url": "https://files.pythonhosted.org/packages/06/18/fa675aa501e11d6d6ca0ae73a101b2f3571a565e0f7d38e062eec18a91ee/mccabe-0.6.1.tar.gz"
"hash": "348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325",
"url": "https://files.pythonhosted.org/packages/e7/ff/0ffefdcac38932a54d2b5eed4e0ba8a408f215002cd178ad1df0f2806ff8/mccabe-0.7.0.tar.gz"
}
],
"project_name": "mccabe",
"requires_dists": [],
"requires_python": null,
"version": "0.6.1"
"requires_python": ">=3.6",
"version": "0.7"
},
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068",
"url": "https://files.pythonhosted.org/packages/de/cc/227251b1471f129bc35e966bb0fceb005969023926d744139642d847b7ae/pycodestyle-2.7.0-py2.py3-none-any.whl"
"hash": "d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b",
"url": "https://files.pythonhosted.org/packages/67/e4/fc77f1039c34b3612c4867b69cbb2b8a4e569720b1f19b0637002ee03aff/pycodestyle-2.9.1-py2.py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef",
"url": "https://files.pythonhosted.org/packages/02/b3/c832123f2699892c715fcdfebb1a8fdeffa11bb7b2350e46ecdd76b45a20/pycodestyle-2.7.0.tar.gz"
"hash": "2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785",
"url": "https://files.pythonhosted.org/packages/b6/83/5bcaedba1f47200f0665ceb07bcb00e2be123192742ee0edfb66b600e5fd/pycodestyle-2.9.1.tar.gz"
}
],
"project_name": "pycodestyle",
"requires_dists": [],
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
"version": "2.7"
"requires_python": ">=3.6",
"version": "2.9.1"
},
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "7893783d01b8a89811dd72d7dfd4d84ff098e5eed95cfa8905b22bbffe52efc3",
"url": "https://files.pythonhosted.org/packages/6c/11/2a745612f1d3cbbd9c69ba14b1b43a35a2f5c3c81cd0124508c52c64307f/pyflakes-2.3.1-py2.py3-none-any.whl"
"hash": "4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2",
"url": "https://files.pythonhosted.org/packages/dc/13/63178f59f74e53acc2165aee4b002619a3cfa7eeaeac989a9eb41edf364e/pyflakes-2.5.0-py2.py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db",
"url": "https://files.pythonhosted.org/packages/a8/0f/0dc480da9162749bf629dca76570972dd9cce5bedc60196a3c912875c87d/pyflakes-2.3.1.tar.gz"
"hash": "491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3",
"url": "https://files.pythonhosted.org/packages/07/92/f0cb5381f752e89a598dd2850941e7f570ac3cb8ea4a344854de486db152/pyflakes-2.5.0.tar.gz"
}
],
"project_name": "pyflakes",
"requires_dists": [],
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
"version": "2.3.1"
"requires_python": ">=3.6",
"version": "2.5"
},
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02",
"url": "https://files.pythonhosted.org/packages/ed/d6/2afc375a8d55b8be879d6b4986d4f69f01115e795e36827fd3a40166028b/typing_extensions-4.3.0-py3-none-any.whl"
"hash": "16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e",
"url": "https://files.pythonhosted.org/packages/0b/8e/f1a0a5a76cfef77e1eb6004cb49e5f8d72634da638420b9ea492ce8305e8/typing_extensions-4.4.0-py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6",
"url": "https://files.pythonhosted.org/packages/9e/1d/d128169ff58c501059330f1ad96ed62b79114a2eb30b8238af63a2e27f70/typing_extensions-4.3.0.tar.gz"
"hash": "1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa",
"url": "https://files.pythonhosted.org/packages/e3/a7/8f4e456ef0adac43f452efc2d0e4b242ab831297f1bac60ac815d37eb9cf/typing_extensions-4.4.0.tar.gz"
}
],
"project_name": "typing-extensions",
"requires_dists": [],
"requires_python": ">=3.7",
"version": "4.3"
"version": "4.4"
},
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "c4f6e5bbf48e74f7a38e7cc5b0480ff42b0ae5178957d564d18932525d5cf099",
"url": "https://files.pythonhosted.org/packages/80/0e/16a7ee38617aab6a624e95948d314097cc2669edae9b02ded53309941cfc/zipp-3.8.0-py3-none-any.whl"
"hash": "972cfa31bc2fedd3fa838a51e9bc7e64b7fb725a8c00e7431554311f180e9980",
"url": "https://files.pythonhosted.org/packages/09/85/302c153615db93e9197f13e02f448b3f95d7d786948f2fb3d6d5830a481b/zipp-3.9.0-py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "56bf8aadb83c24db6c4b577e13de374ccfb67da2078beba1d037c17980bf43ad",
"url": "https://files.pythonhosted.org/packages/cc/3c/3e8c69cd493297003da83f26ccf1faea5dd7da7892a0a7c965ac3bcba7bf/zipp-3.8.0.tar.gz"
"hash": "3a7af91c3db40ec72dd9d154ae18e008c69efe8ca88dde4f9a731bb82fe2f9eb",
"url": "https://files.pythonhosted.org/packages/41/2e/1341c5634c25e7254df01ec1f6cbd2bcdee3e647709e7c3647d1b362e3ac/zipp-3.9.0.tar.gz"
}
],
"project_name": "zipp",
"requires_dists": [
"flake8<5; extra == \"testing\"",
"func-timeout; extra == \"testing\"",
"furo; extra == \"docs\"",
"jaraco.functools; extra == \"testing\"",
"jaraco.itertools; extra == \"testing\"",
"jaraco.packaging>=9; extra == \"docs\"",
"jaraco.tidelift>=1.4; extra == \"docs\"",
"more-itertools; extra == \"testing\"",
"pytest-black>=0.3.7; platform_python_implementation != \"PyPy\" and extra == \"testing\"",
"pytest-checkdocs>=2.4; extra == \"testing\"",
"pytest-cov; extra == \"testing\"",
"pytest-enabler>=1.0.1; extra == \"testing\"",
"pytest-enabler>=1.3; extra == \"testing\"",
"pytest-flake8; extra == \"testing\"",
"pytest-mypy>=0.9.1; platform_python_implementation != \"PyPy\" and extra == \"testing\"",
"pytest>=6; extra == \"testing\"",
"rst.linker>=1.9; extra == \"docs\"",
"sphinx; extra == \"docs\""
"sphinx>=3.5; extra == \"docs\""
],
"requires_python": ">=3.7",
"version": "3.8"
"version": "3.9"
}
],
"platform_tag": null
}
],
"path_mappings": {},
"pex_version": "2.1.96",
"pex_version": "2.1.108",
"pip_version": "20.3.4-patched",
"prefer_older_binary": false,
"requirements": [
"flake8<4.0,>=3.9.2"
"flake8<5.1,>=5.0.4"
],
"requires_python": [
"<4,>=3.7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_uses_correct_python_version(rule_runner: RuleRunner) -> None:
),
}
)
extra_args = ["--flake8-lockfile=<none>"]
extra_args = ["--flake8-lockfile=<none>", "--flake8-version=flake8<4.0,>=3.9.2"]

py2_tgt = rule_runner.get_target(Address("", target_name="py2", relative_file_path="f.py"))
py2_result = run_flake8(rule_runner, [py2_tgt], extra_args=extra_args)
Expand Down Expand Up @@ -205,10 +205,8 @@ def test_3rdparty_plugin(rule_runner: RuleRunner) -> None:
rule_runner,
[tgt],
extra_args=[
"--flake8-extra-requirements=flake8-bandit==3.0.0",
# N.B.: Needed to workaround break cause by the 5.0.0 release as documented here:
# https://github.com/python/importlib_metadata/issues/406
"--flake8-extra-requirements=importlib-metadata==4.13.0",
"--flake8-extra-requirements=flake8-bandit==4.1.1",
"--flake8-extra-requirements=setuptools==65.5.0",
"--flake8-lockfile=<none>",
"--flake8-extra-files=['.bandit']",
],
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/python/lint/flake8/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Flake8(PythonToolBase):
name = "Flake8"
help = "The Flake8 Python linter (https://flake8.pycqa.org/)."

default_version = "flake8>=3.9.2,<4.0"
default_version = "flake8>=5.0.4,<5.1"
default_main = ConsoleScript("flake8")

register_lockfile = True
Expand Down

0 comments on commit c1eebc9

Please sign in to comment.