Skip to content

Commit

Permalink
Add experimental lockfile support to IPython, Pytest, and Pylint (#12491
Browse files Browse the repository at this point in the history
)

### Shading

These tools all run with user requirements. As before, we combine the "tool pex" with the user requirements pex via `--pex-path`.

I thought that tool lockfiles would cause issues that it's likely for the tool requirements to conflict with the user requirements. But turns out, this has always been the case in Python land. Before, the tool would still have pinned deps in its PEX file, only, those pins might float over time without a lockfile. This PR changes nothing in terms of the need for shading (#9206).

### Performance concerns

As with Flake8, Bandit, and Setuptools, we must consult the codebase to determine which interpreter constraints the tool will be run with. This does have a performance hit, especially for generating Pytest's lockfile because we must consider the transitive deps of each `python_tests` target. 

There are four proposals floating to improve the performance. All are compatible with the others:

1. When generating the lockfile via `./pants tool-lock`, continue to inspect the whole repo. But when checking at call sites if the lockfile is stale, only inspect the code in question: create what the `PythonToolLockfile` would be if it were just for that code, and ensure the ICs are compatible w/ the checked-in file.
2. Stop treating the IC field as the constraints for the source itself, and start treating it as constraints for the whole transitive closure. This would allow us to look only at the target roots, w/o needing to resolve transitive dependencies.
3. Allow repos to opt-out of mixed interpreter constraints and only set ICs via `[python-setup].interpreter_constraints` (#12495). This has no impact if you are using mixed ICs, but greatly speeds things up for other repos not using the mechanism.
4. Add an ignore option to our check for stale lockfiles. Users could risk ignoring for desktop builds, and then error in CI.

For now, this PR provides a common denominator.
  • Loading branch information
Eric-Arellano authored Aug 6, 2021
1 parent e690b2f commit 8cae241
Show file tree
Hide file tree
Showing 30 changed files with 1,143 additions and 94 deletions.
4 changes: 2 additions & 2 deletions 3rdparty/python/lockfiles/flake8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ typing-extensions==3.10.0.0 ; python_version == '3.7' \
--hash=sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342 \
--hash=sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84
# via importlib-metadata
zipp==3.5.0 \
zipp==3.5.0 ; python_version == '3.7' \
--hash=sha256:957cfda87797e389580cb8b9e3870841ca991e2125350677b2ca83a0e99390a3 \
--hash=sha256:f5812b1e007e48cff63449a5e9f4e7ebea716b4111f9c4f9a645f91d579bf0c4
# via importlib-metadata
Expand All @@ -61,4 +61,4 @@ zipp==3.5.0 \
setuptools==57.4.0 ; python_version > "2.7" \
--hash=sha256:6bac238ffdf24e8806c61440e755192470352850f3419a52f26ffe0a1a64f465 \
--hash=sha256:a49230977aa6cfb9d933614d2f7b79036e9945c4cdd7583163f4e920b83418d6
# via -r reqs.txt
# via -r reqs.txt
222 changes: 222 additions & 0 deletions 3rdparty/python/lockfiles/pytest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
# This lockfile was autogenerated by Pants. To regenerate, run:
#
# build-support/bin/generate_all_lockfiles.sh
#
# You MUST manually add back the `python_version` and `sys_platform` environment markers.
# --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
# invalidation digest: 1ee11fe335a8425c80f54cb5879e7feb0e81c4de710883ed698e88f368f54427
# --- END PANTS LOCKFILE METADATA ---

#
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
#
# pip-compile --allow-unsafe --generate-hashes --output-file=3rdparty/python/lockfiles/pytest.txt reqs.txt
#
appnope==0.1.2 ; sys_platform == "darwin" \
--hash=sha256:93aa393e9d6c54c5cd570ccadd8edad61ea0c4b9ea7a01409020c9aa019eb442 \
--hash=sha256:dd83cd4b5b460958838f6eb3000c660b1f9caf2a5b1de4264e941512f603258a
# via ipython
attrs==21.2.0 \
--hash=sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1 \
--hash=sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb
# via pytest
backcall==0.2.0 \
--hash=sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e \
--hash=sha256:fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255
# via ipython
coverage==5.5 \
--hash=sha256:004d1880bed2d97151facef49f08e255a20ceb6f9432df75f4eef018fdd5a78c \
--hash=sha256:01d84219b5cdbfc8122223b39a954820929497a1cb1422824bb86b07b74594b6 \
--hash=sha256:040af6c32813fa3eae5305d53f18875bedd079960822ef8ec067a66dd8afcd45 \
--hash=sha256:06191eb60f8d8a5bc046f3799f8a07a2d7aefb9504b0209aff0b47298333302a \
--hash=sha256:13034c4409db851670bc9acd836243aeee299949bd5673e11844befcb0149f03 \
--hash=sha256:13c4ee887eca0f4c5a247b75398d4114c37882658300e153113dafb1d76de529 \
--hash=sha256:184a47bbe0aa6400ed2d41d8e9ed868b8205046518c52464fde713ea06e3a74a \
--hash=sha256:18ba8bbede96a2c3dde7b868de9dcbd55670690af0988713f0603f037848418a \
--hash=sha256:1aa846f56c3d49205c952d8318e76ccc2ae23303351d9270ab220004c580cfe2 \
--hash=sha256:217658ec7187497e3f3ebd901afdca1af062b42cfe3e0dafea4cced3983739f6 \
--hash=sha256:24d4a7de75446be83244eabbff746d66b9240ae020ced65d060815fac3423759 \
--hash=sha256:2910f4d36a6a9b4214bb7038d537f015346f413a975d57ca6b43bf23d6563b53 \
--hash=sha256:2949cad1c5208b8298d5686d5a85b66aae46d73eec2c3e08c817dd3513e5848a \
--hash=sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4 \
--hash=sha256:2cafbbb3af0733db200c9b5f798d18953b1a304d3f86a938367de1567f4b5bff \
--hash=sha256:2e0d881ad471768bf6e6c2bf905d183543f10098e3b3640fc029509530091502 \
--hash=sha256:30c77c1dc9f253283e34c27935fded5015f7d1abe83bc7821680ac444eaf7793 \
--hash=sha256:3487286bc29a5aa4b93a072e9592f22254291ce96a9fbc5251f566b6b7343cdb \
--hash=sha256:372da284cfd642d8e08ef606917846fa2ee350f64994bebfbd3afb0040436905 \
--hash=sha256:41179b8a845742d1eb60449bdb2992196e211341818565abded11cfa90efb821 \
--hash=sha256:44d654437b8ddd9eee7d1eaee28b7219bec228520ff809af170488fd2fed3e2b \
--hash=sha256:4a7697d8cb0f27399b0e393c0b90f0f1e40c82023ea4d45d22bce7032a5d7b81 \
--hash=sha256:51cb9476a3987c8967ebab3f0fe144819781fca264f57f89760037a2ea191cb0 \
--hash=sha256:52596d3d0e8bdf3af43db3e9ba8dcdaac724ba7b5ca3f6358529d56f7a166f8b \
--hash=sha256:53194af30d5bad77fcba80e23a1441c71abfb3e01192034f8246e0d8f99528f3 \
--hash=sha256:5fec2d43a2cc6965edc0bb9e83e1e4b557f76f843a77a2496cbe719583ce8184 \
--hash=sha256:6c90e11318f0d3c436a42409f2749ee1a115cd8b067d7f14c148f1ce5574d701 \
--hash=sha256:74d881fc777ebb11c63736622b60cb9e4aee5cace591ce274fb69e582a12a61a \
--hash=sha256:7501140f755b725495941b43347ba8a2777407fc7f250d4f5a7d2a1050ba8e82 \
--hash=sha256:796c9c3c79747146ebd278dbe1e5c5c05dd6b10cc3bcb8389dfdf844f3ead638 \
--hash=sha256:869a64f53488f40fa5b5b9dcb9e9b2962a66a87dab37790f3fcfb5144b996ef5 \
--hash=sha256:8963a499849a1fc54b35b1c9f162f4108017b2e6db2c46c1bed93a72262ed083 \
--hash=sha256:8d0a0725ad7c1a0bcd8d1b437e191107d457e2ec1084b9f190630a4fb1af78e6 \
--hash=sha256:900fbf7759501bc7807fd6638c947d7a831fc9fdf742dc10f02956ff7220fa90 \
--hash=sha256:92b017ce34b68a7d67bd6d117e6d443a9bf63a2ecf8567bb3d8c6c7bc5014465 \
--hash=sha256:970284a88b99673ccb2e4e334cfb38a10aab7cd44f7457564d11898a74b62d0a \
--hash=sha256:972c85d205b51e30e59525694670de6a8a89691186012535f9d7dbaa230e42c3 \
--hash=sha256:9a1ef3b66e38ef8618ce5fdc7bea3d9f45f3624e2a66295eea5e57966c85909e \
--hash=sha256:af0e781009aaf59e25c5a678122391cb0f345ac0ec272c7961dc5455e1c40066 \
--hash=sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf \
--hash=sha256:b7895207b4c843c76a25ab8c1e866261bcfe27bfaa20c192de5190121770672b \
--hash=sha256:c0891a6a97b09c1f3e073a890514d5012eb256845c451bd48f7968ef939bf4ae \
--hash=sha256:c2723d347ab06e7ddad1a58b2a821218239249a9e4365eaff6649d31180c1669 \
--hash=sha256:d1f8bf7b90ba55699b3a5e44930e93ff0189aa27186e96071fac7dd0d06a1873 \
--hash=sha256:d1f9ce122f83b2305592c11d64f181b87153fc2c2bbd3bb4a3dde8303cfb1a6b \
--hash=sha256:d314ed732c25d29775e84a960c3c60808b682c08d86602ec2c3008e1202e3bb6 \
--hash=sha256:d636598c8305e1f90b439dbf4f66437de4a5e3c31fdf47ad29542478c8508bbb \
--hash=sha256:deee1077aae10d8fa88cb02c845cfba9b62c55e1183f52f6ae6a2df6a2187160 \
--hash=sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c \
--hash=sha256:f030f8873312a16414c0d8e1a1ddff2d3235655a2174e3648b4fa66b3f2f1079 \
--hash=sha256:f0b278ce10936db1a37e6954e15a3730bea96a0997c26d7fee88e6c396c2086d \
--hash=sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6
# via pytest-cov
decorator==5.0.9 \
--hash=sha256:6e5c199c16f7a9f0e3a61a4a54b3d27e7dad0dbdde92b944426cb20914376323 \
--hash=sha256:72ecfba4320a893c53f9706bebb2d55c270c1e51a28789361aa93e4a21319ed5
# via
# ipdb
# ipython
icdiff==2.0.4 \
--hash=sha256:c72572e5ce087bc7a7748af2664764d4a805897caeefb665bdc12677fefb2212
# via pytest-icdiff
importlib-metadata==4.6.3 ; python_version == '3.7' \
--hash=sha256:0645585859e9a6689c523927a5032f2ba5919f1f7d0e84bd4533312320de1ff9 \
--hash=sha256:51c6635429c77cf1ae634c997ff9e53ca3438b495f10a55ba28594dd69764a8b
# via
# pluggy
# pytest
iniconfig==1.1.1 \
--hash=sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3 \
--hash=sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32
# via pytest
ipdb==0.13.9 \
--hash=sha256:951bd9a64731c444fd907a5ce268543020086a697f6be08f7cc2c9a752a278c5
# via -r reqs.txt
ipython==7.26.0 \
--hash=sha256:0cff04bb042800129348701f7bd68a430a844e8fb193979c08f6c99f28bb735e \
--hash=sha256:892743b65c21ed72b806a3a602cca408520b3200b89d1924f4b3d2cdb3692362
# via ipdb
ipython-genutils==0.2.0 \
--hash=sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8 \
--hash=sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8
# via traitlets
jedi==0.18.0 \
--hash=sha256:18456d83f65f400ab0c2d3319e48520420ef43b23a086fdc05dff34132f0fb93 \
--hash=sha256:92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707
# via ipython
matplotlib-inline==0.1.2 \
--hash=sha256:5cf1176f554abb4fa98cb362aa2b55c500147e4bdbb07e3fda359143e1da0811 \
--hash=sha256:f41d5ff73c9f5385775d5c0bc13b424535c8402fe70ea8210f93e11f3683993e
# via ipython
packaging==21.0 \
--hash=sha256:7dc96269f53a4ccec5c0670940a4281106dd0bb343f47b7471f779df49c2fbe7 \
--hash=sha256:c86254f9220d55e31cc94d69bade760f0847da8000def4dfe1c6b872fd14ff14
# via pytest
parso==0.8.2 \
--hash=sha256:12b83492c6239ce32ff5eed6d3639d6a536170723c6f3f1506869f1ace413398 \
--hash=sha256:a8c4922db71e4fdb90e0d0bc6e50f9b273d3397925e5e60a717e719201778d22
# via jedi
pexpect==4.8.0 \
--hash=sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937 \
--hash=sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c
# via ipython
pickleshare==0.7.5 \
--hash=sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca \
--hash=sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56
# via ipython
pluggy==0.13.1 \
--hash=sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0 \
--hash=sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d
# via pytest
pprintpp==0.4.0 \
--hash=sha256:b6b4dcdd0c0c0d75e4d7b2f21a9e933e5b2ce62b26e1a54537f9651ae5a5c01d \
--hash=sha256:ea826108e2c7f49dc6d66c752973c3fc9749142a798d6b254e1e301cfdbc6403
# via pytest-icdiff
prompt-toolkit==3.0.19 \
--hash=sha256:08360ee3a3148bdb5163621709ee322ec34fc4375099afa4bbf751e9b7b7fa4f \
--hash=sha256:7089d8d2938043508aa9420ec18ce0922885304cddae87fb96eebca942299f88
# via ipython
ptyprocess==0.7.0 \
--hash=sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35 \
--hash=sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220
# via pexpect
py==1.10.0 \
--hash=sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3 \
--hash=sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a
# via pytest
pygments==2.9.0 \
--hash=sha256:a18f47b506a429f6f4b9df81bb02beab9ca21d0a5fee38ed15aef65f0545519f \
--hash=sha256:d66e804411278594d764fc69ec36ec13d9ae9147193a1740cd34d272ca383b8e
# via
# -r reqs.txt
# ipython
pyparsing==2.4.7 \
--hash=sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1 \
--hash=sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b
# via packaging
pytest==6.2.4 \
--hash=sha256:50bcad0a0b9c5a72c8e4e7c9855a3ad496ca6a881a3641b4260605450772c54b \
--hash=sha256:91ef2131a9bd6be8f76f1f08eac5c5317221d6ad1e143ae03894b862e8976890
# via
# -r reqs.txt
# pytest-cov
# pytest-html
# pytest-icdiff
# pytest-metadata
pytest-cov==2.11.1 \
--hash=sha256:359952d9d39b9f822d9d29324483e7ba04a3a17dd7d05aa6beb7ea01e359e5f7 \
--hash=sha256:bdb9fdb0b85a7cc825269a4c56b48ccaa5c7e365054b6038772c32ddcdc969da
# via -r reqs.txt
pytest-html==3.1.1 \
--hash=sha256:3ee1cf319c913d19fe53aeb0bc400e7b0bc2dbeb477553733db1dad12eb75ee3 \
--hash=sha256:b7f82f123936a3f4d2950bc993c2c1ca09ce262c9ae12f9ac763a2401380b455
# via -r reqs.txt
pytest-icdiff==0.5 \
--hash=sha256:3a14097f4385665cb04330e6ae09a3dd430375f717e94482af6944470ad5f100
# via -r reqs.txt
pytest-metadata==1.11.0 \
--hash=sha256:576055b8336dd4a9006dd2a47615f76f2f8c30ab12b1b1c039d99e834583523f \
--hash=sha256:71b506d49d34e539cc3cfdb7ce2c5f072bea5c953320002c95968e0238f8ecf1
# via pytest-html
toml==0.10.2 \
--hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \
--hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f
# via
# ipdb
# pytest
traitlets==5.0.5 \
--hash=sha256:178f4ce988f69189f7e523337a3e11d91c786ded9360174a3d9ca83e79bc5396 \
--hash=sha256:69ff3f9d5351f31a7ad80443c2674b7099df13cc41fc5fa6e2f6d3b0330b0426
# via
# ipython
# matplotlib-inline
typing-extensions==3.10.0.0 ; python_version == '3.7' \
--hash=sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497 \
--hash=sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342 \
--hash=sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84
# via importlib-metadata
wcwidth==0.2.5 \
--hash=sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784 \
--hash=sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83
# via prompt-toolkit
zipp==3.5.0 ; python_version == '3.7' \
--hash=sha256:957cfda87797e389580cb8b9e3870841ca991e2125350677b2ca83a0e99390a3 \
--hash=sha256:f5812b1e007e48cff63449a5e9f4e7ebea716b4111f9c4f9a645f91d579bf0c4
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
setuptools==57.4.0 \
--hash=sha256:6bac238ffdf24e8806c61440e755192470352850f3419a52f26ffe0a1a64f465 \
--hash=sha256:a49230977aa6cfb9d933614d2f7b79036e9945c4cdd7583163f4e920b83418d6
# via
# ipdb
# ipython
2 changes: 1 addition & 1 deletion 3rdparty/python/lockfiles/user_reqs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
#
# pip-compile --allow-unsafe --generate-hashes --output-file=3rdparty/python/lockfile.txt reqs.txt
# pip-compile --allow-unsafe --generate-hashes --output-file=3rdparty/python/lockfiles/user_reqs.txt reqs.txt
#
ansicolors==1.1.8 \
--hash=sha256:00d2dde5a675579325902536738dd27e4fac1fd68f773fe36c21044eb559e187 \
Expand Down
20 changes: 18 additions & 2 deletions build-support/bin/_generate_all_lockfiles_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
from pants.backend.python.lint.docformatter.subsystem import Docformatter
from pants.backend.python.lint.flake8.subsystem import Flake8
from pants.backend.python.lint.isort.subsystem import Isort
from pants.backend.python.lint.pylint.subsystem import Pylint
from pants.backend.python.lint.yapf.subsystem import Yapf
from pants.backend.python.subsystems.ipython import IPython
from pants.backend.python.subsystems.pytest import PyTest
from pants.backend.python.subsystems.setuptools import Setuptools
from pants.python.python_setup import PythonSetup

Expand Down Expand Up @@ -90,12 +93,21 @@ def main() -> None:
f"--isort-extra-requirements={repr(Isort.default_extra_requirements)}",
f"--isort-interpreter-constraints={repr(Isort.default_interpreter_constraints)}",
f"--isort-experimental-lockfile={Isort.default_lockfile_path}",
# Pylint.
"--backend-packages=+['pants.backend.python.lint.pylint']",
f"--pylint-version={Pylint.default_version}",
f"--pylint-extra-requirements={repr(Pylint.default_extra_requirements)}",
f"--pylint-experimental-lockfile={Pylint.default_lockfile_path}",
# Yapf.
"--backend-packages=+['pants.backend.python.lint.yapf']",
f"--yapf-version={Yapf.default_version}",
f"--yapf-extra-requirements={repr(Yapf.default_extra_requirements)}",
f"--yapf-interpreter-constraints={repr(Yapf.default_interpreter_constraints)}",
f"--yapf-experimental-lockfile={Yapf.default_lockfile_path}",
# IPython.
f"--ipython-version={IPython.default_version}",
f"--ipython-extra-requirements={repr(IPython.default_extra_requirements)}",
f"--ipython-experimental-lockfile={IPython.default_lockfile_path}",
# Setuptools.
f"--setuptools-version={Setuptools.default_version}",
f"--setuptools-extra-requirements={repr(Setuptools.default_extra_requirements)}",
Expand All @@ -112,6 +124,10 @@ def main() -> None:
f"--lambdex-extra-requirements={repr(Lambdex.default_extra_requirements)}",
f"--lambdex-interpreter-constraints={repr(Lambdex.default_interpreter_constraints)}",
f"--lambdex-experimental-lockfile={Lambdex.default_lockfile_path}",
# Pytest
f"--pytest-version={PyTest.default_version}",
f"--pytest-extra-requirements={repr(PyTest.default_extra_requirements)}",
f"--pytest-experimental-lockfile={PyTest.default_lockfile_path}",
# Coverage.py
f"--coverage-py-version={CoverageSubsystem.default_version}",
f"--coverage-py-extra-requirements={repr(CoverageSubsystem.default_extra_requirements)}",
Expand All @@ -124,8 +140,8 @@ def main() -> None:
)

logger.warning(
"Please fix Black and Flake8 to use environment markers like it was before. (This will "
"be automated.)"
"Please fix Black, Pytest, Flake8, and iPython to use environment markers like it was "
"before. (This will be automated.)"
)


Expand Down
4 changes: 4 additions & 0 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ experimental_lockfile = "3rdparty/python/lockfiles/user_reqs.txt"
experimental_lockfile_custom_regeneration_command = "build-support/bin/generate_all_lockfiles.sh"
interpreter_constraints = [">=3.7,<3.10"]

[ipython]
experimental_lockfile = "<default>"

[black]
experimental_lockfile = "<default>"

Expand Down Expand Up @@ -157,6 +160,7 @@ extra_requirements.add = [
"pytest-icdiff",
"pygments",
]
experimental_lockfile = "3rdparty/python/lockfiles/pytest.txt"
timeout_default = 60

[test]
Expand Down
9 changes: 1 addition & 8 deletions src/python/pants/backend/python/goals/setup_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import Any, DefaultDict, Dict, List, Mapping, Set, Tuple, cast

from pants.backend.python.macros.python_artifact import PythonArtifact
from pants.backend.python.subsystems.setuptools import Setuptools
from pants.backend.python.subsystems.setuptools import PythonDistributionFieldSet, Setuptools
from pants.backend.python.target_types import (
PythonDistributionEntryPointsField,
PythonProvidesField,
Expand Down Expand Up @@ -163,13 +163,6 @@ class ExportedTargetRequirements(DeduplicatedCollection[str]):
sort_input = True


@dataclass(frozen=True)
class PythonDistributionFieldSet(PackageFieldSet):
required_fields = (PythonProvidesField,)

provides: PythonProvidesField


@dataclass(frozen=True)
class SetupPySourcesRequest:
targets: Targets
Expand Down
17 changes: 1 addition & 16 deletions src/python/pants/backend/python/lint/bandit/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
from dataclasses import dataclass
from typing import Tuple

from pants.backend.python.lint.bandit.skip_field import SkipBanditField
from pants.backend.python.lint.bandit.subsystem import Bandit
from pants.backend.python.target_types import InterpreterConstraintsField, PythonSources
from pants.backend.python.lint.bandit.subsystem import Bandit, BanditFieldSet
from pants.backend.python.util_rules import pex
from pants.backend.python.util_rules.interpreter_constraints import InterpreterConstraints
from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess
Expand All @@ -16,25 +14,12 @@
from pants.engine.fs import CreateDigest, Digest, Directory, MergeDigests, RemovePrefix
from pants.engine.process import FallibleProcessResult
from pants.engine.rules import Get, MultiGet, collect_rules, rule
from pants.engine.target import FieldSet, Target
from pants.engine.unions import UnionRule
from pants.python.python_setup import PythonSetup
from pants.util.logging import LogLevel
from pants.util.strutil import pluralize


@dataclass(frozen=True)
class BanditFieldSet(FieldSet):
required_fields = (PythonSources,)

sources: PythonSources
interpreter_constraints: InterpreterConstraintsField

@classmethod
def opt_out(cls, tgt: Target) -> bool:
return tgt.get(SkipBanditField).value


class BanditRequest(LintRequest):
field_set_type = BanditFieldSet

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

import pytest

from pants.backend.python.lint.bandit.rules import BanditFieldSet, BanditRequest
from pants.backend.python.lint.bandit.rules import BanditRequest
from pants.backend.python.lint.bandit.rules import rules as bandit_rules
from pants.backend.python.lint.bandit.subsystem import BanditFieldSet
from pants.backend.python.target_types import PythonLibrary
from pants.core.goals.lint import LintResult, LintResults
from pants.core.util_rules import config_files, source_files
Expand Down
Loading

0 comments on commit 8cae241

Please sign in to comment.