From fbc6a88b118dd65bbf2d6b8a8172a9d5a69005d3 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:32:48 +0900 Subject: [PATCH 01/40] feat(pypi): support env markers in python requirements files --- CHANGELOG.md | 3 + examples/bzlmod/MODULE.bazel | 3 +- examples/bzlmod/requirements.in | 1 - examples/bzlmod/requirements_lock_3_10.txt | 4 - examples/bzlmod/requirements_lock_3_9.txt | 4 - .../bzlmod/requirements_universal_3_10.txt | 470 ++++++++++++++++++ examples/bzlmod/requirements_windows_3_10.txt | 1 - examples/bzlmod/requirements_windows_3_9.txt | 1 - python/private/pypi/BUILD.bazel | 10 + python/private/pypi/evaluate_markers.bzl | 101 ++++ python/private/pypi/extension.bzl | 7 + python/private/pypi/parse_requirements.bzl | 32 +- .../resolve_target_platforms.py | 65 +++ .../parse_requirements_tests.bzl | 66 +++ 14 files changed, 752 insertions(+), 16 deletions(-) create mode 100644 examples/bzlmod/requirements_universal_3_10.txt create mode 100644 python/private/pypi/evaluate_markers.bzl create mode 100755 python/private/pypi/requirements_parser/resolve_target_platforms.py diff --git a/CHANGELOG.md b/CHANGELOG.md index d924f650ca..3252205f34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,9 @@ A brief description of the categories of changes: ([#2030](https://github.com/bazelbuild/rules_python/issues/2030)). * (pip) Fixed pypi parse_simpleapi_html function for feeds with package metadata containing ">" sign +* (pypi) Support env markers in requirements files. Note, that this means that + if your requirements files contain env markers, the Python interpreter will + have to be downloaded to re-evaluate the bzlmod extension. ### Added * Nothing yet diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel index 3da17a6eb2..5f7775d27e 100644 --- a/examples/bzlmod/MODULE.bazel +++ b/examples/bzlmod/MODULE.bazel @@ -179,8 +179,7 @@ pip.parse( ], hub_name = "pip", python_version = "3.10", - requirements_lock = "//:requirements_lock_3_10.txt", - requirements_windows = "//:requirements_windows_3_10.txt", + requirements_lock = "//:requirements_universal_3_10.txt", # These modifications were created above and we # are providing pip.parse with the label of the mod # and the name of the wheel. diff --git a/examples/bzlmod/requirements.in b/examples/bzlmod/requirements.in index a713577f55..39b05b7033 100644 --- a/examples/bzlmod/requirements.in +++ b/examples/bzlmod/requirements.in @@ -11,4 +11,3 @@ pylint-print python-dateutil>=2.8.2 sphinx sphinxcontrib-serializinghtml -colorama diff --git a/examples/bzlmod/requirements_lock_3_10.txt b/examples/bzlmod/requirements_lock_3_10.txt index ace879f38e..a279666b35 100644 --- a/examples/bzlmod/requirements_lock_3_10.txt +++ b/examples/bzlmod/requirements_lock_3_10.txt @@ -26,10 +26,6 @@ chardet==4.0.0 \ --hash=sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa \ --hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5 # via requests -colorama==0.4.6 \ - --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ - --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 - # via -r requirements.in dill==0.3.6 \ --hash=sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0 \ --hash=sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373 diff --git a/examples/bzlmod/requirements_lock_3_9.txt b/examples/bzlmod/requirements_lock_3_9.txt index e6aaa992fb..2c2a00672e 100644 --- a/examples/bzlmod/requirements_lock_3_9.txt +++ b/examples/bzlmod/requirements_lock_3_9.txt @@ -26,10 +26,6 @@ chardet==4.0.0 \ --hash=sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa \ --hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5 # via requests -colorama==0.4.6 \ - --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ - --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 - # via -r requirements.in dill==0.3.6 \ --hash=sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0 \ --hash=sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373 diff --git a/examples/bzlmod/requirements_universal_3_10.txt b/examples/bzlmod/requirements_universal_3_10.txt new file mode 100644 index 0000000000..c22c099704 --- /dev/null +++ b/examples/bzlmod/requirements_universal_3_10.txt @@ -0,0 +1,470 @@ +# +# This file is manually cobled by joining the two requirements lock files for +# 3.10 Python. Once the `uv` pip compile rule is complete, we should switch +# to that instead. +# +--extra-index-url https://pypi.org/simple/ + +alabaster==0.7.13 \ + --hash=sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3 \ + --hash=sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2 + # via sphinx +astroid==2.13.5 \ + --hash=sha256:6891f444625b6edb2ac798829b689e95297e100ddf89dbed5a8c610e34901501 \ + --hash=sha256:df164d5ac811b9f44105a72b8f9d5edfb7b5b2d7e979b04ea377a77b3229114a + # via pylint +babel==2.13.1 \ + --hash=sha256:33e0952d7dd6374af8dbf6768cc4ddf3ccfefc244f9986d4074704f2fbd18900 \ + --hash=sha256:7077a4984b02b6727ac10f1f7294484f737443d7e2e66c5e4380e41a3ae0b4ed + # via sphinx +certifi==2023.7.22 \ + --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 \ + --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9 + # via requests +chardet==4.0.0 \ + --hash=sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa \ + --hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5 + # via requests +colorama==0.4.6; os_name == "nt" \ + --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ + --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 + # via + # pylint + # sphinx +dill==0.3.6 \ + --hash=sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0 \ + --hash=sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373 + # via pylint +docutils==0.20.1 \ + --hash=sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6 \ + --hash=sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b + # via sphinx +idna==2.10 \ + --hash=sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6 \ + --hash=sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0 + # via requests +imagesize==1.4.1 \ + --hash=sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b \ + --hash=sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a + # via sphinx +isort==5.12.0 \ + --hash=sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504 \ + --hash=sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6 + # via pylint +jinja2==3.1.4 \ + --hash=sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369 \ + --hash=sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d + # via sphinx +lazy-object-proxy==1.9.0 \ + --hash=sha256:09763491ce220c0299688940f8dc2c5d05fd1f45af1e42e636b2e8b2303e4382 \ + --hash=sha256:0a891e4e41b54fd5b8313b96399f8b0e173bbbfc03c7631f01efbe29bb0bcf82 \ + --hash=sha256:189bbd5d41ae7a498397287c408617fe5c48633e7755287b21d741f7db2706a9 \ + --hash=sha256:18b78ec83edbbeb69efdc0e9c1cb41a3b1b1ed11ddd8ded602464c3fc6020494 \ + --hash=sha256:1aa3de4088c89a1b69f8ec0dcc169aa725b0ff017899ac568fe44ddc1396df46 \ + --hash=sha256:212774e4dfa851e74d393a2370871e174d7ff0ebc980907723bb67d25c8a7c30 \ + --hash=sha256:2d0daa332786cf3bb49e10dc6a17a52f6a8f9601b4cf5c295a4f85854d61de63 \ + --hash=sha256:5f83ac4d83ef0ab017683d715ed356e30dd48a93746309c8f3517e1287523ef4 \ + --hash=sha256:659fb5809fa4629b8a1ac5106f669cfc7bef26fbb389dda53b3e010d1ac4ebae \ + --hash=sha256:660c94ea760b3ce47d1855a30984c78327500493d396eac4dfd8bd82041b22be \ + --hash=sha256:66a3de4a3ec06cd8af3f61b8e1ec67614fbb7c995d02fa224813cb7afefee701 \ + --hash=sha256:721532711daa7db0d8b779b0bb0318fa87af1c10d7fe5e52ef30f8eff254d0cd \ + --hash=sha256:7322c3d6f1766d4ef1e51a465f47955f1e8123caee67dd641e67d539a534d006 \ + --hash=sha256:79a31b086e7e68b24b99b23d57723ef7e2c6d81ed21007b6281ebcd1688acb0a \ + --hash=sha256:81fc4d08b062b535d95c9ea70dbe8a335c45c04029878e62d744bdced5141586 \ + --hash=sha256:8fa02eaab317b1e9e03f69aab1f91e120e7899b392c4fc19807a8278a07a97e8 \ + --hash=sha256:9090d8e53235aa280fc9239a86ae3ea8ac58eff66a705fa6aa2ec4968b95c821 \ + --hash=sha256:946d27deaff6cf8452ed0dba83ba38839a87f4f7a9732e8f9fd4107b21e6ff07 \ + --hash=sha256:9990d8e71b9f6488e91ad25f322898c136b008d87bf852ff65391b004da5e17b \ + --hash=sha256:9cd077f3d04a58e83d04b20e334f678c2b0ff9879b9375ed107d5d07ff160171 \ + --hash=sha256:9e7551208b2aded9c1447453ee366f1c4070602b3d932ace044715d89666899b \ + --hash=sha256:9f5fa4a61ce2438267163891961cfd5e32ec97a2c444e5b842d574251ade27d2 \ + --hash=sha256:b40387277b0ed2d0602b8293b94d7257e17d1479e257b4de114ea11a8cb7f2d7 \ + --hash=sha256:bfb38f9ffb53b942f2b5954e0f610f1e721ccebe9cce9025a38c8ccf4a5183a4 \ + --hash=sha256:cbf9b082426036e19c6924a9ce90c740a9861e2bdc27a4834fd0a910742ac1e8 \ + --hash=sha256:d9e25ef10a39e8afe59a5c348a4dbf29b4868ab76269f81ce1674494e2565a6e \ + --hash=sha256:db1c1722726f47e10e0b5fdbf15ac3b8adb58c091d12b3ab713965795036985f \ + --hash=sha256:e7c21c95cae3c05c14aafffe2865bbd5e377cfc1348c4f7751d9dc9a48ca4bda \ + --hash=sha256:e8c6cfb338b133fbdbc5cfaa10fe3c6aeea827db80c978dbd13bc9dd8526b7d4 \ + --hash=sha256:ea806fd4c37bf7e7ad82537b0757999264d5f70c45468447bb2b91afdbe73a6e \ + --hash=sha256:edd20c5a55acb67c7ed471fa2b5fb66cb17f61430b7a6b9c3b4a1e40293b1671 \ + --hash=sha256:f0117049dd1d5635bbff65444496c90e0baa48ea405125c088e93d9cf4525b11 \ + --hash=sha256:f0705c376533ed2a9e5e97aacdbfe04cecd71e0aa84c7c0595d02ef93b6e4455 \ + --hash=sha256:f12ad7126ae0c98d601a7ee504c1122bcef553d1d5e0c3bfa77b16b3968d2734 \ + --hash=sha256:f2457189d8257dd41ae9b434ba33298aec198e30adf2dcdaaa3a28b9994f6adb \ + --hash=sha256:f699ac1c768270c9e384e4cbd268d6e67aebcfae6cd623b4d7c3bfde5a35db59 + # via astroid +markupsafe==2.1.3 \ + --hash=sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e \ + --hash=sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e \ + --hash=sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431 \ + --hash=sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686 \ + --hash=sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c \ + --hash=sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559 \ + --hash=sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc \ + --hash=sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb \ + --hash=sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939 \ + --hash=sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c \ + --hash=sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0 \ + --hash=sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4 \ + --hash=sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9 \ + --hash=sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575 \ + --hash=sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba \ + --hash=sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d \ + --hash=sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd \ + --hash=sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3 \ + --hash=sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00 \ + --hash=sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155 \ + --hash=sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac \ + --hash=sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52 \ + --hash=sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f \ + --hash=sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8 \ + --hash=sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b \ + --hash=sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007 \ + --hash=sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24 \ + --hash=sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea \ + --hash=sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198 \ + --hash=sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0 \ + --hash=sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee \ + --hash=sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be \ + --hash=sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2 \ + --hash=sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1 \ + --hash=sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707 \ + --hash=sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6 \ + --hash=sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c \ + --hash=sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58 \ + --hash=sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823 \ + --hash=sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779 \ + --hash=sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636 \ + --hash=sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c \ + --hash=sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad \ + --hash=sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee \ + --hash=sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc \ + --hash=sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2 \ + --hash=sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48 \ + --hash=sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7 \ + --hash=sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e \ + --hash=sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b \ + --hash=sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa \ + --hash=sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5 \ + --hash=sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e \ + --hash=sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb \ + --hash=sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9 \ + --hash=sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57 \ + --hash=sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc \ + --hash=sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc \ + --hash=sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2 \ + --hash=sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11 + # via jinja2 +mccabe==0.7.0 \ + --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ + --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e + # via pylint +packaging==23.2 \ + --hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \ + --hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 + # via sphinx +pathspec==0.11.1 \ + --hash=sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687 \ + --hash=sha256:d8af70af76652554bd134c22b3e8a1cc46ed7d91edcdd721ef1a0c51a84a5293 + # via yamllint +platformdirs==3.5.1 \ + --hash=sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f \ + --hash=sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5 + # via pylint +pygments==2.16.1 \ + --hash=sha256:13fc09fa63bc8d8671a6d247e1eb303c4b343eaee81d861f3404db2935653692 \ + --hash=sha256:1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29 + # via sphinx +pylint==2.15.10 \ + --hash=sha256:9df0d07e8948a1c3ffa3b6e2d7e6e63d9fb457c5da5b961ed63106594780cc7e \ + --hash=sha256:b3dc5ef7d33858f297ac0d06cc73862f01e4f2e74025ec3eff347ce0bc60baf5 + # via + # -r requirements.in + # pylint-print +pylint-print==1.0.1 \ + --hash=sha256:30aa207e9718ebf4ceb47fb87012092e6d8743aab932aa07aa14a73e750ad3d0 \ + --hash=sha256:a2b2599e7887b93e551db2624c523c1e6e9e58c3be8416cd98d41e4427e2669b + # via -r requirements.in +python-dateutil==2.8.2 \ + --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ + --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 + # via + # -r requirements.in + # s3cmd +python-magic==0.4.27 \ + --hash=sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b \ + --hash=sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3 + # via s3cmd +pyyaml==6.0 \ + --hash=sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf \ + --hash=sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293 \ + --hash=sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b \ + --hash=sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57 \ + --hash=sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b \ + --hash=sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4 \ + --hash=sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07 \ + --hash=sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba \ + --hash=sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9 \ + --hash=sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287 \ + --hash=sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513 \ + --hash=sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0 \ + --hash=sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782 \ + --hash=sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0 \ + --hash=sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92 \ + --hash=sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f \ + --hash=sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2 \ + --hash=sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc \ + --hash=sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1 \ + --hash=sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c \ + --hash=sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86 \ + --hash=sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4 \ + --hash=sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c \ + --hash=sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34 \ + --hash=sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b \ + --hash=sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d \ + --hash=sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c \ + --hash=sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb \ + --hash=sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7 \ + --hash=sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737 \ + --hash=sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3 \ + --hash=sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d \ + --hash=sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358 \ + --hash=sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53 \ + --hash=sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78 \ + --hash=sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803 \ + --hash=sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a \ + --hash=sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f \ + --hash=sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174 \ + --hash=sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5 + # via yamllint +requests==2.25.1 \ + --hash=sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804 \ + --hash=sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e + # via + # -r requirements.in + # sphinx +s3cmd==2.1.0 \ + --hash=sha256:49cd23d516b17974b22b611a95ce4d93fe326feaa07320bd1d234fed68cbccfa \ + --hash=sha256:966b0a494a916fc3b4324de38f089c86c70ee90e8e1cae6d59102103a4c0cc03 + # via -r requirements.in +six==1.16.0 \ + --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ + --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 + # via python-dateutil +snowballstemmer==2.2.0 \ + --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ + --hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a + # via sphinx +sphinx==7.2.6 \ + --hash=sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560 \ + --hash=sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5 + # via + # -r requirements.in + # sphinxcontrib-applehelp + # sphinxcontrib-devhelp + # sphinxcontrib-htmlhelp + # sphinxcontrib-qthelp + # sphinxcontrib-serializinghtml +sphinxcontrib-applehelp==1.0.7 \ + --hash=sha256:094c4d56209d1734e7d252f6e0b3ccc090bd52ee56807a5d9315b19c122ab15d \ + --hash=sha256:39fdc8d762d33b01a7d8f026a3b7d71563ea3b72787d5f00ad8465bd9d6dfbfa + # via sphinx +sphinxcontrib-devhelp==1.0.5 \ + --hash=sha256:63b41e0d38207ca40ebbeabcf4d8e51f76c03e78cd61abe118cf4435c73d4212 \ + --hash=sha256:fe8009aed765188f08fcaadbb3ea0d90ce8ae2d76710b7e29ea7d047177dae2f + # via sphinx +sphinxcontrib-htmlhelp==2.0.4 \ + --hash=sha256:6c26a118a05b76000738429b724a0568dbde5b72391a688577da08f11891092a \ + --hash=sha256:8001661c077a73c29beaf4a79968d0726103c5605e27db92b9ebed8bab1359e9 + # via sphinx +sphinxcontrib-jsmath==1.0.1 \ + --hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \ + --hash=sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8 + # via sphinx +sphinxcontrib-qthelp==1.0.6 \ + --hash=sha256:62b9d1a186ab7f5ee3356d906f648cacb7a6bdb94d201ee7adf26db55092982d \ + --hash=sha256:bf76886ee7470b934e363da7a954ea2825650013d367728588732c7350f49ea4 + # via sphinx +sphinxcontrib-serializinghtml==1.1.9 \ + --hash=sha256:0c64ff898339e1fac29abd2bf5f11078f3ec413cfe9c046d3120d7ca65530b54 \ + --hash=sha256:9b36e503703ff04f20e9675771df105e58aa029cfcbc23b8ed716019b7416ae1 + # via + # -r requirements.in + # sphinx +tabulate==0.9.0 \ + --hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \ + --hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f + # via -r requirements.in +tomli==2.0.1 \ + --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ + --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f + # via pylint +tomlkit==0.11.8 \ + --hash=sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171 \ + --hash=sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3 + # via pylint +typing-extensions==4.6.3 \ + --hash=sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26 \ + --hash=sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5 + # via astroid +urllib3==1.26.18 \ + --hash=sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07 \ + --hash=sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0 + # via requests +websockets==11.0.3 \ + --hash=sha256:01f5567d9cf6f502d655151645d4e8b72b453413d3819d2b6f1185abc23e82dd \ + --hash=sha256:03aae4edc0b1c68498f41a6772d80ac7c1e33c06c6ffa2ac1c27a07653e79d6f \ + --hash=sha256:0ac56b661e60edd453585f4bd68eb6a29ae25b5184fd5ba51e97652580458998 \ + --hash=sha256:0ee68fe502f9031f19d495dae2c268830df2760c0524cbac5d759921ba8c8e82 \ + --hash=sha256:1553cb82942b2a74dd9b15a018dce645d4e68674de2ca31ff13ebc2d9f283788 \ + --hash=sha256:1a073fc9ab1c8aff37c99f11f1641e16da517770e31a37265d2755282a5d28aa \ + --hash=sha256:1d2256283fa4b7f4c7d7d3e84dc2ece74d341bce57d5b9bf385df109c2a1a82f \ + --hash=sha256:1d5023a4b6a5b183dc838808087033ec5df77580485fc533e7dab2567851b0a4 \ + --hash=sha256:1fdf26fa8a6a592f8f9235285b8affa72748dc12e964a5518c6c5e8f916716f7 \ + --hash=sha256:2529338a6ff0eb0b50c7be33dc3d0e456381157a31eefc561771ee431134a97f \ + --hash=sha256:279e5de4671e79a9ac877427f4ac4ce93751b8823f276b681d04b2156713b9dd \ + --hash=sha256:2d903ad4419f5b472de90cd2d40384573b25da71e33519a67797de17ef849b69 \ + --hash=sha256:332d126167ddddec94597c2365537baf9ff62dfcc9db4266f263d455f2f031cb \ + --hash=sha256:34fd59a4ac42dff6d4681d8843217137f6bc85ed29722f2f7222bd619d15e95b \ + --hash=sha256:3580dd9c1ad0701169e4d6fc41e878ffe05e6bdcaf3c412f9d559389d0c9e016 \ + --hash=sha256:3ccc8a0c387629aec40f2fc9fdcb4b9d5431954f934da3eaf16cdc94f67dbfac \ + --hash=sha256:41f696ba95cd92dc047e46b41b26dd24518384749ed0d99bea0a941ca87404c4 \ + --hash=sha256:42cc5452a54a8e46a032521d7365da775823e21bfba2895fb7b77633cce031bb \ + --hash=sha256:4841ed00f1026dfbced6fca7d963c4e7043aa832648671b5138008dc5a8f6d99 \ + --hash=sha256:4b253869ea05a5a073ebfdcb5cb3b0266a57c3764cf6fe114e4cd90f4bfa5f5e \ + --hash=sha256:54c6e5b3d3a8936a4ab6870d46bdd6ec500ad62bde9e44462c32d18f1e9a8e54 \ + --hash=sha256:619d9f06372b3a42bc29d0cd0354c9bb9fb39c2cbc1a9c5025b4538738dbffaf \ + --hash=sha256:6505c1b31274723ccaf5f515c1824a4ad2f0d191cec942666b3d0f3aa4cb4007 \ + --hash=sha256:660e2d9068d2bedc0912af508f30bbeb505bbbf9774d98def45f68278cea20d3 \ + --hash=sha256:6681ba9e7f8f3b19440921e99efbb40fc89f26cd71bf539e45d8c8a25c976dc6 \ + --hash=sha256:68b977f21ce443d6d378dbd5ca38621755f2063d6fdb3335bda981d552cfff86 \ + --hash=sha256:69269f3a0b472e91125b503d3c0b3566bda26da0a3261c49f0027eb6075086d1 \ + --hash=sha256:6f1a3f10f836fab6ca6efa97bb952300b20ae56b409414ca85bff2ad241d2a61 \ + --hash=sha256:7622a89d696fc87af8e8d280d9b421db5133ef5b29d3f7a1ce9f1a7bf7fcfa11 \ + --hash=sha256:777354ee16f02f643a4c7f2b3eff8027a33c9861edc691a2003531f5da4f6bc8 \ + --hash=sha256:84d27a4832cc1a0ee07cdcf2b0629a8a72db73f4cf6de6f0904f6661227f256f \ + --hash=sha256:8531fdcad636d82c517b26a448dcfe62f720e1922b33c81ce695d0edb91eb931 \ + --hash=sha256:86d2a77fd490ae3ff6fae1c6ceaecad063d3cc2320b44377efdde79880e11526 \ + --hash=sha256:88fc51d9a26b10fc331be344f1781224a375b78488fc343620184e95a4b27016 \ + --hash=sha256:8a34e13a62a59c871064dfd8ffb150867e54291e46d4a7cf11d02c94a5275bae \ + --hash=sha256:8c82f11964f010053e13daafdc7154ce7385ecc538989a354ccc7067fd7028fd \ + --hash=sha256:92b2065d642bf8c0a82d59e59053dd2fdde64d4ed44efe4870fa816c1232647b \ + --hash=sha256:97b52894d948d2f6ea480171a27122d77af14ced35f62e5c892ca2fae9344311 \ + --hash=sha256:9d9acd80072abcc98bd2c86c3c9cd4ac2347b5a5a0cae7ed5c0ee5675f86d9af \ + --hash=sha256:9f59a3c656fef341a99e3d63189852be7084c0e54b75734cde571182c087b152 \ + --hash=sha256:aa5003845cdd21ac0dc6c9bf661c5beddd01116f6eb9eb3c8e272353d45b3288 \ + --hash=sha256:b16fff62b45eccb9c7abb18e60e7e446998093cdcb50fed33134b9b6878836de \ + --hash=sha256:b30c6590146e53149f04e85a6e4fcae068df4289e31e4aee1fdf56a0dead8f97 \ + --hash=sha256:b58cbf0697721120866820b89f93659abc31c1e876bf20d0b3d03cef14faf84d \ + --hash=sha256:b67c6f5e5a401fc56394f191f00f9b3811fe843ee93f4a70df3c389d1adf857d \ + --hash=sha256:bceab846bac555aff6427d060f2fcfff71042dba6f5fca7dc4f75cac815e57ca \ + --hash=sha256:bee9fcb41db2a23bed96c6b6ead6489702c12334ea20a297aa095ce6d31370d0 \ + --hash=sha256:c114e8da9b475739dde229fd3bc6b05a6537a88a578358bc8eb29b4030fac9c9 \ + --hash=sha256:c1f0524f203e3bd35149f12157438f406eff2e4fb30f71221c8a5eceb3617b6b \ + --hash=sha256:c792ea4eabc0159535608fc5658a74d1a81020eb35195dd63214dcf07556f67e \ + --hash=sha256:c7f3cb904cce8e1be667c7e6fef4516b98d1a6a0635a58a57528d577ac18a128 \ + --hash=sha256:d67ac60a307f760c6e65dad586f556dde58e683fab03323221a4e530ead6f74d \ + --hash=sha256:dcacf2c7a6c3a84e720d1bb2b543c675bf6c40e460300b628bab1b1efc7c034c \ + --hash=sha256:de36fe9c02995c7e6ae6efe2e205816f5f00c22fd1fbf343d4d18c3d5ceac2f5 \ + --hash=sha256:def07915168ac8f7853812cc593c71185a16216e9e4fa886358a17ed0fd9fcf6 \ + --hash=sha256:df41b9bc27c2c25b486bae7cf42fccdc52ff181c8c387bfd026624a491c2671b \ + --hash=sha256:e052b8467dd07d4943936009f46ae5ce7b908ddcac3fda581656b1b19c083d9b \ + --hash=sha256:e063b1865974611313a3849d43f2c3f5368093691349cf3c7c8f8f75ad7cb280 \ + --hash=sha256:e1459677e5d12be8bbc7584c35b992eea142911a6236a3278b9b5ce3326f282c \ + --hash=sha256:e1a99a7a71631f0efe727c10edfba09ea6bee4166a6f9c19aafb6c0b5917d09c \ + --hash=sha256:e590228200fcfc7e9109509e4d9125eace2042fd52b595dd22bbc34bb282307f \ + --hash=sha256:e6316827e3e79b7b8e7d8e3b08f4e331af91a48e794d5d8b099928b6f0b85f20 \ + --hash=sha256:e7837cb169eca3b3ae94cc5787c4fed99eef74c0ab9506756eea335e0d6f3ed8 \ + --hash=sha256:e848f46a58b9fcf3d06061d17be388caf70ea5b8cc3466251963c8345e13f7eb \ + --hash=sha256:ed058398f55163a79bb9f06a90ef9ccc063b204bb346c4de78efc5d15abfe602 \ + --hash=sha256:f2e58f2c36cc52d41f2659e4c0cbf7353e28c8c9e63e30d8c6d3494dc9fdedcf \ + --hash=sha256:f467ba0050b7de85016b43f5a22b46383ef004c4f672148a8abf32bc999a87f0 \ + --hash=sha256:f61bdb1df43dc9c131791fbc2355535f9024b9a04398d3bd0684fc16ab07df74 \ + --hash=sha256:fb06eea71a00a7af0ae6aefbb932fb8a7df3cb390cc217d51a9ad7343de1b8d0 \ + --hash=sha256:ffd7dcaf744f25f82190856bc26ed81721508fc5cbf2a330751e135ff1283564 + # via -r requirements.in +wheel==0.40.0 \ + --hash=sha256:cd1196f3faee2b31968d626e1731c94f99cbdb67cf5a46e4f5656cbee7738873 \ + --hash=sha256:d236b20e7cb522daf2390fa84c55eea81c5c30190f90f29ae2ca1ad8355bf247 + # via -r requirements.in +wrapt==1.15.0 \ + --hash=sha256:02fce1852f755f44f95af51f69d22e45080102e9d00258053b79367d07af39c0 \ + --hash=sha256:077ff0d1f9d9e4ce6476c1a924a3332452c1406e59d90a2cf24aeb29eeac9420 \ + --hash=sha256:078e2a1a86544e644a68422f881c48b84fef6d18f8c7a957ffd3f2e0a74a0d4a \ + --hash=sha256:0970ddb69bba00670e58955f8019bec4a42d1785db3faa043c33d81de2bf843c \ + --hash=sha256:1286eb30261894e4c70d124d44b7fd07825340869945c79d05bda53a40caa079 \ + --hash=sha256:21f6d9a0d5b3a207cdf7acf8e58d7d13d463e639f0c7e01d82cdb671e6cb7923 \ + --hash=sha256:230ae493696a371f1dbffaad3dafbb742a4d27a0afd2b1aecebe52b740167e7f \ + --hash=sha256:26458da5653aa5b3d8dc8b24192f574a58984c749401f98fff994d41d3f08da1 \ + --hash=sha256:2cf56d0e237280baed46f0b5316661da892565ff58309d4d2ed7dba763d984b8 \ + --hash=sha256:2e51de54d4fb8fb50d6ee8327f9828306a959ae394d3e01a1ba8b2f937747d86 \ + --hash=sha256:2fbfbca668dd15b744418265a9607baa970c347eefd0db6a518aaf0cfbd153c0 \ + --hash=sha256:38adf7198f8f154502883242f9fe7333ab05a5b02de7d83aa2d88ea621f13364 \ + --hash=sha256:3a8564f283394634a7a7054b7983e47dbf39c07712d7b177b37e03f2467a024e \ + --hash=sha256:3abbe948c3cbde2689370a262a8d04e32ec2dd4f27103669a45c6929bcdbfe7c \ + --hash=sha256:3bbe623731d03b186b3d6b0d6f51865bf598587c38d6f7b0be2e27414f7f214e \ + --hash=sha256:40737a081d7497efea35ab9304b829b857f21558acfc7b3272f908d33b0d9d4c \ + --hash=sha256:41d07d029dd4157ae27beab04d22b8e261eddfc6ecd64ff7000b10dc8b3a5727 \ + --hash=sha256:46ed616d5fb42f98630ed70c3529541408166c22cdfd4540b88d5f21006b0eff \ + --hash=sha256:493d389a2b63c88ad56cdc35d0fa5752daac56ca755805b1b0c530f785767d5e \ + --hash=sha256:4ff0d20f2e670800d3ed2b220d40984162089a6e2c9646fdb09b85e6f9a8fc29 \ + --hash=sha256:54accd4b8bc202966bafafd16e69da9d5640ff92389d33d28555c5fd4f25ccb7 \ + --hash=sha256:56374914b132c702aa9aa9959c550004b8847148f95e1b824772d453ac204a72 \ + --hash=sha256:578383d740457fa790fdf85e6d346fda1416a40549fe8db08e5e9bd281c6a475 \ + --hash=sha256:58d7a75d731e8c63614222bcb21dd992b4ab01a399f1f09dd82af17bbfc2368a \ + --hash=sha256:5c5aa28df055697d7c37d2099a7bc09f559d5053c3349b1ad0c39000e611d317 \ + --hash=sha256:5fc8e02f5984a55d2c653f5fea93531e9836abbd84342c1d1e17abc4a15084c2 \ + --hash=sha256:63424c681923b9f3bfbc5e3205aafe790904053d42ddcc08542181a30a7a51bd \ + --hash=sha256:64b1df0f83706b4ef4cfb4fb0e4c2669100fd7ecacfb59e091fad300d4e04640 \ + --hash=sha256:74934ebd71950e3db69960a7da29204f89624dde411afbfb3b4858c1409b1e98 \ + --hash=sha256:75669d77bb2c071333417617a235324a1618dba66f82a750362eccbe5b61d248 \ + --hash=sha256:75760a47c06b5974aa5e01949bf7e66d2af4d08cb8c1d6516af5e39595397f5e \ + --hash=sha256:76407ab327158c510f44ded207e2f76b657303e17cb7a572ffe2f5a8a48aa04d \ + --hash=sha256:76e9c727a874b4856d11a32fb0b389afc61ce8aaf281ada613713ddeadd1cfec \ + --hash=sha256:77d4c1b881076c3ba173484dfa53d3582c1c8ff1f914c6461ab70c8428b796c1 \ + --hash=sha256:780c82a41dc493b62fc5884fb1d3a3b81106642c5c5c78d6a0d4cbe96d62ba7e \ + --hash=sha256:7dc0713bf81287a00516ef43137273b23ee414fe41a3c14be10dd95ed98a2df9 \ + --hash=sha256:7eebcdbe3677e58dd4c0e03b4f2cfa346ed4049687d839adad68cc38bb559c92 \ + --hash=sha256:896689fddba4f23ef7c718279e42f8834041a21342d95e56922e1c10c0cc7afb \ + --hash=sha256:96177eb5645b1c6985f5c11d03fc2dbda9ad24ec0f3a46dcce91445747e15094 \ + --hash=sha256:96e25c8603a155559231c19c0349245eeb4ac0096fe3c1d0be5c47e075bd4f46 \ + --hash=sha256:9d37ac69edc5614b90516807de32d08cb8e7b12260a285ee330955604ed9dd29 \ + --hash=sha256:9ed6aa0726b9b60911f4aed8ec5b8dd7bf3491476015819f56473ffaef8959bd \ + --hash=sha256:a487f72a25904e2b4bbc0817ce7a8de94363bd7e79890510174da9d901c38705 \ + --hash=sha256:a4cbb9ff5795cd66f0066bdf5947f170f5d63a9274f99bdbca02fd973adcf2a8 \ + --hash=sha256:a74d56552ddbde46c246b5b89199cb3fd182f9c346c784e1a93e4dc3f5ec9975 \ + --hash=sha256:a89ce3fd220ff144bd9d54da333ec0de0399b52c9ac3d2ce34b569cf1a5748fb \ + --hash=sha256:abd52a09d03adf9c763d706df707c343293d5d106aea53483e0ec8d9e310ad5e \ + --hash=sha256:abd8f36c99512755b8456047b7be10372fca271bf1467a1caa88db991e7c421b \ + --hash=sha256:af5bd9ccb188f6a5fdda9f1f09d9f4c86cc8a539bd48a0bfdc97723970348418 \ + --hash=sha256:b02f21c1e2074943312d03d243ac4388319f2456576b2c6023041c4d57cd7019 \ + --hash=sha256:b06fa97478a5f478fb05e1980980a7cdf2712015493b44d0c87606c1513ed5b1 \ + --hash=sha256:b0724f05c396b0a4c36a3226c31648385deb6a65d8992644c12a4963c70326ba \ + --hash=sha256:b130fe77361d6771ecf5a219d8e0817d61b236b7d8b37cc045172e574ed219e6 \ + --hash=sha256:b56d5519e470d3f2fe4aa7585f0632b060d532d0696c5bdfb5e8319e1d0f69a2 \ + --hash=sha256:b67b819628e3b748fd3c2192c15fb951f549d0f47c0449af0764d7647302fda3 \ + --hash=sha256:ba1711cda2d30634a7e452fc79eabcadaffedf241ff206db2ee93dd2c89a60e7 \ + --hash=sha256:bbeccb1aa40ab88cd29e6c7d8585582c99548f55f9b2581dfc5ba68c59a85752 \ + --hash=sha256:bd84395aab8e4d36263cd1b9308cd504f6cf713b7d6d3ce25ea55670baec5416 \ + --hash=sha256:c99f4309f5145b93eca6e35ac1a988f0dc0a7ccf9ccdcd78d3c0adf57224e62f \ + --hash=sha256:ca1cccf838cd28d5a0883b342474c630ac48cac5df0ee6eacc9c7290f76b11c1 \ + --hash=sha256:cd525e0e52a5ff16653a3fc9e3dd827981917d34996600bbc34c05d048ca35cc \ + --hash=sha256:cdb4f085756c96a3af04e6eca7f08b1345e94b53af8921b25c72f096e704e145 \ + --hash=sha256:ce42618f67741d4697684e501ef02f29e758a123aa2d669e2d964ff734ee00ee \ + --hash=sha256:d06730c6aed78cee4126234cf2d071e01b44b915e725a6cb439a879ec9754a3a \ + --hash=sha256:d5fe3e099cf07d0fb5a1e23d399e5d4d1ca3e6dfcbe5c8570ccff3e9208274f7 \ + --hash=sha256:d6bcbfc99f55655c3d93feb7ef3800bd5bbe963a755687cbf1f490a71fb7794b \ + --hash=sha256:d787272ed958a05b2c86311d3a4135d3c2aeea4fc655705f074130aa57d71653 \ + --hash=sha256:e169e957c33576f47e21864cf3fc9ff47c223a4ebca8960079b8bd36cb014fd0 \ + --hash=sha256:e20076a211cd6f9b44a6be58f7eeafa7ab5720eb796975d0c03f05b47d89eb90 \ + --hash=sha256:e826aadda3cae59295b95343db8f3d965fb31059da7de01ee8d1c40a60398b29 \ + --hash=sha256:eef4d64c650f33347c1f9266fa5ae001440b232ad9b98f1f43dfe7a79435c0a6 \ + --hash=sha256:f2e69b3ed24544b0d3dbe2c5c0ba5153ce50dcebb576fdc4696d52aa22db6034 \ + --hash=sha256:f87ec75864c37c4c6cb908d282e1969e79763e0d9becdfe9fe5473b7bb1e5f09 \ + --hash=sha256:fbec11614dba0424ca72f4e8ba3c420dba07b4a7c206c8c8e4e73f2e98f4c559 \ + --hash=sha256:fd69666217b62fa5d7c6aa88e507493a34dec4fa20c5bd925e4bc12fce586639 + # via astroid +yamllint==1.32.0 \ + --hash=sha256:d01dde008c65de5b235188ab3110bebc59d18e5c65fc8a58267cd211cd9df34a \ + --hash=sha256:d97a66e48da820829d96077d76b8dfbe6c6140f106e558dae87e81ac4e6b30b7 + # via -r requirements.in diff --git a/examples/bzlmod/requirements_windows_3_10.txt b/examples/bzlmod/requirements_windows_3_10.txt index e4373c1682..e5feedc190 100644 --- a/examples/bzlmod/requirements_windows_3_10.txt +++ b/examples/bzlmod/requirements_windows_3_10.txt @@ -30,7 +30,6 @@ colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 # via - # -r requirements.in # pylint # sphinx dill==0.3.6 \ diff --git a/examples/bzlmod/requirements_windows_3_9.txt b/examples/bzlmod/requirements_windows_3_9.txt index 636b4dfc3e..6a5d21b940 100644 --- a/examples/bzlmod/requirements_windows_3_9.txt +++ b/examples/bzlmod/requirements_windows_3_9.txt @@ -30,7 +30,6 @@ colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 # via - # -r requirements.in # pylint # sphinx dill==0.3.6 \ diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 00602b298c..6779d0c959 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -61,6 +61,7 @@ bzl_library( ":attrs_bzl", ":hub_repository_bzl", ":parse_requirements_bzl", + ":evaluate_markers_bzl", ":parse_whl_name_bzl", ":pip_repository_attrs_bzl", ":simpleapi_download_bzl", @@ -89,6 +90,15 @@ bzl_library( ], ) +bzl_library( + name = "evaluate_markers_bzl", + srcs = ["evaluate_markers.bzl"], + deps = [ + ":pypi_repo_utils_bzl", + "//python/private:repo_utils_bzl", + ], +) + bzl_library( name = "flags_bzl", srcs = ["flags.bzl"], diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl new file mode 100644 index 0000000000..79dd52ae63 --- /dev/null +++ b/python/private/pypi/evaluate_markers.bzl @@ -0,0 +1,101 @@ +# Copyright 2024 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""A simple function that evaluates markers using a python interpreter.""" + +load("//python/private:repo_utils.bzl", "repo_utils") +load(":pypi_repo_utils.bzl", "pypi_repo_utils") + +def evaluate_markers(ctx, *, requirements, python_interpreter, python_interpreter_target): + """Return the list of supported platforms per requirements line. + + Args: + ctx: repository_ctx or module_ctx. + requirements: The requirement file lines to evaluate. + python_interpreter: str, path to the python_interpreter to use to + evaluate the env markers in the given requirements files. It will + be only called if the requirements files have env markers. This + should be something that is in your PATH or an absolute path. + python_interpreter_target: Label, same as python_interpreter, but in a + label format. + + Returns: + dict of string lists with target platforms + """ + if not requirements: + return {} + + in_file = ctx.path("requirements_with_markers.in.json") + out_file = ctx.path("requirements_with_markers.out.json") + ctx.file(in_file, json.encode(requirements)) + + if hasattr(ctx, "watch"): + srcdir = ctx.path(Label(":BUILD.bazel")).dirname + _watch_srcs( + ctx, + # NOTE @aignas 2024-07-13: we could in theory have a label list that + # lists the files that we should include as dependencies to the pip + # repo, however, this way works better because we can select files from + # within the `pypi__packaging` repository and re-execute whenever they + # change. This includes re-executing when the 'packaging' version is + # upgraded. + srcs = ctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname.get_child("packaging").readdir(watch = "no") + [ + srcdir.get_child("whl_installer", "platform.py"), + srcdir.get_child("requirements_parser", "resolve_target_platforms.py"), + ], + ) + + repo_utils.execute_checked( + ctx, + op = "ResolveRequirementEnvMarkers({})".format(in_file), + arguments = [ + pypi_repo_utils.resolve_python_interpreter( + ctx, + python_interpreter = python_interpreter, + python_interpreter_target = python_interpreter_target, + ), + "-m", + "python.private.pypi.requirements_parser.resolve_target_platforms", + in_file, + out_file, + ], + environment = { + "PYTHONPATH": pypi_repo_utils.construct_pythonpath( + ctx, + entries = [ + Label("@pypi__packaging//:BUILD.bazel"), + Label("//:MODULE.bazel"), + ], + ), + }, + ) + ret = json.decode(ctx.read(out_file)) + return ret + +def _watch_srcs(ctx, *, srcs): + """Cause bazel to re-eval extension or repo rule if srcs changed. + """ + for src in srcs: + if not src.exists: + fail("BUG: the list of potential SRCS for the repository rule should not contain items that do not exist") + + if src.is_dir: + # Do not include dirs in the watch list + continue + + if not src.basename.endswith(".py"): + # Do not include anything that is not a Python src file + continue + + ctx.watch(src) diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index d837d8d50a..3b65104584 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -21,6 +21,7 @@ load("//python/private:normalize_name.bzl", "normalize_name") load("//python/private:repo_utils.bzl", "repo_utils") load("//python/private:version_label.bzl", "version_label") load(":attrs.bzl", "use_isolated") +load(":evaluate_markers.bzl", "evaluate_markers") load(":hub_repository.bzl", "hub_repository") load(":parse_requirements.bzl", "host_platform", "parse_requirements", "select_requirement") load(":parse_whl_name.bzl", "parse_whl_name") @@ -196,6 +197,12 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s ), get_index_urls = get_index_urls, python_version = major_minor, + evaluate_markers = lambda requirements: evaluate_markers( + module_ctx, + requirements = requirements, + python_interpreter = pip_attr.python_interpreter, + python_interpreter_target = python_interpreter_target, + ), logger = logger, ) diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index 5258153a84..a5a1e782e5 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -88,6 +88,7 @@ def parse_requirements( get_index_urls = None, python_version = None, logger = None, + evaluate_markers = lambda _: {}, fail_fn = fail): """Get the requirements with platforms that the requirements apply to. @@ -103,6 +104,11 @@ def parse_requirements( distribution names to query. python_version: str or None. This is needed when the get_index_urls is specified. It should be of the form "3.x.x", + evaluate_markers: A function to use to evaluate the requirements. + Accepts a dict where keys are requirement lines to evaluate against + the platforms stored as values in the input dict. Returns the same + dict, but with values being platforms that are compatible with the + requirements line. logger: repo_utils.logger or None, a simple struct to log diagnostic messages. fail_fn (Callable[[str], None]): A failure function used in testing failure cases. @@ -162,6 +168,7 @@ def parse_requirements( options[plat] = pip_args requirements_by_platform = {} + reqs_with_env_markers = {} for target_platform, reqs_ in requirements.items(): extra_pip_args = options[target_platform] @@ -171,6 +178,9 @@ def parse_requirements( {}, ) + if ";" in requirement_line: + reqs_with_env_markers.setdefault(requirement_line, []).append(target_platform) + for_req = for_whl.setdefault( (requirement_line, ",".join(extra_pip_args)), struct( @@ -183,6 +193,20 @@ def parse_requirements( ) for_req.target_platforms.append(target_platform) + # This may call to Python, so execute it early (before calling to the + # internet below) and ensure that we call it only once. + # + # NOTE @aignas 2024-07-13: in the future, if this is something that we want + # to do, we could use Python to parse the requirement lines and infer the + # URL of the files to download things from. This should be important for + # VCS package references. + env_marker_target_platforms = evaluate_markers(reqs_with_env_markers) + if logger: + logger.debug(lambda: "Evaluated env markers from:\n{}\n\nTo:\n{}".format( + reqs_with_env_markers, + env_marker_target_platforms, + )) + index_urls = {} if get_index_urls: if not python_version: @@ -203,7 +227,8 @@ def parse_requirements( for whl_name, reqs in requirements_by_platform.items(): requirement_target_platforms = {} for r in reqs.values(): - for p in r.target_platforms: + target_platforms = env_marker_target_platforms.get(r.requirement_line, r.target_platforms) + for p in target_platforms: requirement_target_platforms[p] = None is_exposed = len(requirement_target_platforms) == len(requirements) @@ -211,7 +236,7 @@ def parse_requirements( logger.debug(lambda: "Package '{}' will not be exposed because it is only present on a subset of platforms: {} out of {}".format( whl_name, sorted(requirement_target_platforms), - sorted(requirements), + sorted(requirements_by_platform), )) for r in sorted(reqs.values(), key = lambda r: r.requirement_line): @@ -222,12 +247,13 @@ def parse_requirements( logger = logger, ) + target_platforms = env_marker_target_platforms.get(r.requirement_line, r.target_platforms) ret.setdefault(whl_name, []).append( struct( distribution = r.distribution, srcs = r.srcs, requirement_line = r.requirement_line, - target_platforms = sorted(r.target_platforms), + target_platforms = sorted(target_platforms), extra_pip_args = r.extra_pip_args, whls = whls, sdist = sdist, diff --git a/python/private/pypi/requirements_parser/resolve_target_platforms.py b/python/private/pypi/requirements_parser/resolve_target_platforms.py new file mode 100755 index 0000000000..817853409a --- /dev/null +++ b/python/private/pypi/requirements_parser/resolve_target_platforms.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 + +"""A CLI to evaluate env markers for requirements files. + +A simple script to evaluate the `requirements.txt` files. Currently it is only +handling environment markers in the requirements files, but in the future it +may handle more things. We require a `python` interpreter that can run on the +host platform and then we depend on the [packaging] PyPI wheel. + +In order to be able to resolve requirements files for any platform, we are +re-using the same code that is used in the `whl_library` installer. See +[here](../whl_installer/wheel.py). + +Requirements for the code are: +- Depends only on `packaging` and core Python. +- Produces the same result irrespective of the Python interpreter platform or version. + +[packaging]: https://packaging.pypa.io/en/stable/ +""" + +import argparse +import json +import pathlib + +from packaging.requirements import Requirement + +from python.private.pypi.whl_installer.platform import Platform + +INPUT_HELP = """\ +Input path to read the requirements as a json file, the keys in the dictionary +are the requirements lines and the values are strings of target platforms. +""" +OUTPUT_HELP = """\ +Output to write the requirements as a json filepath, the keys in the dictionary +are the requirements lines and the values are strings of target platforms, which +got changed based on the evaluated markers. +""" + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("input_path", type=pathlib.Path, help=INPUT_HELP.strip()) + parser.add_argument("output_path", type=pathlib.Path, help=OUTPUT_HELP.strip()) + args = parser.parse_args() + + with args.input_path.open() as f: + reqs = json.load(f) + + response = {} + for requirement_line, target_platforms in reqs.items(): + entry, prefix, hashes = requirement_line.partition("--hash") + hashes = prefix + hashes + + req = Requirement(entry) + for p in target_platforms: + (platform,) = Platform.from_string(p) + if not req.marker or req.marker.evaluate(platform.env_markers("")): + response.setdefault(requirement_line, []).append(p) + + with args.output_path.open("w") as f: + json.dump(response, f) + + +if __name__ == "__main__": + main() diff --git a/tests/pypi/parse_requirements/parse_requirements_tests.bzl b/tests/pypi/parse_requirements/parse_requirements_tests.bzl index 1a7143b747..90ff2862d2 100644 --- a/tests/pypi/parse_requirements/parse_requirements_tests.bzl +++ b/tests/pypi/parse_requirements/parse_requirements_tests.bzl @@ -32,6 +32,10 @@ foo[extra]==0.0.1 --hash=sha256:deadbeef foo[extra,extra_2]==0.0.1 --hash=sha256:deadbeef foo==0.0.1 --hash=sha256:deadbeef foo[extra]==0.0.1 --hash=sha256:deadbeef +""", + "requirements_marker": """\ +foo[extra]==0.0.1 ;marker --hash=sha256:deadbeef +bar==0.0.1 --hash=sha256:deadbeef """, "requirements_osx": """\ foo==0.0.3 --hash=sha256:deadbaaf @@ -197,6 +201,68 @@ def _test_select_requirement_none_platform(env): _tests.append(_test_select_requirement_none_platform) +def _test_env_marker_resolution(env): + def _mock_eval_markers(input): + ret = { + "foo[extra]==0.0.1 ;marker --hash=sha256:deadbeef": ["cp311_windows_x86_64"], + } + + env.expect.that_collection(input.keys()).contains_exactly(ret.keys()) + env.expect.that_collection(input.values()[0]).contains_exactly(["cp311_linux_super_exotic", "cp311_windows_x86_64"]) + return ret + + got = parse_requirements( + ctx = _mock_ctx(), + requirements_by_platform = { + "requirements_marker": ["cp311_linux_super_exotic", "cp311_windows_x86_64"], + }, + python_version = "3.11", + evaluate_markers = _mock_eval_markers, + ) + env.expect.that_dict(got).contains_exactly({ + "bar": [ + struct( + distribution = "bar", + extra_pip_args = [], + is_exposed = True, + requirement_line = "bar==0.0.1 --hash=sha256:deadbeef", + sdist = None, + srcs = struct( + requirement = "bar==0.0.1", + shas = ["deadbeef"], + version = "0.0.1", + ), + target_platforms = ["cp311_linux_super_exotic", "cp311_windows_x86_64"], + whls = [], + ), + ], + "foo": [ + struct( + distribution = "foo", + extra_pip_args = [], + # This is not exposed because we also have `linux_super_exotic` in the platform list + is_exposed = False, + requirement_line = "foo[extra]==0.0.1 ;marker --hash=sha256:deadbeef", + sdist = None, + srcs = struct( + requirement = "foo[extra]==0.0.1 ;marker", + shas = ["deadbeef"], + version = "0.0.1", + ), + target_platforms = ["cp311_windows_x86_64"], + whls = [], + ), + ], + }) + env.expect.that_str( + select_requirement( + got["foo"], + platform = "windows_x86_64", + ).srcs.version, + ).equals("0.0.1") + +_tests.append(_test_env_marker_resolution) + def _test_fail_no_python_version(env): errors = [] parse_requirements( From ffcde83f88e7273bfddead1d201b1bc1ce347e21 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:44:40 +0900 Subject: [PATCH 02/40] chore: use watch_tree and watch from repo_utils --- python/private/pypi/evaluate_markers.bzl | 47 +++++++++--------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index 79dd52ae63..7fbb13786b 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -40,21 +40,7 @@ def evaluate_markers(ctx, *, requirements, python_interpreter, python_interprete out_file = ctx.path("requirements_with_markers.out.json") ctx.file(in_file, json.encode(requirements)) - if hasattr(ctx, "watch"): - srcdir = ctx.path(Label(":BUILD.bazel")).dirname - _watch_srcs( - ctx, - # NOTE @aignas 2024-07-13: we could in theory have a label list that - # lists the files that we should include as dependencies to the pip - # repo, however, this way works better because we can select files from - # within the `pypi__packaging` repository and re-execute whenever they - # change. This includes re-executing when the 'packaging' version is - # upgraded. - srcs = ctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname.get_child("packaging").readdir(watch = "no") + [ - srcdir.get_child("whl_installer", "platform.py"), - srcdir.get_child("requirements_parser", "resolve_target_platforms.py"), - ], - ) + _watch_srcs(ctx) repo_utils.execute_checked( ctx, @@ -83,19 +69,20 @@ def evaluate_markers(ctx, *, requirements, python_interpreter, python_interprete ret = json.decode(ctx.read(out_file)) return ret -def _watch_srcs(ctx, *, srcs): - """Cause bazel to re-eval extension or repo rule if srcs changed. - """ - for src in srcs: - if not src.exists: - fail("BUG: the list of potential SRCS for the repository rule should not contain items that do not exist") - - if src.is_dir: - # Do not include dirs in the watch list - continue +def _watch_srcs(ctx): + """watch python srcs that do work here. - if not src.basename.endswith(".py"): - # Do not include anything that is not a Python src file - continue - - ctx.watch(src) + NOTE @aignas 2024-07-13: we could in theory have a label list that + lists the files that we should include as dependencies to the pip + repo, however, this way works better because we can select files from + within the `pypi__packaging` repository and re-execute whenever they + change. This includes re-executing when the 'packaging' version is + upgraded. + """ + repo_utils.watch_tree(ctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname) + srcdir = ctx.path(Label(":BUILD.bazel")).dirname + for src in [ + srcdir.get_child("whl_installer", "platform.py"), + srcdir.get_child("requirements_parser", "resolve_target_platforms.py"), + ]: + repo_utils.watch(src) From 969a43b740e34e61c0ee12230b8af5c80a0125f0 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:16:14 +0900 Subject: [PATCH 03/40] chore: use uv to create a universal lock file for sphinx --- MODULE.bazel | 22 +++++----- docs/sphinx/BUILD.bazel | 53 +++++++++++++++++++++++-- docs/sphinx/requirements.txt | 30 +++++++------- python/uv/BUILD.bazel | 5 ++- python/uv/private/current_toolchain.bzl | 2 +- 5 files changed, 81 insertions(+), 31 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index b6d198ffc1..21a5605755 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -82,20 +82,10 @@ dev_pip = use_extension( dev_dependency = True, ) dev_pip.parse( - experimental_requirement_cycles = { - "sphinx": [ - "sphinx", - "sphinxcontrib-serializinghtml", - "sphinxcontrib-qthelp", - "sphinxcontrib-htmlhelp", - "sphinxcontrib-devhelp", - "sphinxcontrib-applehelp", - ], - }, hub_name = "dev_pip", python_version = "3.11", requirements_by_platform = { - "//docs/sphinx:requirements.txt": "linux_*,osx_*", + "//docs/sphinx:requirements.txt": "*", }, ) dev_pip.parse( @@ -130,3 +120,13 @@ use_repo( "build_bazel_bazel_rolling", "build_bazel_bazel_self", ) + +uv = use_extension( + "@rules_python//python/uv:extensions.bzl", + "uv", + dev_dependency = True, +) +uv.toolchain(uv_version = "0.2.23") +use_repo(uv, "uv_toolchains") + +register_toolchains("@uv_toolchains//:all") diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index f82d43a45a..151b1c27df 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@bazel_skylib//rules:diff_test.bzl", "diff_test") +load("@bazel_skylib//rules:write_file.bzl", "write_file") load("@dev_pip//:requirements.bzl", "requirement") -load("//python:pip.bzl", "compile_pip_requirements") load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility load("//sphinxdocs:readthedocs.bzl", "readthedocs_install") @@ -128,9 +129,53 @@ sphinx_build_binary( ) # Run bazel run //docs/sphinx:requirements.update -compile_pip_requirements( +genrule( name = "requirements", - src = "pyproject.toml", - requirements_txt = "requirements.txt", + srcs = ["pyproject.toml"], + outs = ["_requirements.txt"], + cmd = "$(UV) pip compile " + " ".join([ + "--custom-compile-command='bazel run //docs/sphinx:requirements.update'", + "--generate-hashes", + "--universal", + "--emit-index-url", + "--no-strip-extras", + "--no-build", + "--python=$(PYTHON3)", + "$<", + "--output-file=$@", + # Always try upgrading + "--upgrade", + ]), + toolchains = [ + "//python/uv:current_toolchain", + "//python:current_py_toolchain", + ], +) + +write_file( + name = "gen_update_requirements", + out = "update_requirements.sh", + content = [ + # This depends on bash, would need tweaks for Windows + "#!/usr/bin/env bash", + "cp -fv $REQUIREMENTS_FILE $BUILD_WORKSPACE_DIRECTORY/docs/sphinx/requirements.txt", + ], +) + +diff_test( + name = "requirements.test", + file1 = "requirements", + file2 = "requirments.txt", + tags = ["manual"], + target_compatible_with = _TARGET_COMPATIBLE_WITH, +) + +sh_binary( + name = "requirements.update", + srcs = ["update_requirements.sh"], + data = [":requirements"], + env = { + "REQUIREMENTS_FILE": "$(location :requirements)", + }, target_compatible_with = _TARGET_COMPATIBLE_WITH, ) diff --git a/docs/sphinx/requirements.txt b/docs/sphinx/requirements.txt index af6763f682..fe03f2a3d3 100644 --- a/docs/sphinx/requirements.txt +++ b/docs/sphinx/requirements.txt @@ -1,13 +1,11 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# +# This file was autogenerated by uv via the following command: # bazel run //docs/sphinx:requirements.update -# +--index-url https://pypi.org/simple + absl-py==2.1.0 \ --hash=sha256:526a04eadab8b4ee719ce68f204172ead1027549089702d99b9059f129ff1308 \ --hash=sha256:7820790efbb316739cde8b4e19357243fc3608a152024288513dd968d7d959ff - # via rules_python_docs (docs/sphinx/pyproject.toml) + # via rules-python-docs (docs/sphinx/pyproject.toml) alabaster==0.7.16 \ --hash=sha256:75a8b99c28a5dad50dd7f8ccdd447a121ddb3892da9e53d1ca5cca3106d58d65 \ --hash=sha256:b46733c07dce03ae4e150330b975c75737fa60f0a7c591b6c8bf4928a28e2c92 @@ -112,6 +110,10 @@ charset-normalizer==3.3.2 \ --hash=sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519 \ --hash=sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561 # via requests +colorama==0.4.6 ; sys_platform == 'win32' \ + --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ + --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 + # via sphinx docutils==0.20.1 \ --hash=sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6 \ --hash=sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b @@ -213,7 +215,7 @@ mdurl==0.1.2 \ myst-parser==3.0.1 \ --hash=sha256:6457aaa33a5d474aca678b8ead9b3dc298e89c68e67012e73146ea6fd54babf1 \ --hash=sha256:88f0cb406cb363b077d176b51c476f62d60604d68a8dcdf4832e080441301a87 - # via rules_python_docs (docs/sphinx/pyproject.toml) + # via rules-python-docs (docs/sphinx/pyproject.toml) packaging==24.1 \ --hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \ --hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124 @@ -280,7 +282,7 @@ pyyaml==6.0.1 \ readthedocs-sphinx-ext==2.2.5 \ --hash=sha256:ee5fd5b99db9f0c180b2396cbce528aa36671951b9526bb0272dbfce5517bd27 \ --hash=sha256:f8c56184ea011c972dd45a90122568587cc85b0127bc9cf064d17c68bc809daa - # via rules_python_docs (docs/sphinx/pyproject.toml) + # via rules-python-docs (docs/sphinx/pyproject.toml) requests==2.32.3 \ --hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \ --hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6 @@ -291,18 +293,18 @@ snowballstemmer==2.2.0 \ --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ --hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a # via sphinx -sphinx==7.3.7 \ - --hash=sha256:413f75440be4cacf328f580b4274ada4565fb2187d696a84970c23f77b64d8c3 \ - --hash=sha256:a4a7db75ed37531c05002d56ed6948d4c42f473a36f46e1382b0bd76ca9627bc +sphinx==7.4.5 \ + --hash=sha256:9f135d8c1d277db67be514be579c4c4a26c8c0e962219aaca5a721b04bd6d0d8 \ + --hash=sha256:a4abe5385bf856df094c1e6cadf24a2351b12057be3670b99a12c05a01d209f5 # via + # rules-python-docs (docs/sphinx/pyproject.toml) # myst-parser - # rules_python_docs (docs/sphinx/pyproject.toml) # sphinx-rtd-theme # sphinxcontrib-jquery sphinx-rtd-theme==2.0.0 \ --hash=sha256:bd5d7b80622406762073a04ef8fadc5f9151261563d47027de09910ce03afe6b \ --hash=sha256:ec93d0856dc280cf3aee9a4c9807c60e027c7f7b461b77aeffed682e68f0e586 - # via rules_python_docs (docs/sphinx/pyproject.toml) + # via rules-python-docs (docs/sphinx/pyproject.toml) sphinxcontrib-applehelp==1.0.8 \ --hash=sha256:c40a4f96f3776c4393d933412053962fac2b84f4c99a7982ba42e09576a70619 \ --hash=sha256:cb61eb0ec1b61f349e5cc36b2028e9e7ca765be05e49641c97241274753067b4 @@ -334,7 +336,7 @@ sphinxcontrib-serializinghtml==1.1.10 \ typing-extensions==4.12.2 \ --hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \ --hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8 - # via rules_python_docs (docs/sphinx/pyproject.toml) + # via rules-python-docs (docs/sphinx/pyproject.toml) urllib3==2.2.2 \ --hash=sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472 \ --hash=sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168 diff --git a/python/uv/BUILD.bazel b/python/uv/BUILD.bazel index 3961c908ac..383bdfcc3c 100644 --- a/python/uv/BUILD.bazel +++ b/python/uv/BUILD.bazel @@ -41,7 +41,10 @@ current_toolchain( # even if no toolchain is registered. tags = ["manual"], # EXPERIMENTAL: Visibility is restricted to allow for changes. - visibility = ["@rules_python//examples:__subpackages__"], + visibility = [ + "//:__subpackages__", + "@rules_python//examples:__subpackages__", + ], ) bzl_library( diff --git a/python/uv/private/current_toolchain.bzl b/python/uv/private/current_toolchain.bzl index cd4a5926d2..6ed12d8a36 100644 --- a/python/uv/private/current_toolchain.bzl +++ b/python/uv/private/current_toolchain.bzl @@ -42,8 +42,8 @@ def _current_toolchain_impl(ctx): return [ toolchain_info, new_default_info, - toolchain_info.template_variable_info, toolchain_info.uv_toolchain_info, + platform_common.TemplateVariableInfo({"UV": symlink_uv_executable.path}), ] # Copied from java_toolchain_alias From 3e691b9082481ac13eb5d29f3bb0c17afbe592ee Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:18:30 +0900 Subject: [PATCH 04/40] reset the .bazelrc --- examples/bzlmod/MODULE.bazel | 3 +- .../bzlmod/requirements_universal_3_10.txt | 470 ------------------ 2 files changed, 2 insertions(+), 471 deletions(-) delete mode 100644 examples/bzlmod/requirements_universal_3_10.txt diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel index 5f7775d27e..3da17a6eb2 100644 --- a/examples/bzlmod/MODULE.bazel +++ b/examples/bzlmod/MODULE.bazel @@ -179,7 +179,8 @@ pip.parse( ], hub_name = "pip", python_version = "3.10", - requirements_lock = "//:requirements_universal_3_10.txt", + requirements_lock = "//:requirements_lock_3_10.txt", + requirements_windows = "//:requirements_windows_3_10.txt", # These modifications were created above and we # are providing pip.parse with the label of the mod # and the name of the wheel. diff --git a/examples/bzlmod/requirements_universal_3_10.txt b/examples/bzlmod/requirements_universal_3_10.txt deleted file mode 100644 index c22c099704..0000000000 --- a/examples/bzlmod/requirements_universal_3_10.txt +++ /dev/null @@ -1,470 +0,0 @@ -# -# This file is manually cobled by joining the two requirements lock files for -# 3.10 Python. Once the `uv` pip compile rule is complete, we should switch -# to that instead. -# ---extra-index-url https://pypi.org/simple/ - -alabaster==0.7.13 \ - --hash=sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3 \ - --hash=sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2 - # via sphinx -astroid==2.13.5 \ - --hash=sha256:6891f444625b6edb2ac798829b689e95297e100ddf89dbed5a8c610e34901501 \ - --hash=sha256:df164d5ac811b9f44105a72b8f9d5edfb7b5b2d7e979b04ea377a77b3229114a - # via pylint -babel==2.13.1 \ - --hash=sha256:33e0952d7dd6374af8dbf6768cc4ddf3ccfefc244f9986d4074704f2fbd18900 \ - --hash=sha256:7077a4984b02b6727ac10f1f7294484f737443d7e2e66c5e4380e41a3ae0b4ed - # via sphinx -certifi==2023.7.22 \ - --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 \ - --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9 - # via requests -chardet==4.0.0 \ - --hash=sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa \ - --hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5 - # via requests -colorama==0.4.6; os_name == "nt" \ - --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ - --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 - # via - # pylint - # sphinx -dill==0.3.6 \ - --hash=sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0 \ - --hash=sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373 - # via pylint -docutils==0.20.1 \ - --hash=sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6 \ - --hash=sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b - # via sphinx -idna==2.10 \ - --hash=sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6 \ - --hash=sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0 - # via requests -imagesize==1.4.1 \ - --hash=sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b \ - --hash=sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a - # via sphinx -isort==5.12.0 \ - --hash=sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504 \ - --hash=sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6 - # via pylint -jinja2==3.1.4 \ - --hash=sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369 \ - --hash=sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d - # via sphinx -lazy-object-proxy==1.9.0 \ - --hash=sha256:09763491ce220c0299688940f8dc2c5d05fd1f45af1e42e636b2e8b2303e4382 \ - --hash=sha256:0a891e4e41b54fd5b8313b96399f8b0e173bbbfc03c7631f01efbe29bb0bcf82 \ - --hash=sha256:189bbd5d41ae7a498397287c408617fe5c48633e7755287b21d741f7db2706a9 \ - --hash=sha256:18b78ec83edbbeb69efdc0e9c1cb41a3b1b1ed11ddd8ded602464c3fc6020494 \ - --hash=sha256:1aa3de4088c89a1b69f8ec0dcc169aa725b0ff017899ac568fe44ddc1396df46 \ - --hash=sha256:212774e4dfa851e74d393a2370871e174d7ff0ebc980907723bb67d25c8a7c30 \ - --hash=sha256:2d0daa332786cf3bb49e10dc6a17a52f6a8f9601b4cf5c295a4f85854d61de63 \ - --hash=sha256:5f83ac4d83ef0ab017683d715ed356e30dd48a93746309c8f3517e1287523ef4 \ - --hash=sha256:659fb5809fa4629b8a1ac5106f669cfc7bef26fbb389dda53b3e010d1ac4ebae \ - --hash=sha256:660c94ea760b3ce47d1855a30984c78327500493d396eac4dfd8bd82041b22be \ - --hash=sha256:66a3de4a3ec06cd8af3f61b8e1ec67614fbb7c995d02fa224813cb7afefee701 \ - --hash=sha256:721532711daa7db0d8b779b0bb0318fa87af1c10d7fe5e52ef30f8eff254d0cd \ - --hash=sha256:7322c3d6f1766d4ef1e51a465f47955f1e8123caee67dd641e67d539a534d006 \ - --hash=sha256:79a31b086e7e68b24b99b23d57723ef7e2c6d81ed21007b6281ebcd1688acb0a \ - --hash=sha256:81fc4d08b062b535d95c9ea70dbe8a335c45c04029878e62d744bdced5141586 \ - --hash=sha256:8fa02eaab317b1e9e03f69aab1f91e120e7899b392c4fc19807a8278a07a97e8 \ - --hash=sha256:9090d8e53235aa280fc9239a86ae3ea8ac58eff66a705fa6aa2ec4968b95c821 \ - --hash=sha256:946d27deaff6cf8452ed0dba83ba38839a87f4f7a9732e8f9fd4107b21e6ff07 \ - --hash=sha256:9990d8e71b9f6488e91ad25f322898c136b008d87bf852ff65391b004da5e17b \ - --hash=sha256:9cd077f3d04a58e83d04b20e334f678c2b0ff9879b9375ed107d5d07ff160171 \ - --hash=sha256:9e7551208b2aded9c1447453ee366f1c4070602b3d932ace044715d89666899b \ - --hash=sha256:9f5fa4a61ce2438267163891961cfd5e32ec97a2c444e5b842d574251ade27d2 \ - --hash=sha256:b40387277b0ed2d0602b8293b94d7257e17d1479e257b4de114ea11a8cb7f2d7 \ - --hash=sha256:bfb38f9ffb53b942f2b5954e0f610f1e721ccebe9cce9025a38c8ccf4a5183a4 \ - --hash=sha256:cbf9b082426036e19c6924a9ce90c740a9861e2bdc27a4834fd0a910742ac1e8 \ - --hash=sha256:d9e25ef10a39e8afe59a5c348a4dbf29b4868ab76269f81ce1674494e2565a6e \ - --hash=sha256:db1c1722726f47e10e0b5fdbf15ac3b8adb58c091d12b3ab713965795036985f \ - --hash=sha256:e7c21c95cae3c05c14aafffe2865bbd5e377cfc1348c4f7751d9dc9a48ca4bda \ - --hash=sha256:e8c6cfb338b133fbdbc5cfaa10fe3c6aeea827db80c978dbd13bc9dd8526b7d4 \ - --hash=sha256:ea806fd4c37bf7e7ad82537b0757999264d5f70c45468447bb2b91afdbe73a6e \ - --hash=sha256:edd20c5a55acb67c7ed471fa2b5fb66cb17f61430b7a6b9c3b4a1e40293b1671 \ - --hash=sha256:f0117049dd1d5635bbff65444496c90e0baa48ea405125c088e93d9cf4525b11 \ - --hash=sha256:f0705c376533ed2a9e5e97aacdbfe04cecd71e0aa84c7c0595d02ef93b6e4455 \ - --hash=sha256:f12ad7126ae0c98d601a7ee504c1122bcef553d1d5e0c3bfa77b16b3968d2734 \ - --hash=sha256:f2457189d8257dd41ae9b434ba33298aec198e30adf2dcdaaa3a28b9994f6adb \ - --hash=sha256:f699ac1c768270c9e384e4cbd268d6e67aebcfae6cd623b4d7c3bfde5a35db59 - # via astroid -markupsafe==2.1.3 \ - --hash=sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e \ - --hash=sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e \ - --hash=sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431 \ - --hash=sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686 \ - --hash=sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c \ - --hash=sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559 \ - --hash=sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc \ - --hash=sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb \ - --hash=sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939 \ - --hash=sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c \ - --hash=sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0 \ - --hash=sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4 \ - --hash=sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9 \ - --hash=sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575 \ - --hash=sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba \ - --hash=sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d \ - --hash=sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd \ - --hash=sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3 \ - --hash=sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00 \ - --hash=sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155 \ - --hash=sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac \ - --hash=sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52 \ - --hash=sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f \ - --hash=sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8 \ - --hash=sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b \ - --hash=sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007 \ - --hash=sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24 \ - --hash=sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea \ - --hash=sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198 \ - --hash=sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0 \ - --hash=sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee \ - --hash=sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be \ - --hash=sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2 \ - --hash=sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1 \ - --hash=sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707 \ - --hash=sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6 \ - --hash=sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c \ - --hash=sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58 \ - --hash=sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823 \ - --hash=sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779 \ - --hash=sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636 \ - --hash=sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c \ - --hash=sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad \ - --hash=sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee \ - --hash=sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc \ - --hash=sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2 \ - --hash=sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48 \ - --hash=sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7 \ - --hash=sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e \ - --hash=sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b \ - --hash=sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa \ - --hash=sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5 \ - --hash=sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e \ - --hash=sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb \ - --hash=sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9 \ - --hash=sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57 \ - --hash=sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc \ - --hash=sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc \ - --hash=sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2 \ - --hash=sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11 - # via jinja2 -mccabe==0.7.0 \ - --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ - --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e - # via pylint -packaging==23.2 \ - --hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \ - --hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 - # via sphinx -pathspec==0.11.1 \ - --hash=sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687 \ - --hash=sha256:d8af70af76652554bd134c22b3e8a1cc46ed7d91edcdd721ef1a0c51a84a5293 - # via yamllint -platformdirs==3.5.1 \ - --hash=sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f \ - --hash=sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5 - # via pylint -pygments==2.16.1 \ - --hash=sha256:13fc09fa63bc8d8671a6d247e1eb303c4b343eaee81d861f3404db2935653692 \ - --hash=sha256:1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29 - # via sphinx -pylint==2.15.10 \ - --hash=sha256:9df0d07e8948a1c3ffa3b6e2d7e6e63d9fb457c5da5b961ed63106594780cc7e \ - --hash=sha256:b3dc5ef7d33858f297ac0d06cc73862f01e4f2e74025ec3eff347ce0bc60baf5 - # via - # -r requirements.in - # pylint-print -pylint-print==1.0.1 \ - --hash=sha256:30aa207e9718ebf4ceb47fb87012092e6d8743aab932aa07aa14a73e750ad3d0 \ - --hash=sha256:a2b2599e7887b93e551db2624c523c1e6e9e58c3be8416cd98d41e4427e2669b - # via -r requirements.in -python-dateutil==2.8.2 \ - --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ - --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 - # via - # -r requirements.in - # s3cmd -python-magic==0.4.27 \ - --hash=sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b \ - --hash=sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3 - # via s3cmd -pyyaml==6.0 \ - --hash=sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf \ - --hash=sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293 \ - --hash=sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b \ - --hash=sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57 \ - --hash=sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b \ - --hash=sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4 \ - --hash=sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07 \ - --hash=sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba \ - --hash=sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9 \ - --hash=sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287 \ - --hash=sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513 \ - --hash=sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0 \ - --hash=sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782 \ - --hash=sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0 \ - --hash=sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92 \ - --hash=sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f \ - --hash=sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2 \ - --hash=sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc \ - --hash=sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1 \ - --hash=sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c \ - --hash=sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86 \ - --hash=sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4 \ - --hash=sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c \ - --hash=sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34 \ - --hash=sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b \ - --hash=sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d \ - --hash=sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c \ - --hash=sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb \ - --hash=sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7 \ - --hash=sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737 \ - --hash=sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3 \ - --hash=sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d \ - --hash=sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358 \ - --hash=sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53 \ - --hash=sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78 \ - --hash=sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803 \ - --hash=sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a \ - --hash=sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f \ - --hash=sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174 \ - --hash=sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5 - # via yamllint -requests==2.25.1 \ - --hash=sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804 \ - --hash=sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e - # via - # -r requirements.in - # sphinx -s3cmd==2.1.0 \ - --hash=sha256:49cd23d516b17974b22b611a95ce4d93fe326feaa07320bd1d234fed68cbccfa \ - --hash=sha256:966b0a494a916fc3b4324de38f089c86c70ee90e8e1cae6d59102103a4c0cc03 - # via -r requirements.in -six==1.16.0 \ - --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ - --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via python-dateutil -snowballstemmer==2.2.0 \ - --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ - --hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a - # via sphinx -sphinx==7.2.6 \ - --hash=sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560 \ - --hash=sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5 - # via - # -r requirements.in - # sphinxcontrib-applehelp - # sphinxcontrib-devhelp - # sphinxcontrib-htmlhelp - # sphinxcontrib-qthelp - # sphinxcontrib-serializinghtml -sphinxcontrib-applehelp==1.0.7 \ - --hash=sha256:094c4d56209d1734e7d252f6e0b3ccc090bd52ee56807a5d9315b19c122ab15d \ - --hash=sha256:39fdc8d762d33b01a7d8f026a3b7d71563ea3b72787d5f00ad8465bd9d6dfbfa - # via sphinx -sphinxcontrib-devhelp==1.0.5 \ - --hash=sha256:63b41e0d38207ca40ebbeabcf4d8e51f76c03e78cd61abe118cf4435c73d4212 \ - --hash=sha256:fe8009aed765188f08fcaadbb3ea0d90ce8ae2d76710b7e29ea7d047177dae2f - # via sphinx -sphinxcontrib-htmlhelp==2.0.4 \ - --hash=sha256:6c26a118a05b76000738429b724a0568dbde5b72391a688577da08f11891092a \ - --hash=sha256:8001661c077a73c29beaf4a79968d0726103c5605e27db92b9ebed8bab1359e9 - # via sphinx -sphinxcontrib-jsmath==1.0.1 \ - --hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \ - --hash=sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8 - # via sphinx -sphinxcontrib-qthelp==1.0.6 \ - --hash=sha256:62b9d1a186ab7f5ee3356d906f648cacb7a6bdb94d201ee7adf26db55092982d \ - --hash=sha256:bf76886ee7470b934e363da7a954ea2825650013d367728588732c7350f49ea4 - # via sphinx -sphinxcontrib-serializinghtml==1.1.9 \ - --hash=sha256:0c64ff898339e1fac29abd2bf5f11078f3ec413cfe9c046d3120d7ca65530b54 \ - --hash=sha256:9b36e503703ff04f20e9675771df105e58aa029cfcbc23b8ed716019b7416ae1 - # via - # -r requirements.in - # sphinx -tabulate==0.9.0 \ - --hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \ - --hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f - # via -r requirements.in -tomli==2.0.1 \ - --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ - --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f - # via pylint -tomlkit==0.11.8 \ - --hash=sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171 \ - --hash=sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3 - # via pylint -typing-extensions==4.6.3 \ - --hash=sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26 \ - --hash=sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5 - # via astroid -urllib3==1.26.18 \ - --hash=sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07 \ - --hash=sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0 - # via requests -websockets==11.0.3 \ - --hash=sha256:01f5567d9cf6f502d655151645d4e8b72b453413d3819d2b6f1185abc23e82dd \ - --hash=sha256:03aae4edc0b1c68498f41a6772d80ac7c1e33c06c6ffa2ac1c27a07653e79d6f \ - --hash=sha256:0ac56b661e60edd453585f4bd68eb6a29ae25b5184fd5ba51e97652580458998 \ - --hash=sha256:0ee68fe502f9031f19d495dae2c268830df2760c0524cbac5d759921ba8c8e82 \ - --hash=sha256:1553cb82942b2a74dd9b15a018dce645d4e68674de2ca31ff13ebc2d9f283788 \ - --hash=sha256:1a073fc9ab1c8aff37c99f11f1641e16da517770e31a37265d2755282a5d28aa \ - --hash=sha256:1d2256283fa4b7f4c7d7d3e84dc2ece74d341bce57d5b9bf385df109c2a1a82f \ - --hash=sha256:1d5023a4b6a5b183dc838808087033ec5df77580485fc533e7dab2567851b0a4 \ - --hash=sha256:1fdf26fa8a6a592f8f9235285b8affa72748dc12e964a5518c6c5e8f916716f7 \ - --hash=sha256:2529338a6ff0eb0b50c7be33dc3d0e456381157a31eefc561771ee431134a97f \ - --hash=sha256:279e5de4671e79a9ac877427f4ac4ce93751b8823f276b681d04b2156713b9dd \ - --hash=sha256:2d903ad4419f5b472de90cd2d40384573b25da71e33519a67797de17ef849b69 \ - --hash=sha256:332d126167ddddec94597c2365537baf9ff62dfcc9db4266f263d455f2f031cb \ - --hash=sha256:34fd59a4ac42dff6d4681d8843217137f6bc85ed29722f2f7222bd619d15e95b \ - --hash=sha256:3580dd9c1ad0701169e4d6fc41e878ffe05e6bdcaf3c412f9d559389d0c9e016 \ - --hash=sha256:3ccc8a0c387629aec40f2fc9fdcb4b9d5431954f934da3eaf16cdc94f67dbfac \ - --hash=sha256:41f696ba95cd92dc047e46b41b26dd24518384749ed0d99bea0a941ca87404c4 \ - --hash=sha256:42cc5452a54a8e46a032521d7365da775823e21bfba2895fb7b77633cce031bb \ - --hash=sha256:4841ed00f1026dfbced6fca7d963c4e7043aa832648671b5138008dc5a8f6d99 \ - --hash=sha256:4b253869ea05a5a073ebfdcb5cb3b0266a57c3764cf6fe114e4cd90f4bfa5f5e \ - --hash=sha256:54c6e5b3d3a8936a4ab6870d46bdd6ec500ad62bde9e44462c32d18f1e9a8e54 \ - --hash=sha256:619d9f06372b3a42bc29d0cd0354c9bb9fb39c2cbc1a9c5025b4538738dbffaf \ - --hash=sha256:6505c1b31274723ccaf5f515c1824a4ad2f0d191cec942666b3d0f3aa4cb4007 \ - --hash=sha256:660e2d9068d2bedc0912af508f30bbeb505bbbf9774d98def45f68278cea20d3 \ - --hash=sha256:6681ba9e7f8f3b19440921e99efbb40fc89f26cd71bf539e45d8c8a25c976dc6 \ - --hash=sha256:68b977f21ce443d6d378dbd5ca38621755f2063d6fdb3335bda981d552cfff86 \ - --hash=sha256:69269f3a0b472e91125b503d3c0b3566bda26da0a3261c49f0027eb6075086d1 \ - --hash=sha256:6f1a3f10f836fab6ca6efa97bb952300b20ae56b409414ca85bff2ad241d2a61 \ - --hash=sha256:7622a89d696fc87af8e8d280d9b421db5133ef5b29d3f7a1ce9f1a7bf7fcfa11 \ - --hash=sha256:777354ee16f02f643a4c7f2b3eff8027a33c9861edc691a2003531f5da4f6bc8 \ - --hash=sha256:84d27a4832cc1a0ee07cdcf2b0629a8a72db73f4cf6de6f0904f6661227f256f \ - --hash=sha256:8531fdcad636d82c517b26a448dcfe62f720e1922b33c81ce695d0edb91eb931 \ - --hash=sha256:86d2a77fd490ae3ff6fae1c6ceaecad063d3cc2320b44377efdde79880e11526 \ - --hash=sha256:88fc51d9a26b10fc331be344f1781224a375b78488fc343620184e95a4b27016 \ - --hash=sha256:8a34e13a62a59c871064dfd8ffb150867e54291e46d4a7cf11d02c94a5275bae \ - --hash=sha256:8c82f11964f010053e13daafdc7154ce7385ecc538989a354ccc7067fd7028fd \ - --hash=sha256:92b2065d642bf8c0a82d59e59053dd2fdde64d4ed44efe4870fa816c1232647b \ - --hash=sha256:97b52894d948d2f6ea480171a27122d77af14ced35f62e5c892ca2fae9344311 \ - --hash=sha256:9d9acd80072abcc98bd2c86c3c9cd4ac2347b5a5a0cae7ed5c0ee5675f86d9af \ - --hash=sha256:9f59a3c656fef341a99e3d63189852be7084c0e54b75734cde571182c087b152 \ - --hash=sha256:aa5003845cdd21ac0dc6c9bf661c5beddd01116f6eb9eb3c8e272353d45b3288 \ - --hash=sha256:b16fff62b45eccb9c7abb18e60e7e446998093cdcb50fed33134b9b6878836de \ - --hash=sha256:b30c6590146e53149f04e85a6e4fcae068df4289e31e4aee1fdf56a0dead8f97 \ - --hash=sha256:b58cbf0697721120866820b89f93659abc31c1e876bf20d0b3d03cef14faf84d \ - --hash=sha256:b67c6f5e5a401fc56394f191f00f9b3811fe843ee93f4a70df3c389d1adf857d \ - --hash=sha256:bceab846bac555aff6427d060f2fcfff71042dba6f5fca7dc4f75cac815e57ca \ - --hash=sha256:bee9fcb41db2a23bed96c6b6ead6489702c12334ea20a297aa095ce6d31370d0 \ - --hash=sha256:c114e8da9b475739dde229fd3bc6b05a6537a88a578358bc8eb29b4030fac9c9 \ - --hash=sha256:c1f0524f203e3bd35149f12157438f406eff2e4fb30f71221c8a5eceb3617b6b \ - --hash=sha256:c792ea4eabc0159535608fc5658a74d1a81020eb35195dd63214dcf07556f67e \ - --hash=sha256:c7f3cb904cce8e1be667c7e6fef4516b98d1a6a0635a58a57528d577ac18a128 \ - --hash=sha256:d67ac60a307f760c6e65dad586f556dde58e683fab03323221a4e530ead6f74d \ - --hash=sha256:dcacf2c7a6c3a84e720d1bb2b543c675bf6c40e460300b628bab1b1efc7c034c \ - --hash=sha256:de36fe9c02995c7e6ae6efe2e205816f5f00c22fd1fbf343d4d18c3d5ceac2f5 \ - --hash=sha256:def07915168ac8f7853812cc593c71185a16216e9e4fa886358a17ed0fd9fcf6 \ - --hash=sha256:df41b9bc27c2c25b486bae7cf42fccdc52ff181c8c387bfd026624a491c2671b \ - --hash=sha256:e052b8467dd07d4943936009f46ae5ce7b908ddcac3fda581656b1b19c083d9b \ - --hash=sha256:e063b1865974611313a3849d43f2c3f5368093691349cf3c7c8f8f75ad7cb280 \ - --hash=sha256:e1459677e5d12be8bbc7584c35b992eea142911a6236a3278b9b5ce3326f282c \ - --hash=sha256:e1a99a7a71631f0efe727c10edfba09ea6bee4166a6f9c19aafb6c0b5917d09c \ - --hash=sha256:e590228200fcfc7e9109509e4d9125eace2042fd52b595dd22bbc34bb282307f \ - --hash=sha256:e6316827e3e79b7b8e7d8e3b08f4e331af91a48e794d5d8b099928b6f0b85f20 \ - --hash=sha256:e7837cb169eca3b3ae94cc5787c4fed99eef74c0ab9506756eea335e0d6f3ed8 \ - --hash=sha256:e848f46a58b9fcf3d06061d17be388caf70ea5b8cc3466251963c8345e13f7eb \ - --hash=sha256:ed058398f55163a79bb9f06a90ef9ccc063b204bb346c4de78efc5d15abfe602 \ - --hash=sha256:f2e58f2c36cc52d41f2659e4c0cbf7353e28c8c9e63e30d8c6d3494dc9fdedcf \ - --hash=sha256:f467ba0050b7de85016b43f5a22b46383ef004c4f672148a8abf32bc999a87f0 \ - --hash=sha256:f61bdb1df43dc9c131791fbc2355535f9024b9a04398d3bd0684fc16ab07df74 \ - --hash=sha256:fb06eea71a00a7af0ae6aefbb932fb8a7df3cb390cc217d51a9ad7343de1b8d0 \ - --hash=sha256:ffd7dcaf744f25f82190856bc26ed81721508fc5cbf2a330751e135ff1283564 - # via -r requirements.in -wheel==0.40.0 \ - --hash=sha256:cd1196f3faee2b31968d626e1731c94f99cbdb67cf5a46e4f5656cbee7738873 \ - --hash=sha256:d236b20e7cb522daf2390fa84c55eea81c5c30190f90f29ae2ca1ad8355bf247 - # via -r requirements.in -wrapt==1.15.0 \ - --hash=sha256:02fce1852f755f44f95af51f69d22e45080102e9d00258053b79367d07af39c0 \ - --hash=sha256:077ff0d1f9d9e4ce6476c1a924a3332452c1406e59d90a2cf24aeb29eeac9420 \ - --hash=sha256:078e2a1a86544e644a68422f881c48b84fef6d18f8c7a957ffd3f2e0a74a0d4a \ - --hash=sha256:0970ddb69bba00670e58955f8019bec4a42d1785db3faa043c33d81de2bf843c \ - --hash=sha256:1286eb30261894e4c70d124d44b7fd07825340869945c79d05bda53a40caa079 \ - --hash=sha256:21f6d9a0d5b3a207cdf7acf8e58d7d13d463e639f0c7e01d82cdb671e6cb7923 \ - --hash=sha256:230ae493696a371f1dbffaad3dafbb742a4d27a0afd2b1aecebe52b740167e7f \ - --hash=sha256:26458da5653aa5b3d8dc8b24192f574a58984c749401f98fff994d41d3f08da1 \ - --hash=sha256:2cf56d0e237280baed46f0b5316661da892565ff58309d4d2ed7dba763d984b8 \ - --hash=sha256:2e51de54d4fb8fb50d6ee8327f9828306a959ae394d3e01a1ba8b2f937747d86 \ - --hash=sha256:2fbfbca668dd15b744418265a9607baa970c347eefd0db6a518aaf0cfbd153c0 \ - --hash=sha256:38adf7198f8f154502883242f9fe7333ab05a5b02de7d83aa2d88ea621f13364 \ - --hash=sha256:3a8564f283394634a7a7054b7983e47dbf39c07712d7b177b37e03f2467a024e \ - --hash=sha256:3abbe948c3cbde2689370a262a8d04e32ec2dd4f27103669a45c6929bcdbfe7c \ - --hash=sha256:3bbe623731d03b186b3d6b0d6f51865bf598587c38d6f7b0be2e27414f7f214e \ - --hash=sha256:40737a081d7497efea35ab9304b829b857f21558acfc7b3272f908d33b0d9d4c \ - --hash=sha256:41d07d029dd4157ae27beab04d22b8e261eddfc6ecd64ff7000b10dc8b3a5727 \ - --hash=sha256:46ed616d5fb42f98630ed70c3529541408166c22cdfd4540b88d5f21006b0eff \ - --hash=sha256:493d389a2b63c88ad56cdc35d0fa5752daac56ca755805b1b0c530f785767d5e \ - --hash=sha256:4ff0d20f2e670800d3ed2b220d40984162089a6e2c9646fdb09b85e6f9a8fc29 \ - --hash=sha256:54accd4b8bc202966bafafd16e69da9d5640ff92389d33d28555c5fd4f25ccb7 \ - --hash=sha256:56374914b132c702aa9aa9959c550004b8847148f95e1b824772d453ac204a72 \ - --hash=sha256:578383d740457fa790fdf85e6d346fda1416a40549fe8db08e5e9bd281c6a475 \ - --hash=sha256:58d7a75d731e8c63614222bcb21dd992b4ab01a399f1f09dd82af17bbfc2368a \ - --hash=sha256:5c5aa28df055697d7c37d2099a7bc09f559d5053c3349b1ad0c39000e611d317 \ - --hash=sha256:5fc8e02f5984a55d2c653f5fea93531e9836abbd84342c1d1e17abc4a15084c2 \ - --hash=sha256:63424c681923b9f3bfbc5e3205aafe790904053d42ddcc08542181a30a7a51bd \ - --hash=sha256:64b1df0f83706b4ef4cfb4fb0e4c2669100fd7ecacfb59e091fad300d4e04640 \ - --hash=sha256:74934ebd71950e3db69960a7da29204f89624dde411afbfb3b4858c1409b1e98 \ - --hash=sha256:75669d77bb2c071333417617a235324a1618dba66f82a750362eccbe5b61d248 \ - --hash=sha256:75760a47c06b5974aa5e01949bf7e66d2af4d08cb8c1d6516af5e39595397f5e \ - --hash=sha256:76407ab327158c510f44ded207e2f76b657303e17cb7a572ffe2f5a8a48aa04d \ - --hash=sha256:76e9c727a874b4856d11a32fb0b389afc61ce8aaf281ada613713ddeadd1cfec \ - --hash=sha256:77d4c1b881076c3ba173484dfa53d3582c1c8ff1f914c6461ab70c8428b796c1 \ - --hash=sha256:780c82a41dc493b62fc5884fb1d3a3b81106642c5c5c78d6a0d4cbe96d62ba7e \ - --hash=sha256:7dc0713bf81287a00516ef43137273b23ee414fe41a3c14be10dd95ed98a2df9 \ - --hash=sha256:7eebcdbe3677e58dd4c0e03b4f2cfa346ed4049687d839adad68cc38bb559c92 \ - --hash=sha256:896689fddba4f23ef7c718279e42f8834041a21342d95e56922e1c10c0cc7afb \ - --hash=sha256:96177eb5645b1c6985f5c11d03fc2dbda9ad24ec0f3a46dcce91445747e15094 \ - --hash=sha256:96e25c8603a155559231c19c0349245eeb4ac0096fe3c1d0be5c47e075bd4f46 \ - --hash=sha256:9d37ac69edc5614b90516807de32d08cb8e7b12260a285ee330955604ed9dd29 \ - --hash=sha256:9ed6aa0726b9b60911f4aed8ec5b8dd7bf3491476015819f56473ffaef8959bd \ - --hash=sha256:a487f72a25904e2b4bbc0817ce7a8de94363bd7e79890510174da9d901c38705 \ - --hash=sha256:a4cbb9ff5795cd66f0066bdf5947f170f5d63a9274f99bdbca02fd973adcf2a8 \ - --hash=sha256:a74d56552ddbde46c246b5b89199cb3fd182f9c346c784e1a93e4dc3f5ec9975 \ - --hash=sha256:a89ce3fd220ff144bd9d54da333ec0de0399b52c9ac3d2ce34b569cf1a5748fb \ - --hash=sha256:abd52a09d03adf9c763d706df707c343293d5d106aea53483e0ec8d9e310ad5e \ - --hash=sha256:abd8f36c99512755b8456047b7be10372fca271bf1467a1caa88db991e7c421b \ - --hash=sha256:af5bd9ccb188f6a5fdda9f1f09d9f4c86cc8a539bd48a0bfdc97723970348418 \ - --hash=sha256:b02f21c1e2074943312d03d243ac4388319f2456576b2c6023041c4d57cd7019 \ - --hash=sha256:b06fa97478a5f478fb05e1980980a7cdf2712015493b44d0c87606c1513ed5b1 \ - --hash=sha256:b0724f05c396b0a4c36a3226c31648385deb6a65d8992644c12a4963c70326ba \ - --hash=sha256:b130fe77361d6771ecf5a219d8e0817d61b236b7d8b37cc045172e574ed219e6 \ - --hash=sha256:b56d5519e470d3f2fe4aa7585f0632b060d532d0696c5bdfb5e8319e1d0f69a2 \ - --hash=sha256:b67b819628e3b748fd3c2192c15fb951f549d0f47c0449af0764d7647302fda3 \ - --hash=sha256:ba1711cda2d30634a7e452fc79eabcadaffedf241ff206db2ee93dd2c89a60e7 \ - --hash=sha256:bbeccb1aa40ab88cd29e6c7d8585582c99548f55f9b2581dfc5ba68c59a85752 \ - --hash=sha256:bd84395aab8e4d36263cd1b9308cd504f6cf713b7d6d3ce25ea55670baec5416 \ - --hash=sha256:c99f4309f5145b93eca6e35ac1a988f0dc0a7ccf9ccdcd78d3c0adf57224e62f \ - --hash=sha256:ca1cccf838cd28d5a0883b342474c630ac48cac5df0ee6eacc9c7290f76b11c1 \ - --hash=sha256:cd525e0e52a5ff16653a3fc9e3dd827981917d34996600bbc34c05d048ca35cc \ - --hash=sha256:cdb4f085756c96a3af04e6eca7f08b1345e94b53af8921b25c72f096e704e145 \ - --hash=sha256:ce42618f67741d4697684e501ef02f29e758a123aa2d669e2d964ff734ee00ee \ - --hash=sha256:d06730c6aed78cee4126234cf2d071e01b44b915e725a6cb439a879ec9754a3a \ - --hash=sha256:d5fe3e099cf07d0fb5a1e23d399e5d4d1ca3e6dfcbe5c8570ccff3e9208274f7 \ - --hash=sha256:d6bcbfc99f55655c3d93feb7ef3800bd5bbe963a755687cbf1f490a71fb7794b \ - --hash=sha256:d787272ed958a05b2c86311d3a4135d3c2aeea4fc655705f074130aa57d71653 \ - --hash=sha256:e169e957c33576f47e21864cf3fc9ff47c223a4ebca8960079b8bd36cb014fd0 \ - --hash=sha256:e20076a211cd6f9b44a6be58f7eeafa7ab5720eb796975d0c03f05b47d89eb90 \ - --hash=sha256:e826aadda3cae59295b95343db8f3d965fb31059da7de01ee8d1c40a60398b29 \ - --hash=sha256:eef4d64c650f33347c1f9266fa5ae001440b232ad9b98f1f43dfe7a79435c0a6 \ - --hash=sha256:f2e69b3ed24544b0d3dbe2c5c0ba5153ce50dcebb576fdc4696d52aa22db6034 \ - --hash=sha256:f87ec75864c37c4c6cb908d282e1969e79763e0d9becdfe9fe5473b7bb1e5f09 \ - --hash=sha256:fbec11614dba0424ca72f4e8ba3c420dba07b4a7c206c8c8e4e73f2e98f4c559 \ - --hash=sha256:fd69666217b62fa5d7c6aa88e507493a34dec4fa20c5bd925e4bc12fce586639 - # via astroid -yamllint==1.32.0 \ - --hash=sha256:d01dde008c65de5b235188ab3110bebc59d18e5c65fc8a58267cd211cd9df34a \ - --hash=sha256:d97a66e48da820829d96077d76b8dfbe6c6140f106e558dae87e81ac4e6b30b7 - # via -r requirements.in From 2106402c0a48c2b56879dccf09b14642eb579199 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:22:27 +0900 Subject: [PATCH 05/40] clarify logs --- python/private/pypi/parse_requirements.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index a5a1e782e5..702e771dca 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -236,7 +236,7 @@ def parse_requirements( logger.debug(lambda: "Package '{}' will not be exposed because it is only present on a subset of platforms: {} out of {}".format( whl_name, sorted(requirement_target_platforms), - sorted(requirements_by_platform), + sorted(requirements), )) for r in sorted(reqs.values(), key = lambda r: r.requirement_line): From fe69b9de867370da9b0a22eae0e215debed3019b Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:35:35 +0900 Subject: [PATCH 06/40] use `dev_dependency` for `dev_dependency` toolchains --- MODULE.bazel | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index 21a5605755..16ef5c6a04 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -129,4 +129,7 @@ uv = use_extension( uv.toolchain(uv_version = "0.2.23") use_repo(uv, "uv_toolchains") -register_toolchains("@uv_toolchains//:all") +register_toolchains( + "@uv_toolchains//:all", + dev_dependency = True, +) From d102ea164fa9f7695bb6f55f74d0a2c71f73251d Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:42:39 +0900 Subject: [PATCH 07/40] mark the requirements updating incompatible --- docs/sphinx/BUILD.bazel | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index 151b1c27df..d3ac455d96 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -128,6 +128,12 @@ sphinx_build_binary( ], ) +_REQUIREMENTS_TARGET_COMPATIBLE_WITH = select({ + "@platforms//os:linux": [], + "@platforms//os:macos": [], + "//conditions:default": ["@platforms//:incompatible"], +}) if BZLMOD_ENABLED else ["@platforms//:incompatible"] + # Run bazel run //docs/sphinx:requirements.update genrule( name = "requirements", @@ -146,6 +152,7 @@ genrule( # Always try upgrading "--upgrade", ]), + target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, toolchains = [ "//python/uv:current_toolchain", "//python:current_py_toolchain", @@ -160,6 +167,7 @@ write_file( "#!/usr/bin/env bash", "cp -fv $REQUIREMENTS_FILE $BUILD_WORKSPACE_DIRECTORY/docs/sphinx/requirements.txt", ], + target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, ) diff_test( @@ -167,7 +175,7 @@ diff_test( file1 = "requirements", file2 = "requirments.txt", tags = ["manual"], - target_compatible_with = _TARGET_COMPATIBLE_WITH, + target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, ) sh_binary( @@ -177,5 +185,5 @@ sh_binary( env = { "REQUIREMENTS_FILE": "$(location :requirements)", }, - target_compatible_with = _TARGET_COMPATIBLE_WITH, + target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, ) From 3fa13792a660477c56ff5aeff1086ab15bc7e165 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:47:25 +0900 Subject: [PATCH 08/40] disable sandbox for the requirements compilation --- docs/sphinx/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index d3ac455d96..5698d9caf9 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -152,6 +152,7 @@ genrule( # Always try upgrading "--upgrade", ]), + tags = ["local"], target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, toolchains = [ "//python/uv:current_toolchain", From 1a82dadb8d824ce52df4c5d9bbbe8ff22fcdbe3a Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 22:33:45 +0900 Subject: [PATCH 09/40] fix: watch_srcs and more things in repo_utils. Move more things to repo_utils and stop using watch_tree, because it also starts watching __pycache__ files, that is causing excesive restarts. What is more, we previously where using uname to get the OS, but it does not make sense to do that, we can use rctx.os.name instead and common utilities. What is more, be more explicit about what OSes are supported in the local_runtime_repo. --- python/private/local_runtime_repo.bzl | 2 +- python/private/pypi/evaluate_markers.bzl | 15 ++++-- python/private/pypi/extension.bzl | 2 +- python/private/pypi/parse_requirements.bzl | 59 ++-------------------- python/private/pypi/pip_repository.bzl | 2 +- python/private/pypi/pypi_repo_utils.bzl | 21 ++++---- python/private/repo_utils.bzl | 52 ++++++++++++++++--- 7 files changed, 74 insertions(+), 79 deletions(-) diff --git a/python/private/local_runtime_repo.bzl b/python/private/local_runtime_repo.bzl index f6bca6cc2c..bbdd9c89da 100644 --- a/python/private/local_runtime_repo.bzl +++ b/python/private/local_runtime_repo.bzl @@ -46,7 +46,7 @@ def _local_runtime_repo_impl(rctx): on_failure = rctx.attr.on_failure platforms_os_name = repo_utils.get_platforms_os_name(rctx) - if not platforms_os_name: + if platforms_os_name not in ["linux", "osx", "windows"]: if on_failure == "fail": fail("Unrecognized host platform '{}': cannot determine OS constraint".format( rctx.os.name, diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index 7fbb13786b..5bde04107d 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -36,12 +36,12 @@ def evaluate_markers(ctx, *, requirements, python_interpreter, python_interprete if not requirements: return {} + _watch_srcs(ctx) + in_file = ctx.path("requirements_with_markers.in.json") out_file = ctx.path("requirements_with_markers.out.json") ctx.file(in_file, json.encode(requirements)) - _watch_srcs(ctx) - repo_utils.execute_checked( ctx, op = "ResolveRequirementEnvMarkers({})".format(in_file), @@ -79,10 +79,17 @@ def _watch_srcs(ctx): change. This includes re-executing when the 'packaging' version is upgraded. """ - repo_utils.watch_tree(ctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname) + packaging = ctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname + if not hasattr(ctx, "watch"): + return + srcdir = ctx.path(Label(":BUILD.bazel")).dirname for src in [ srcdir.get_child("whl_installer", "platform.py"), srcdir.get_child("requirements_parser", "resolve_target_platforms.py"), + ] + [ + src + for src in packaging.readdir(watch = "no") + if not src.is_dir and src.basename.endswith(".py") ]: - repo_utils.watch(src) + ctx.watch(src) diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index 3b65104584..0050881a5a 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -206,7 +206,7 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s logger = logger, ) - repository_platform = host_platform(module_ctx.os) + repository_platform = host_platform(module_ctx) for whl_name, requirements in requirements_by_platform.items(): # We are not using the "sanitized name" because the user # would need to guess what name we modified the whl name diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index 702e771dca..4a639f8149 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -27,59 +27,11 @@ behavior. """ load("//python/private:normalize_name.bzl", "normalize_name") +load("//python/private:repo_utils.bzl", "repo_utils") load(":index_sources.bzl", "index_sources") load(":parse_requirements_txt.bzl", "parse_requirements_txt") load(":whl_target_platforms.bzl", "select_whls") -# This includes the vendored _translate_cpu and _translate_os from -# @platforms//host:extension.bzl at version 0.0.9 so that we don't -# force the users to depend on it. - -def _translate_cpu(arch): - if arch in ["i386", "i486", "i586", "i686", "i786", "x86"]: - return "x86_32" - if arch in ["amd64", "x86_64", "x64"]: - return "x86_64" - if arch in ["ppc", "ppc64", "ppc64le"]: - return "ppc" - if arch in ["arm", "armv7l"]: - return "arm" - if arch in ["aarch64"]: - return "aarch64" - if arch in ["s390x", "s390"]: - return "s390x" - if arch in ["mips64el", "mips64"]: - return "mips64" - if arch in ["riscv64"]: - return "riscv64" - return arch - -def _translate_os(os): - if os.startswith("mac os"): - return "osx" - if os.startswith("freebsd"): - return "freebsd" - if os.startswith("openbsd"): - return "openbsd" - if os.startswith("linux"): - return "linux" - if os.startswith("windows"): - return "windows" - return os - -# TODO @aignas 2024-05-13: consider using the same platform tags as are used in -# the //python:versions.bzl -DEFAULT_PLATFORMS = [ - "linux_aarch64", - "linux_arm", - "linux_ppc", - "linux_s390x", - "linux_x86_64", - "osx_aarch64", - "osx_x86_64", - "windows_x86_64", -] - def parse_requirements( ctx, *, @@ -297,20 +249,19 @@ def select_requirement(requirements, *, platform): return maybe_requirement[0] -def host_platform(repository_os): +def host_platform(rctx): """Return a string representation of the repository OS. Args: - repository_os (struct): The `module_ctx.os` or `repository_ctx.os` attribute. - See https://bazel.build/rules/lib/builtins/repository_os.html + rctx (struct): The `module_ctx` or `repository_ctx` attribute. Returns: The string representation of the platform that we can later used in the `pip` machinery. """ return "{}_{}".format( - _translate_os(repository_os.name.lower()), - _translate_cpu(repository_os.arch.lower()), + repo_utils.get_platforms_os_name(rctx), + repo_utils.get_platforms_arch_name(rctx), ) def _add_dists(requirement, index_urls, python_version, logger = None): diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl index 42622c3c73..992b83f63b 100644 --- a/python/private/pypi/pip_repository.bzl +++ b/python/private/pypi/pip_repository.bzl @@ -84,7 +84,7 @@ def _pip_repository_impl(rctx): ) selected_requirements = {} options = None - repository_platform = host_platform(rctx.os) + repository_platform = host_platform(rctx) for name, requirements in requirements_by_platform.items(): r = select_requirement( requirements, diff --git a/python/private/pypi/pypi_repo_utils.bzl b/python/private/pypi/pypi_repo_utils.bzl index 6e5d93b160..1f9f050893 100644 --- a/python/private/pypi/pypi_repo_utils.bzl +++ b/python/private/pypi/pypi_repo_utils.bzl @@ -14,8 +14,7 @@ "" -load("//python:versions.bzl", "WINDOWS_NAME") -load("//python/private:toolchains_repo.bzl", "get_host_os_arch") +load("//python/private:repo_utils.bzl", "repo_utils") def _get_python_interpreter_attr(ctx, *, python_interpreter = None): """A helper function for getting the `python_interpreter` attribute or it's default @@ -30,7 +29,8 @@ def _get_python_interpreter_attr(ctx, *, python_interpreter = None): if python_interpreter: return python_interpreter - if "win" in ctx.os.name: + os = repo_utils.get_platforms_os_name(ctx) + if "windows" in os: return "python.exe" else: return "python3" @@ -39,7 +39,7 @@ def _resolve_python_interpreter(ctx, *, python_interpreter = None, python_interp """Helper function to find the python interpreter from the common attributes Args: - ctx: Handle to the rule repository context. + ctx: Handle to the rule module_ctx or repository_ctx. python_interpreter: The python interpreter to use. python_interpreter_target: The python interpreter to use after downloading the label. @@ -51,11 +51,11 @@ def _resolve_python_interpreter(ctx, *, python_interpreter = None, python_interp if python_interpreter_target != None: python_interpreter = ctx.path(python_interpreter_target) - (os, _) = get_host_os_arch(ctx) + os = repo_utils.get_platforms_os_name(ctx) # On Windows, the symlink doesn't work because Windows attempts to find # Python DLLs where the symlink is, not where the symlink points. - if os == WINDOWS_NAME: + if "windows" in os: python_interpreter = python_interpreter.realpath elif "/" not in python_interpreter: # It's a plain command, e.g. "python3", to look up in the environment. @@ -67,22 +67,23 @@ def _resolve_python_interpreter(ctx, *, python_interpreter = None, python_interp python_interpreter = ctx.path(python_interpreter) return python_interpreter -def _construct_pypath(rctx, *, entries): +def _construct_pypath(ctx, *, entries): """Helper function to construct a PYTHONPATH. Contains entries for code in this repo as well as packages downloaded from //python/pip_install:repositories.bzl. This allows us to run python code inside repository rule implementations. Args: - rctx: Handle to the repository_context. + ctx: Handle to the module_ctx or repository_ctx. entries: The list of entries to add to PYTHONPATH. Returns: String of the PYTHONPATH. """ - separator = ":" if not "windows" in rctx.os.name.lower() else ";" + os = repo_utils.get_platforms_os_name(ctx) + separator = ";" if "windows" in os else ":" pypath = separator.join([ - str(rctx.path(entry).dirname) + str(ctx.path(entry).dirname) # Use a dict as a way to remove duplicates and then sort it. for entry in sorted({x: None for x in entries}) ]) diff --git a/python/private/repo_utils.bzl b/python/private/repo_utils.bzl index 9d76e19833..829a5b38ba 100644 --- a/python/private/repo_utils.bzl +++ b/python/private/repo_utils.bzl @@ -341,6 +341,10 @@ def _outputs_to_str(result): lines.append("<{} empty>".format(name)) return "\n".join(lines) +# This includes the vendored _translate_cpu and _translate_os from +# @platforms//host:extension.bzl at version 0.0.9 so that we don't +# force the users to depend on it. + def _get_platforms_os_name(rctx): """Return the name in @platforms//os for the host os. @@ -348,18 +352,49 @@ def _get_platforms_os_name(rctx): rctx: repository_ctx Returns: - `str | None`. The target name if it maps to known platforms - value, otherwise None. + `str`. The target name. """ os = rctx.os.name.lower() - if "linux" in os: - return os - if "windows" in os: - return "windows" - if "mac" in os: + + if os.startswith("mac os"): return "osx" + if os.startswith("freebsd"): + return "freebsd" + if os.startswith("openbsd"): + return "openbsd" + if os.startswith("linux"): + return "linux" + if os.startswith("windows"): + return "windows" + return os + +def _get_platforms_arch_name(rctx): + """Return the name in @platforms//cpu for the host arch. - return None + Args: + rctx: repository_ctx + + Returns: + `str`. The target name. + """ + arch = rctx.os.arch.lower() + if arch in ["i386", "i486", "i586", "i686", "i786", "x86"]: + return "x86_32" + if arch in ["amd64", "x86_64", "x64"]: + return "x86_64" + if arch in ["ppc", "ppc64", "ppc64le"]: + return "ppc" + if arch in ["arm", "armv7l"]: + return "arm" + if arch in ["aarch64"]: + return "aarch64" + if arch in ["s390x", "s390"]: + return "s390x" + if arch in ["mips64el", "mips64"]: + return "mips64" + if arch in ["riscv64"]: + return "riscv64" + return arch # TODO: Remove after Bazel 6 support dropped def _watch(rctx, *args, **kwargs): @@ -380,6 +415,7 @@ repo_utils = struct( execute_checked_stdout = _execute_checked_stdout, execute_unchecked = _execute_unchecked, get_platforms_os_name = _get_platforms_os_name, + get_platforms_arch_name = _get_platforms_arch_name, getenv = _getenv, is_repo_debug_enabled = _is_repo_debug_enabled, logger = _logger, From eb75a85f995395f011c3ba9864dd89c21234a09f Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 22:47:49 +0900 Subject: [PATCH 10/40] revert examples/bzlmod changes --- examples/bzlmod/requirements.in | 1 + examples/bzlmod/requirements_lock_3_10.txt | 4 ++++ examples/bzlmod/requirements_lock_3_9.txt | 4 ++++ examples/bzlmod/requirements_windows_3_10.txt | 1 + examples/bzlmod/requirements_windows_3_9.txt | 1 + 5 files changed, 11 insertions(+) diff --git a/examples/bzlmod/requirements.in b/examples/bzlmod/requirements.in index 39b05b7033..a713577f55 100644 --- a/examples/bzlmod/requirements.in +++ b/examples/bzlmod/requirements.in @@ -11,3 +11,4 @@ pylint-print python-dateutil>=2.8.2 sphinx sphinxcontrib-serializinghtml +colorama diff --git a/examples/bzlmod/requirements_lock_3_10.txt b/examples/bzlmod/requirements_lock_3_10.txt index a279666b35..ace879f38e 100644 --- a/examples/bzlmod/requirements_lock_3_10.txt +++ b/examples/bzlmod/requirements_lock_3_10.txt @@ -26,6 +26,10 @@ chardet==4.0.0 \ --hash=sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa \ --hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5 # via requests +colorama==0.4.6 \ + --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ + --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 + # via -r requirements.in dill==0.3.6 \ --hash=sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0 \ --hash=sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373 diff --git a/examples/bzlmod/requirements_lock_3_9.txt b/examples/bzlmod/requirements_lock_3_9.txt index 2c2a00672e..e6aaa992fb 100644 --- a/examples/bzlmod/requirements_lock_3_9.txt +++ b/examples/bzlmod/requirements_lock_3_9.txt @@ -26,6 +26,10 @@ chardet==4.0.0 \ --hash=sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa \ --hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5 # via requests +colorama==0.4.6 \ + --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ + --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 + # via -r requirements.in dill==0.3.6 \ --hash=sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0 \ --hash=sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373 diff --git a/examples/bzlmod/requirements_windows_3_10.txt b/examples/bzlmod/requirements_windows_3_10.txt index e5feedc190..e4373c1682 100644 --- a/examples/bzlmod/requirements_windows_3_10.txt +++ b/examples/bzlmod/requirements_windows_3_10.txt @@ -30,6 +30,7 @@ colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 # via + # -r requirements.in # pylint # sphinx dill==0.3.6 \ diff --git a/examples/bzlmod/requirements_windows_3_9.txt b/examples/bzlmod/requirements_windows_3_9.txt index 6a5d21b940..636b4dfc3e 100644 --- a/examples/bzlmod/requirements_windows_3_9.txt +++ b/examples/bzlmod/requirements_windows_3_9.txt @@ -30,6 +30,7 @@ colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 # via + # -r requirements.in # pylint # sphinx dill==0.3.6 \ From 8e8e4009e5797ae6fbfd2916f93e790ed813eef2 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 22:55:44 +0900 Subject: [PATCH 11/40] use a simpler way to define sphinx requirements --- MODULE.bazel | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 16ef5c6a04..27e56e96e5 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -84,9 +84,7 @@ dev_pip = use_extension( dev_pip.parse( hub_name = "dev_pip", python_version = "3.11", - requirements_by_platform = { - "//docs/sphinx:requirements.txt": "*", - }, + requirements_lock = "//docs/sphinx:requirements.txt", ) dev_pip.parse( hub_name = "pypiserver", From afb25f9a5cc260c22f7a6aa6f0b8ed6498a91503 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:33:16 +0900 Subject: [PATCH 12/40] add marker eval to workspace --- CHANGELOG.md | 5 ++--- WORKSPACE | 10 ---------- python/private/pypi/BUILD.bazel | 4 ++-- python/private/pypi/pip_repository.bzl | 7 +++++++ 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3252205f34..664a8da0dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,13 +37,12 @@ A brief description of the categories of changes: ([#2030](https://github.com/bazelbuild/rules_python/issues/2030)). * (pip) Fixed pypi parse_simpleapi_html function for feeds with package metadata containing ">" sign + +### Added * (pypi) Support env markers in requirements files. Note, that this means that if your requirements files contain env markers, the Python interpreter will have to be downloaded to re-evaluate the bzlmod extension. -### Added -* Nothing yet - ### Removed * Nothing yet diff --git a/WORKSPACE b/WORKSPACE index 90e9305684..a9e5e7bcb9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -120,16 +120,6 @@ install_pypiserver() pip_parse( name = "dev_pip", - experimental_requirement_cycles = { - "sphinx": [ - "sphinx", - "sphinxcontrib-serializinghtml", - "sphinxcontrib-qthelp", - "sphinxcontrib-htmlhelp", - "sphinxcontrib-devhelp", - "sphinxcontrib-applehelp", - ], - }, python_interpreter_target = interpreter, requirements_lock = "//docs/sphinx:requirements.txt", ) diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 6779d0c959..2b5e14061f 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -224,6 +224,7 @@ bzl_library( srcs = ["pip_repository.bzl"], deps = [ ":attrs_bzl", + ":evaluate_markers_bzl", ":parse_requirements_bzl", ":pip_repository_attrs_bzl", ":render_pkg_aliases_bzl", @@ -243,8 +244,7 @@ bzl_library( name = "pypi_repo_utils_bzl", srcs = ["pypi_repo_utils.bzl"], deps = [ - "//python:versions_bzl", - "//python/private:toolchains_repo_bzl", + "//python/private:repo_utils_bzl", ], ) diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl index 992b83f63b..cecf9ec8a2 100644 --- a/python/private/pypi/pip_repository.bzl +++ b/python/private/pypi/pip_repository.bzl @@ -18,6 +18,7 @@ load("@bazel_skylib//lib:sets.bzl", "sets") load("//python/private:normalize_name.bzl", "normalize_name") load("//python/private:repo_utils.bzl", "REPO_DEBUG_ENV_VAR") load("//python/private:text_util.bzl", "render") +load(":evaluate_markers.bzl", "evaluate_markers") load(":parse_requirements.bzl", "host_platform", "parse_requirements", "select_requirement") load(":pip_repository_attrs.bzl", "ATTRS") load(":render_pkg_aliases.bzl", "render_pkg_aliases", "whl_alias") @@ -81,6 +82,12 @@ def _pip_repository_impl(rctx): extra_pip_args = rctx.attr.extra_pip_args, ), extra_pip_args = rctx.attr.extra_pip_args, + evaluate_markers = lambda requirements: evaluate_markers( + rctx, + requirements = requirements, + python_interpreter = rctx.attr.python_interpreter, + python_interpreter_target = rctx.attr.python_interpreter_target, + ), ) selected_requirements = {} options = None From 751006ce95bb32584a62f04ed15e68d0448fee1d Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:37:06 +0900 Subject: [PATCH 13/40] fix a typo --- docs/sphinx/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index 5698d9caf9..3f72b87f2c 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -174,7 +174,7 @@ write_file( diff_test( name = "requirements.test", file1 = "requirements", - file2 = "requirments.txt", + file2 = "requirements.txt", tags = ["manual"], target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, ) From 3749199f859e74acfdc7ec0fa297d71ae923b50f Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:41:22 +0900 Subject: [PATCH 14/40] tidy up the requirement generation --- docs/sphinx/BUILD.bazel | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index 3f72b87f2c..d9926d6c7e 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -152,7 +152,11 @@ genrule( # Always try upgrading "--upgrade", ]), - tags = ["local"], + tags = [ + "local", + "manual", + "no-cache", + ], target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, toolchains = [ "//python/uv:current_toolchain", @@ -160,6 +164,19 @@ genrule( ], ) +diff_test( + name = "requirements.test", + file1 = "requirements", + file2 = "requirements.txt", + tags = [ + "manual", + "no-cache", + ], + target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, +) + +# Write a script that can be used for updating the in-tree version of the +# requirements file write_file( name = "gen_update_requirements", out = "update_requirements.sh", @@ -171,14 +188,6 @@ write_file( target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, ) -diff_test( - name = "requirements.test", - file1 = "requirements", - file2 = "requirements.txt", - tags = ["manual"], - target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, -) - sh_binary( name = "requirements.update", srcs = ["update_requirements.sh"], @@ -186,5 +195,6 @@ sh_binary( env = { "REQUIREMENTS_FILE": "$(location :requirements)", }, + tags = ["manual"], target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, ) From 3884f7e5bf9a0ccfdf9e9e699bf0842176a1578f Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:49:04 +0900 Subject: [PATCH 15/40] support updating requirements on Windows (in theory) --- docs/sphinx/BUILD.bazel | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index d9926d6c7e..d99a7cbfee 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -15,6 +15,7 @@ load("@bazel_skylib//rules:diff_test.bzl", "diff_test") load("@bazel_skylib//rules:write_file.bzl", "write_file") load("@dev_pip//:requirements.bzl", "requirement") +load("//python:py_binary.bzl", "py_binary") load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility load("//sphinxdocs:readthedocs.bzl", "readthedocs_install") @@ -131,6 +132,7 @@ sphinx_build_binary( _REQUIREMENTS_TARGET_COMPATIBLE_WITH = select({ "@platforms//os:linux": [], "@platforms//os:macos": [], + "@platforms//os:windows": [], "//conditions:default": ["@platforms//:incompatible"], }) if BZLMOD_ENABLED else ["@platforms//:incompatible"] @@ -179,18 +181,24 @@ diff_test( # requirements file write_file( name = "gen_update_requirements", - out = "update_requirements.sh", + out = "requirements.update.py", content = [ - # This depends on bash, would need tweaks for Windows - "#!/usr/bin/env bash", - "cp -fv $REQUIREMENTS_FILE $BUILD_WORKSPACE_DIRECTORY/docs/sphinx/requirements.txt", + "#!/usr/bin/env python3", + "", + "from pathlib import Path", + "import os", + "", + 'src = Path(os.environ.get("REQUIREMENTS_FILE"))', + 'dst = Path(os.environ.get("BUILD_WORKSPACE_DIRECTORY")) / "docs" / "sphinx" / "requirements.txt"', + 'print(f"Writing requirements contents from {src} to {dst}")', + "dst.write_text(src.read_text())", ], target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, ) -sh_binary( +py_binary( name = "requirements.update", - srcs = ["update_requirements.sh"], + srcs = ["requirements.update.py"], data = [":requirements"], env = { "REQUIREMENTS_FILE": "$(location :requirements)", From 96da9b5d13a18ee0b3f6d8344386e2a30aa39d81 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:49:59 +0900 Subject: [PATCH 16/40] fail if env vars are not defined --- docs/sphinx/BUILD.bazel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index d99a7cbfee..6d598ca3c4 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -188,8 +188,8 @@ write_file( "from pathlib import Path", "import os", "", - 'src = Path(os.environ.get("REQUIREMENTS_FILE"))', - 'dst = Path(os.environ.get("BUILD_WORKSPACE_DIRECTORY")) / "docs" / "sphinx" / "requirements.txt"', + 'src = Path(os.environ["REQUIREMENTS_FILE"])', + 'dst = Path(os.environ["BUILD_WORKSPACE_DIRECTORY"]) / "docs" / "sphinx" / "requirements.txt"', 'print(f"Writing requirements contents from {src} to {dst}")', "dst.write_text(src.read_text())", ], From a433d76cc4f21537986ac9315262fc1d84492fd6 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:51:46 +0900 Subject: [PATCH 17/40] simplify the script --- docs/sphinx/BUILD.bazel | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index 6d598ca3c4..eba51dc1fb 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -185,13 +185,15 @@ write_file( content = [ "#!/usr/bin/env python3", "", + "from os import environ", "from pathlib import Path", - "import os", + "from sys import stderr", "", - 'src = Path(os.environ["REQUIREMENTS_FILE"])', - 'dst = Path(os.environ["BUILD_WORKSPACE_DIRECTORY"]) / "docs" / "sphinx" / "requirements.txt"', - 'print(f"Writing requirements contents from {src} to {dst}")', + 'src = Path(environ["REQUIREMENTS_FILE"])', + 'dst = Path(environ["BUILD_WORKSPACE_DIRECTORY"]) / "docs" / "sphinx" / "requirements.txt"', + 'print(f"Writing requirements contents from {src} to {dst}", file=stderr)', "dst.write_text(src.read_text())", + 'print("Success!", file=stderr)', ], target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, ) From 9848dc5f398535ebf8318ab6711b552ac86ba431 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:55:32 +0900 Subject: [PATCH 18/40] fixup imports for the code --- python/private/pypi/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 2b5e14061f..55bb17e4b2 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -175,6 +175,7 @@ bzl_library( ":requirements_files_by_platform_bzl", ":whl_target_platforms_bzl", "//python/private:normalize_name_bzl", + "//python/private:repo_utils_bzl", ], ) From 4da49674312e629e7067144efb5fbe507235023e Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:52:35 +0300 Subject: [PATCH 19/40] add logger to evaluate markers and pass ctx explicitly --- python/private/pypi/evaluate_markers.bzl | 7 ++++--- python/private/pypi/extension.bzl | 3 ++- python/private/pypi/parse_requirements.bzl | 12 ++++++------ .../parse_requirements/parse_requirements_tests.bzl | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index 5bde04107d..4ceaf3947b 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -17,7 +17,7 @@ load("//python/private:repo_utils.bzl", "repo_utils") load(":pypi_repo_utils.bzl", "pypi_repo_utils") -def evaluate_markers(ctx, *, requirements, python_interpreter, python_interpreter_target): +def evaluate_markers(ctx, *, requirements, python_interpreter, python_interpreter_target, logger): """Return the list of supported platforms per requirements line. Args: @@ -29,6 +29,7 @@ def evaluate_markers(ctx, *, requirements, python_interpreter, python_interprete should be something that is in your PATH or an absolute path. python_interpreter_target: Label, same as python_interpreter, but in a label format. + logger: repo_utils.logger or None, a simple struct to log diagnostic messages. Returns: dict of string lists with target platforms @@ -65,9 +66,9 @@ def evaluate_markers(ctx, *, requirements, python_interpreter, python_interprete ], ), }, + logger = logger, ) - ret = json.decode(ctx.read(out_file)) - return ret + return json.decode(ctx.read(out_file)) def _watch_srcs(ctx): """watch python srcs that do work here. diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index ed8c277c23..ddbc071b43 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -196,11 +196,12 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s logger = logger, ), get_index_urls = get_index_urls, - evaluate_markers = lambda requirements: evaluate_markers( + evaluate_markers = lambda module_ctx, requirements: evaluate_markers( module_ctx, requirements = requirements, python_interpreter = pip_attr.python_interpreter, python_interpreter_target = python_interpreter_target, + logger = logger, ), logger = logger, ) diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index c6ab0d3a5c..eee97d7019 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -38,7 +38,7 @@ def parse_requirements( requirements_by_platform = {}, extra_pip_args = [], get_index_urls = None, - evaluate_markers = lambda _: {}, + evaluate_markers = lambda *_: {}, logger = None): """Get the requirements with platforms that the requirements apply to. @@ -53,10 +53,10 @@ def parse_requirements( of the distribution URLs from a PyPI index. Accepts ctx and distribution names to query. evaluate_markers: A function to use to evaluate the requirements. - Accepts a dict where keys are requirement lines to evaluate against - the platforms stored as values in the input dict. Returns the same - dict, but with values being platforms that are compatible with the - requirements line. + Accepts the ctx and a dict where keys are requirement lines to + evaluate against the platforms stored as values in the input dict. + Returns the same dict, but with values being platforms that are + compatible with the requirements line. logger: repo_utils.logger or None, a simple struct to log diagnostic messages. Returns: @@ -147,7 +147,7 @@ def parse_requirements( # to do, we could use Python to parse the requirement lines and infer the # URL of the files to download things from. This should be important for # VCS package references. - env_marker_target_platforms = evaluate_markers(reqs_with_env_markers) + env_marker_target_platforms = evaluate_markers(ctx, reqs_with_env_markers) if logger: logger.debug(lambda: "Evaluated env markers from:\n{}\n\nTo:\n{}".format( reqs_with_env_markers, diff --git a/tests/pypi/parse_requirements/parse_requirements_tests.bzl b/tests/pypi/parse_requirements/parse_requirements_tests.bzl index b374f1da2b..d6eccc8c5e 100644 --- a/tests/pypi/parse_requirements/parse_requirements_tests.bzl +++ b/tests/pypi/parse_requirements/parse_requirements_tests.bzl @@ -202,7 +202,7 @@ def _test_select_requirement_none_platform(env): _tests.append(_test_select_requirement_none_platform) def _test_env_marker_resolution(env): - def _mock_eval_markers(input): + def _mock_eval_markers(_, input): ret = { "foo[extra]==0.0.1 ;marker --hash=sha256:deadbeef": ["cp311_windows_x86_64"], } From 566a6546205af2085facc7fa23e0e7b4fbc6abb2 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:55:30 +0300 Subject: [PATCH 20/40] use mrctx --- python/private/pypi/evaluate_markers.bzl | 33 +++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index 4ceaf3947b..0e3b696901 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -17,11 +17,11 @@ load("//python/private:repo_utils.bzl", "repo_utils") load(":pypi_repo_utils.bzl", "pypi_repo_utils") -def evaluate_markers(ctx, *, requirements, python_interpreter, python_interpreter_target, logger): +def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpreter_target, logger): """Return the list of supported platforms per requirements line. Args: - ctx: repository_ctx or module_ctx. + mrctx: repository_ctx or module_ctx. requirements: The requirement file lines to evaluate. python_interpreter: str, path to the python_interpreter to use to evaluate the env markers in the given requirements files. It will @@ -37,18 +37,18 @@ def evaluate_markers(ctx, *, requirements, python_interpreter, python_interprete if not requirements: return {} - _watch_srcs(ctx) + _watch_srcs(mrctx) - in_file = ctx.path("requirements_with_markers.in.json") - out_file = ctx.path("requirements_with_markers.out.json") - ctx.file(in_file, json.encode(requirements)) + in_file = mrctx.path("requirements_with_markers.in.json") + out_file = mrctx.path("requirements_with_markers.out.json") + mrctx.file(in_file, json.encode(requirements)) repo_utils.execute_checked( - ctx, + mrctx, op = "ResolveRequirementEnvMarkers({})".format(in_file), arguments = [ pypi_repo_utils.resolve_python_interpreter( - ctx, + mrctx, python_interpreter = python_interpreter, python_interpreter_target = python_interpreter_target, ), @@ -59,7 +59,7 @@ def evaluate_markers(ctx, *, requirements, python_interpreter, python_interprete ], environment = { "PYTHONPATH": pypi_repo_utils.construct_pythonpath( - ctx, + mrctx, entries = [ Label("@pypi__packaging//:BUILD.bazel"), Label("//:MODULE.bazel"), @@ -68,9 +68,9 @@ def evaluate_markers(ctx, *, requirements, python_interpreter, python_interprete }, logger = logger, ) - return json.decode(ctx.read(out_file)) + return json.decode(mrctx.read(out_file)) -def _watch_srcs(ctx): +def _watch_srcs(mrctx): """watch python srcs that do work here. NOTE @aignas 2024-07-13: we could in theory have a label list that @@ -79,12 +79,15 @@ def _watch_srcs(ctx): within the `pypi__packaging` repository and re-execute whenever they change. This includes re-executing when the 'packaging' version is upgraded. + + Args: + mrctx: repository_ctx or module_ctx. """ - packaging = ctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname - if not hasattr(ctx, "watch"): + packaging = mrctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname + if not hasattr(mrctx, "watch"): return - srcdir = ctx.path(Label(":BUILD.bazel")).dirname + srcdir = mrctx.path(Label(":BUILD.bazel")).dirname for src in [ srcdir.get_child("whl_installer", "platform.py"), srcdir.get_child("requirements_parser", "resolve_target_platforms.py"), @@ -93,4 +96,4 @@ def _watch_srcs(ctx): for src in packaging.readdir(watch = "no") if not src.is_dir and src.basename.endswith(".py") ]: - ctx.watch(src) + mrctx.watch(src) From d62a2ffea29298d189f291c5ed18df6f10d120ef Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:05:31 +0300 Subject: [PATCH 21/40] use mrctx everywhere --- python/private/repo_utils.bzl | 120 +++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 54 deletions(-) diff --git a/python/private/repo_utils.bzl b/python/private/repo_utils.bzl index 1c50ac6bf4..7d59da15b1 100644 --- a/python/private/repo_utils.bzl +++ b/python/private/repo_utils.bzl @@ -20,34 +20,34 @@ This code should only be loaded and used during the repository phase. REPO_DEBUG_ENV_VAR = "RULES_PYTHON_REPO_DEBUG" REPO_VERBOSITY_ENV_VAR = "RULES_PYTHON_REPO_DEBUG_VERBOSITY" -def _is_repo_debug_enabled(rctx): +def _is_repo_debug_enabled(mrctx): """Tells if debbugging output is requested during repo operatiosn. Args: - rctx: repository_ctx object + mrctx: repository_ctx or module_ctx object Returns: True if enabled, False if not. """ - return _getenv(rctx, REPO_DEBUG_ENV_VAR) == "1" + return _getenv(mrctx, REPO_DEBUG_ENV_VAR) == "1" -def _logger(ctx, name = None): +def _logger(mrctx, name = None): """Creates a logger instance for printing messages. Args: - ctx: repository_ctx or module_ctx object. If the attribute + mrctx: repository_ctx or module_ctx object. If the attribute `_rule_name` is present, it will be included in log messages. name: name for the logger. Optional for repository_ctx usage. Returns: A struct with attributes logging: trace, debug, info, warn, fail. """ - if _is_repo_debug_enabled(ctx): + if _is_repo_debug_enabled(mrctx): verbosity_level = "DEBUG" else: verbosity_level = "WARN" - env_var_verbosity = _getenv(ctx, REPO_VERBOSITY_ENV_VAR) + env_var_verbosity = _getenv(mrctx, REPO_VERBOSITY_ENV_VAR) verbosity_level = env_var_verbosity or verbosity_level verbosity = { @@ -56,9 +56,9 @@ def _logger(ctx, name = None): "TRACE": 3, }.get(verbosity_level, 0) - if hasattr(ctx, "attr"): - # This is `repository_ctx`. - name = name or "{}(@@{})".format(getattr(ctx.attr, "_rule_name", "?"), ctx.name) + if hasattr(mrctx, "attr"): + rctx = mrctx # This is `repository_ctx`. + name = name or "{}(@@{})".format(getattr(rctx.attr, "_rule_name", "?"), rctx.name) elif not name: fail("The name has to be specified when using the logger with `module_ctx`") @@ -86,7 +86,7 @@ def _logger(ctx, name = None): ) def _execute_internal( - rctx, + mrctx, *, op, fail_on_error = False, @@ -97,23 +97,31 @@ def _execute_internal( """Execute a subprocess with debugging instrumentation. Args: - rctx: repository_ctx object + mrctx: module_ctx or repository_ctx object op: string, brief description of the operation this command represents. Used to succintly describe it in logging and error messages. fail_on_error: bool, True if fail() should be called if the command fails (non-zero exit code), False if not. - arguments: list of arguments; see rctx.execute#arguments. + arguments: list of arguments; see module_ctx.execute#arguments or + repository_ctx#arguments. environment: optional dict of the environment to run the command - in; see rctx.execute#environment. - logger: optional `Logger` to use for logging execution details. If - not specified, a default will be created. + in; see module_ctx.execute#environment or + repository_ctx.execute#environment. + logger: optional `Logger` to use for logging execution details. Must be + specified when using module_ctx. If not specified, a default will + be created. **kwargs: additional kwargs to pass onto rctx.execute Returns: exec_result object, see repository_ctx.execute return type. """ - logger = logger or _logger(rctx) + if not logger and hasattr(mrctx, "attr"): + rctx = mrctx + logger = _logger(rctx) + elif not logger: + fail("logger must be specified when using 'module_ctx'") + logger.debug(lambda: ( "repo.execute: {op}: start\n" + " command: {cmd}\n" + @@ -123,13 +131,13 @@ def _execute_internal( ).format( op = op, cmd = _args_to_str(arguments), - cwd = _cwd_to_str(rctx, kwargs), + cwd = _cwd_to_str(mrctx, kwargs), timeout = _timeout_to_str(kwargs), env_str = _env_to_str(environment), )) - rctx.report_progress("Running {}".format(op)) - result = rctx.execute(arguments, environment = environment, **kwargs) + mrctx.report_progress("Running {}".format(op)) + result = mrctx.execute(arguments, environment = environment, **kwargs) if fail_on_error and result.return_code != 0: logger.fail(( @@ -144,12 +152,12 @@ def _execute_internal( op = op, cmd = _args_to_str(arguments), return_code = result.return_code, - cwd = _cwd_to_str(rctx, kwargs), + cwd = _cwd_to_str(mrctx, kwargs), timeout = _timeout_to_str(kwargs), env_str = _env_to_str(environment), output = _outputs_to_str(result), )) - elif _is_repo_debug_enabled(rctx): + elif _is_repo_debug_enabled(mrctx): logger.debug(( "repo.execute: {op}: end: {status}\n" + " return code: {return_code}\n" + @@ -167,7 +175,7 @@ def _execute_internal( op = op, arguments = arguments, result = result, - rctx = rctx, + mrctx = mrctx, kwargs = kwargs, environment = environment, ), @@ -207,7 +215,7 @@ def _execute_checked_stdout(*args, **kwargs): """Calls execute_checked, but only returns the stdout value.""" return _execute_checked(*args, **kwargs).stdout -def _execute_describe_failure(*, op, arguments, result, rctx, kwargs, environment): +def _execute_describe_failure(*, op, arguments, result, mrctx, kwargs, environment): return ( "repo.execute: {op}: failure:\n" + " command: {cmd}\n" + @@ -220,35 +228,35 @@ def _execute_describe_failure(*, op, arguments, result, rctx, kwargs, environmen op = op, cmd = _args_to_str(arguments), return_code = result.return_code, - cwd = _cwd_to_str(rctx, kwargs), + cwd = _cwd_to_str(mrctx, kwargs), timeout = _timeout_to_str(kwargs), env_str = _env_to_str(environment), output = _outputs_to_str(result), ) -def _which_checked(rctx, binary_name): +def _which_checked(mrctx, binary_name): """Tests to see if a binary exists, and otherwise fails with a message. Args: binary_name: name of the binary to find. - rctx: repository context. + mrctx: module_ctx or repository_ctx. Returns: - rctx.Path for the binary. + mrctx.Path for the binary. """ - result = _which_unchecked(rctx, binary_name) + result = _which_unchecked(mrctx, binary_name) if result.binary == None: fail(result.describe_failure()) return result.binary -def _which_unchecked(rctx, binary_name): +def _which_unchecked(mrctx, binary_name): """Tests to see if a binary exists. This is also watch the `PATH` environment variable. Args: binary_name: name of the binary to find. - rctx: repository context. + mrctx: repository context. Returns: `struct` with attributes: @@ -256,10 +264,14 @@ def _which_unchecked(rctx, binary_name): * `describe_failure`: `Callable | None`; takes no args. If the binary couldn't be found, provides a detailed error description. """ - path = _getenv(rctx, "PATH", "") - binary = rctx.which(binary_name) + path = _getenv(mrctx, "PATH", "") + binary = mrctx.which(binary_name) if binary: - _watch(rctx, binary) + if hasattr(mrctx, "attr"): + # module_ctx fails to watch files outside the repository, so only + # use it with repository_ctx, which will always have an `attr` + # attribute. + _watch(mrctx, binary) describe_failure = None else: describe_failure = lambda: _which_describe_failure(binary_name, path) @@ -278,9 +290,9 @@ def _which_describe_failure(binary_name, path): path = path, ) -def _getenv(ctx, name, default = None): - # Bazel 7+ API has ctx.getenv - return getattr(ctx, "getenv", ctx.os.environ.get)(name, default) +def _getenv(mrctx, name, default = None): + # Bazel 7+ API has (repository|module)_ctx.getenv + return getattr(mrctx, "getenv", mrctx.os.environ.get)(name, default) def _args_to_str(arguments): return " ".join([_arg_repr(a) for a in arguments]) @@ -294,17 +306,17 @@ def _arg_repr(value): _SPECIAL_SHELL_CHARS = [" ", "'", '"', "{", "$", "("] def _arg_should_be_quoted(value): - # `value` may be non-str, such as ctx.path objects + # `value` may be non-str, such as mrctx.path objects value_str = str(value) for char in _SPECIAL_SHELL_CHARS: if char in value_str: return True return False -def _cwd_to_str(rctx, kwargs): +def _cwd_to_str(mrctx, kwargs): cwd = kwargs.get("working_directory") if not cwd: - cwd = "".format(rctx.path("")) + cwd = "".format(mrctx.path("")) return cwd def _env_to_str(environment): @@ -342,16 +354,16 @@ def _outputs_to_str(result): # @platforms//host:extension.bzl at version 0.0.9 so that we don't # force the users to depend on it. -def _get_platforms_os_name(rctx): +def _get_platforms_os_name(mrctx): """Return the name in @platforms//os for the host os. Args: - rctx: repository_ctx + mrctx: module_ctx or repository_ctx. Returns: `str`. The target name. """ - os = rctx.os.name.lower() + os = mrctx.os.name.lower() if os.startswith("mac os"): return "osx" @@ -365,16 +377,16 @@ def _get_platforms_os_name(rctx): return "windows" return os -def _get_platforms_cpu_name(rctx): +def _get_platforms_cpu_name(mrctx): """Return the name in @platforms//cpu for the host arch. Args: - rctx: repository_ctx + mrctx: module_ctx or repository_ctx. Returns: `str`. The target name. """ - arch = rctx.os.arch.lower() + arch = mrctx.os.arch.lower() if arch in ["i386", "i486", "i586", "i686", "i786", "x86"]: return "x86_32" if arch in ["amd64", "x86_64", "x64"]: @@ -394,16 +406,16 @@ def _get_platforms_cpu_name(rctx): return arch # TODO: Remove after Bazel 6 support dropped -def _watch(rctx, *args, **kwargs): - """Calls rctx.watch, if available.""" - if hasattr(rctx, "watch"): - rctx.watch(*args, **kwargs) +def _watch(mrctx, *args, **kwargs): + """Calls mrctx.watch, if available.""" + if hasattr(mrctx, "watch"): + mrctx.watch(*args, **kwargs) # TODO: Remove after Bazel 6 support dropped -def _watch_tree(rctx, *args, **kwargs): - """Calls rctx.watch_tree, if available.""" - if hasattr(rctx, "watch_tree"): - rctx.watch_tree(*args, **kwargs) +def _watch_tree(mrctx, *args, **kwargs): + """Calls mrctx.watch_tree, if available.""" + if hasattr(mrctx, "watch_tree"): + mrctx.watch_tree(*args, **kwargs) repo_utils = struct( # keep sorted From a3f6a11bb0c286f7b656c8d8e9af0623026670f2 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:12:11 +0300 Subject: [PATCH 22/40] more usage of mrctx --- python/private/pypi/pypi_repo_utils.bzl | 31 +++++++++++-------------- python/private/repo_utils.bzl | 6 +---- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/python/private/pypi/pypi_repo_utils.bzl b/python/private/pypi/pypi_repo_utils.bzl index 1f9f050893..a4189493e9 100644 --- a/python/private/pypi/pypi_repo_utils.bzl +++ b/python/private/pypi/pypi_repo_utils.bzl @@ -16,11 +16,11 @@ load("//python/private:repo_utils.bzl", "repo_utils") -def _get_python_interpreter_attr(ctx, *, python_interpreter = None): +def _get_python_interpreter_attr(mrctx, *, python_interpreter = None): """A helper function for getting the `python_interpreter` attribute or it's default Args: - ctx (repository_ctx): Handle to the rule repository context. + mrctx (module_ctx or repository_ctx): Handle to the rule repository context. python_interpreter (str): The python interpreter override. Returns: @@ -29,29 +29,29 @@ def _get_python_interpreter_attr(ctx, *, python_interpreter = None): if python_interpreter: return python_interpreter - os = repo_utils.get_platforms_os_name(ctx) + os = repo_utils.get_platforms_os_name(mrctx) if "windows" in os: return "python.exe" else: return "python3" -def _resolve_python_interpreter(ctx, *, python_interpreter = None, python_interpreter_target = None): +def _resolve_python_interpreter(mrctx, *, python_interpreter = None, python_interpreter_target = None): """Helper function to find the python interpreter from the common attributes Args: - ctx: Handle to the rule module_ctx or repository_ctx. + mrctx: Handle to the module_ctx or repository_ctx. python_interpreter: The python interpreter to use. python_interpreter_target: The python interpreter to use after downloading the label. Returns: `path` object, for the resolved path to the Python interpreter. """ - python_interpreter = _get_python_interpreter_attr(ctx, python_interpreter = python_interpreter) + python_interpreter = _get_python_interpreter_attr(mrctx, python_interpreter = python_interpreter) if python_interpreter_target != None: - python_interpreter = ctx.path(python_interpreter_target) + python_interpreter = mrctx.path(python_interpreter_target) - os = repo_utils.get_platforms_os_name(ctx) + os = repo_utils.get_platforms_os_name(mrctx) # On Windows, the symlink doesn't work because Windows attempts to find # Python DLLs where the symlink is, not where the symlink points. @@ -59,31 +59,28 @@ def _resolve_python_interpreter(ctx, *, python_interpreter = None, python_interp python_interpreter = python_interpreter.realpath elif "/" not in python_interpreter: # It's a plain command, e.g. "python3", to look up in the environment. - found_python_interpreter = ctx.which(python_interpreter) - if not found_python_interpreter: - fail("python interpreter `{}` not found in PATH".format(python_interpreter)) - python_interpreter = found_python_interpreter + python_interpreter = repo_utils.which_checked(mrctx, python_interpreter) else: - python_interpreter = ctx.path(python_interpreter) + python_interpreter = mrctx.path(python_interpreter) return python_interpreter -def _construct_pypath(ctx, *, entries): +def _construct_pypath(mrctx, *, entries): """Helper function to construct a PYTHONPATH. Contains entries for code in this repo as well as packages downloaded from //python/pip_install:repositories.bzl. This allows us to run python code inside repository rule implementations. Args: - ctx: Handle to the module_ctx or repository_ctx. + mrctx: Handle to the module_ctx or repository_ctx. entries: The list of entries to add to PYTHONPATH. Returns: String of the PYTHONPATH. """ - os = repo_utils.get_platforms_os_name(ctx) + os = repo_utils.get_platforms_os_name(mrctx) separator = ";" if "windows" in os else ":" pypath = separator.join([ - str(ctx.path(entry).dirname) + str(mrctx.path(entry).dirname) # Use a dict as a way to remove duplicates and then sort it. for entry in sorted({x: None for x in entries}) ]) diff --git a/python/private/repo_utils.bzl b/python/private/repo_utils.bzl index 7d59da15b1..aab0325a49 100644 --- a/python/private/repo_utils.bzl +++ b/python/private/repo_utils.bzl @@ -267,11 +267,7 @@ def _which_unchecked(mrctx, binary_name): path = _getenv(mrctx, "PATH", "") binary = mrctx.which(binary_name) if binary: - if hasattr(mrctx, "attr"): - # module_ctx fails to watch files outside the repository, so only - # use it with repository_ctx, which will always have an `attr` - # attribute. - _watch(mrctx, binary) + _watch(mrctx, binary) describe_failure = None else: describe_failure = lambda: _which_describe_failure(binary_name, path) From d53e04ade6e9fb3e65aa028b6acf28db0ef8be73 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:13:54 +0300 Subject: [PATCH 23/40] comment: docstring --- python/private/pypi/evaluate_markers.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index 0e3b696901..5fba962ad0 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -22,7 +22,7 @@ def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpre Args: mrctx: repository_ctx or module_ctx. - requirements: The requirement file lines to evaluate. + requirements: list[str] of the requirement file lines to evaluate. python_interpreter: str, path to the python_interpreter to use to evaluate the env markers in the given requirements files. It will be only called if the requirements files have env markers. This From 3d2f314e3edf4ac00cc898c3ad027511b7ff50f4 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:17:57 +0300 Subject: [PATCH 24/40] add a comment about the runtime cost --- python/private/pypi/extension.bzl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index ddbc071b43..e4d3d5b1b3 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -196,6 +196,20 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s logger = logger, ), get_index_urls = get_index_urls, + # NOTE @aignas 2024-08-02: , we will execute any interpreter that we find either + # in the PATH or if specified as a label. We will configure the env + # markers when evaluating the requirement lines based on the output + # from the `requirements_files_by_platform` which should have something + # similar to: + # { + # "//:requirements.txt": ["cp311_linux_x86_64", ...] + # } + # + # We know the target python versions that we need to evaluate the + # markers for and thus we don't need to use multiple python interpreter + # instances to perform this manipulation. This function should be executed + # only once by the underlying code to minimize the overhead needed to + # spin up a Python interpreter. evaluate_markers = lambda module_ctx, requirements: evaluate_markers( module_ctx, requirements = requirements, From 2522ccdee91b6c3e012564ac1f447370fff5a36f Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:20:14 +0300 Subject: [PATCH 25/40] fixup tests --- python/private/pypi/pip_repository.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl index b058a97784..875a0dc7a4 100644 --- a/python/private/pypi/pip_repository.bzl +++ b/python/private/pypi/pip_repository.bzl @@ -82,7 +82,7 @@ def _pip_repository_impl(rctx): extra_pip_args = rctx.attr.extra_pip_args, ), extra_pip_args = rctx.attr.extra_pip_args, - evaluate_markers = lambda requirements: evaluate_markers( + evaluate_markers = lambda rctx, requirements: evaluate_markers( rctx, requirements = requirements, python_interpreter = rctx.attr.python_interpreter, From 56c1fdc6cdaf4d1dce527892a59272b834d0ef5f Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:21:51 +0300 Subject: [PATCH 26/40] default logger to None --- python/private/pypi/evaluate_markers.bzl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index 5fba962ad0..82cc3b962e 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -17,7 +17,7 @@ load("//python/private:repo_utils.bzl", "repo_utils") load(":pypi_repo_utils.bzl", "pypi_repo_utils") -def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpreter_target, logger): +def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpreter_target, logger = None): """Return the list of supported platforms per requirements line. Args: @@ -29,7 +29,8 @@ def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpre should be something that is in your PATH or an absolute path. python_interpreter_target: Label, same as python_interpreter, but in a label format. - logger: repo_utils.logger or None, a simple struct to log diagnostic messages. + logger: repo_utils.logger or None, a simple struct to log diagnostic + messages. Defaults to None. Returns: dict of string lists with target platforms From 04447ee7665ca7b41ce7c6133445bc1ade572532 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:23:11 +0300 Subject: [PATCH 27/40] update changelog to clarify wording --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67639d6ad6..b26bd06c68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,7 +69,8 @@ A brief description of the categories of changes: * (toolchains) New Python versions available: `3.12.4` using the [20240726] release. * (pypi) Support env markers in requirements files. Note, that this means that if your requirements files contain env markers, the Python interpreter will - have to be downloaded to re-evaluate the bzlmod extension. + have to be downloaded (if you are not using system Python) to evaluate the + bzlmod extension. [rules_python_pytest]: https://github.com/caseyduquettesc/rules_python_pytest [py_test_main]: https://docs.aspect.build/rulesets/aspect_rules_py/docs/rules/#py_pytest_main From b25e62d42f76fe01b7de7bd31422bc55bd9eda25 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:24:44 +0300 Subject: [PATCH 28/40] remove shebang --- docs/sphinx/BUILD.bazel | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index b56fb4387f..a03fa6801f 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -183,8 +183,6 @@ write_file( name = "gen_update_requirements", out = "requirements.update.py", content = [ - "#!/usr/bin/env python3", - "", "from os import environ", "from pathlib import Path", "from sys import stderr", From 99e401b941e12db37bcf1eca98569ef24c7ef3fb Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:31:37 +0300 Subject: [PATCH 29/40] pass pythonpath entries as a default attribute to the rule or tag_class --- python/private/pypi/evaluate_markers.bzl | 11 +++-------- python/private/pypi/extension.bzl | 1 + python/private/pypi/pip_repository.bzl | 1 + python/private/pypi/pip_repository_attrs.bzl | 9 +++++++++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index 82cc3b962e..ae6c8de079 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -17,7 +17,7 @@ load("//python/private:repo_utils.bzl", "repo_utils") load(":pypi_repo_utils.bzl", "pypi_repo_utils") -def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpreter_target, logger = None): +def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpreter_target, pythonpath, logger = None): """Return the list of supported platforms per requirements line. Args: @@ -29,6 +29,7 @@ def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpre should be something that is in your PATH or an absolute path. python_interpreter_target: Label, same as python_interpreter, but in a label format. + pythonpath: list[Label] of the directories to include in the Python PATH. logger: repo_utils.logger or None, a simple struct to log diagnostic messages. Defaults to None. @@ -59,13 +60,7 @@ def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpre out_file, ], environment = { - "PYTHONPATH": pypi_repo_utils.construct_pythonpath( - mrctx, - entries = [ - Label("@pypi__packaging//:BUILD.bazel"), - Label("//:MODULE.bazel"), - ], - ), + "PYTHONPATH": pypi_repo_utils.construct_pythonpath(mrctx, entries = pythonpath), }, logger = logger, ) diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index e4d3d5b1b3..341761fcfb 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -215,6 +215,7 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s requirements = requirements, python_interpreter = pip_attr.python_interpreter, python_interpreter_target = python_interpreter_target, + pythonpath = pip_attr._pythonpath, logger = logger, ), logger = logger, diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl index 875a0dc7a4..cd73daa0b2 100644 --- a/python/private/pypi/pip_repository.bzl +++ b/python/private/pypi/pip_repository.bzl @@ -87,6 +87,7 @@ def _pip_repository_impl(rctx): requirements = requirements, python_interpreter = rctx.attr.python_interpreter, python_interpreter_target = rctx.attr.python_interpreter_target, + pythonpath = rctx.attr._pythonpath, ), ) selected_requirements = {} diff --git a/python/private/pypi/pip_repository_attrs.bzl b/python/private/pypi/pip_repository_attrs.bzl index 23000869e9..94df9a51fc 100644 --- a/python/private/pypi/pip_repository_attrs.bzl +++ b/python/private/pypi/pip_repository_attrs.bzl @@ -66,6 +66,15 @@ Controls if the hub alias dependencies are used. If set to true, then the group_library will be included in the hub repo. True will become default in a subsequent release. +""", + ), + "_pythonpath": attr.label_list( + default = [ + Label("@pypi__packaging//:BUILD.bazel"), + Label("//:BUILD.bazel"), + ], + doc = """\ +A list of PYTHONPATH entries to add when executing python scripts. """, ), } From 282592be1f906e5569e4d0e2ba5fd9eb2bf9eb4f Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:26:20 +0300 Subject: [PATCH 30/40] just hardcode the sources for the marker evaluation for now --- python/private/pypi/evaluate_markers.bzl | 42 ++++++++++++------- python/private/pypi/extension.bzl | 1 - python/private/pypi/pip_repository.bzl | 1 - python/private/pypi/pip_repository_attrs.bzl | 9 ---- .../pypi/requirements_parser/BUILD.bazel | 0 5 files changed, 28 insertions(+), 25 deletions(-) create mode 100644 python/private/pypi/requirements_parser/BUILD.bazel diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index ae6c8de079..b093a709ff 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -17,7 +17,30 @@ load("//python/private:repo_utils.bzl", "repo_utils") load(":pypi_repo_utils.bzl", "pypi_repo_utils") -def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpreter_target, pythonpath, logger = None): +_SRCS = { + Label("@pypi__packaging//:BUILD.bazel"): [ + Label("@pypi__packaging//:packaging/__init__.py"), + Label("@pypi__packaging//:packaging/_elffile.py"), + Label("@pypi__packaging//:packaging/_manylinux.py"), + Label("@pypi__packaging//:packaging/_musllinux.py"), + Label("@pypi__packaging//:packaging/_parser.py"), + Label("@pypi__packaging//:packaging/_structures.py"), + Label("@pypi__packaging//:packaging/_tokenizer.py"), + Label("@pypi__packaging//:packaging/markers.py"), + Label("@pypi__packaging//:packaging/metadata.py"), + Label("@pypi__packaging//:packaging/requirements.py"), + Label("@pypi__packaging//:packaging/specifiers.py"), + Label("@pypi__packaging//:packaging/tags.py"), + Label("@pypi__packaging//:packaging/utils.py"), + Label("@pypi__packaging//:packaging/version.py"), + ], + Label("//:BUILD.bazel"): [ + Label("//python/private/pypi/requirements_parser:resolve_target_platforms.py"), + Label("//python/private/pypi/whl_installer:platform.py"), + ], +} + +def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpreter_target, logger = None): """Return the list of supported platforms per requirements line. Args: @@ -29,7 +52,6 @@ def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpre should be something that is in your PATH or an absolute path. python_interpreter_target: Label, same as python_interpreter, but in a label format. - pythonpath: list[Label] of the directories to include in the Python PATH. logger: repo_utils.logger or None, a simple struct to log diagnostic messages. Defaults to None. @@ -60,7 +82,7 @@ def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpre out_file, ], environment = { - "PYTHONPATH": pypi_repo_utils.construct_pythonpath(mrctx, entries = pythonpath), + "PYTHONPATH": pypi_repo_utils.construct_pythonpath(mrctx, entries = _SRCS), }, logger = logger, ) @@ -79,17 +101,9 @@ def _watch_srcs(mrctx): Args: mrctx: repository_ctx or module_ctx. """ - packaging = mrctx.path(Label("@pypi__packaging//:BUILD.bazel")).dirname if not hasattr(mrctx, "watch"): return - srcdir = mrctx.path(Label(":BUILD.bazel")).dirname - for src in [ - srcdir.get_child("whl_installer", "platform.py"), - srcdir.get_child("requirements_parser", "resolve_target_platforms.py"), - ] + [ - src - for src in packaging.readdir(watch = "no") - if not src.is_dir and src.basename.endswith(".py") - ]: - mrctx.watch(src) + for _, srcs in _SRCS.items(): + for src in srcs: + mrctx.watch(mrctx.path(src)) diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index 341761fcfb..e4d3d5b1b3 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -215,7 +215,6 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s requirements = requirements, python_interpreter = pip_attr.python_interpreter, python_interpreter_target = python_interpreter_target, - pythonpath = pip_attr._pythonpath, logger = logger, ), logger = logger, diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl index cd73daa0b2..875a0dc7a4 100644 --- a/python/private/pypi/pip_repository.bzl +++ b/python/private/pypi/pip_repository.bzl @@ -87,7 +87,6 @@ def _pip_repository_impl(rctx): requirements = requirements, python_interpreter = rctx.attr.python_interpreter, python_interpreter_target = rctx.attr.python_interpreter_target, - pythonpath = rctx.attr._pythonpath, ), ) selected_requirements = {} diff --git a/python/private/pypi/pip_repository_attrs.bzl b/python/private/pypi/pip_repository_attrs.bzl index 94df9a51fc..23000869e9 100644 --- a/python/private/pypi/pip_repository_attrs.bzl +++ b/python/private/pypi/pip_repository_attrs.bzl @@ -66,15 +66,6 @@ Controls if the hub alias dependencies are used. If set to true, then the group_library will be included in the hub repo. True will become default in a subsequent release. -""", - ), - "_pythonpath": attr.label_list( - default = [ - Label("@pypi__packaging//:BUILD.bazel"), - Label("//:BUILD.bazel"), - ], - doc = """\ -A list of PYTHONPATH entries to add when executing python scripts. """, ), } diff --git a/python/private/pypi/requirements_parser/BUILD.bazel b/python/private/pypi/requirements_parser/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 From 3521c4dc5d813488ee44ca21280eec0b22ae55af Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:26:27 +0300 Subject: [PATCH 31/40] just hardcode the sources for the marker evaluation for now --- python/private/pypi/evaluate_markers.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index b093a709ff..540c50a609 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -104,6 +104,6 @@ def _watch_srcs(mrctx): if not hasattr(mrctx, "watch"): return - for _, srcs in _SRCS.items(): + for srcs in _SRCS.values(): for src in srcs: mrctx.watch(mrctx.path(src)) From ec443904e2c2badbf8c079a959e0aeb1d86c94db Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:32:45 +0300 Subject: [PATCH 32/40] add a build_test for marker evaluation as a stop gap, before the PR is ready for final review a better test should be added --- .bazelrc | 4 ++-- tests/pypi/evaluate_markers/BUILD.bazel | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/pypi/evaluate_markers/BUILD.bazel diff --git a/.bazelrc b/.bazelrc index 1ca469cd75..b484751c3c 100644 --- a/.bazelrc +++ b/.bazelrc @@ -4,8 +4,8 @@ # (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it) # To update these lines, execute # `bazel run @rules_bazel_integration_test//tools:update_deleted_packages` -build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered -query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered +build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered +query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered test --test_output=errors diff --git a/tests/pypi/evaluate_markers/BUILD.bazel b/tests/pypi/evaluate_markers/BUILD.bazel new file mode 100644 index 0000000000..aba9264953 --- /dev/null +++ b/tests/pypi/evaluate_markers/BUILD.bazel @@ -0,0 +1,7 @@ +load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@dev_pip//:requirements.bzl", "all_whl_requirements") + +build_test( + name = "all_dev_wheels", + targets = all_whl_requirements, +) From 44c46d2e1a618723b060aaad97771aec11feecbe Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:34:27 +0300 Subject: [PATCH 33/40] fixup tests --- tests/pypi/parse_requirements/parse_requirements_tests.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/pypi/parse_requirements/parse_requirements_tests.bzl b/tests/pypi/parse_requirements/parse_requirements_tests.bzl index d6eccc8c5e..25d2961a34 100644 --- a/tests/pypi/parse_requirements/parse_requirements_tests.bzl +++ b/tests/pypi/parse_requirements/parse_requirements_tests.bzl @@ -216,7 +216,6 @@ def _test_env_marker_resolution(env): requirements_by_platform = { "requirements_marker": ["cp311_linux_super_exotic", "cp311_windows_x86_64"], }, - python_version = "3.11", evaluate_markers = _mock_eval_markers, ) env.expect.that_dict(got).contains_exactly({ From 26d9d778da298f10e6698069cfa99f60cc1ee884 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:36:42 +0300 Subject: [PATCH 34/40] bump the sphinx deps --- docs/sphinx/requirements.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/sphinx/requirements.txt b/docs/sphinx/requirements.txt index 7c85b26663..e0d3bba4ff 100644 --- a/docs/sphinx/requirements.txt +++ b/docs/sphinx/requirements.txt @@ -293,9 +293,9 @@ snowballstemmer==2.2.0 \ --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ --hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a # via sphinx -sphinx==7.4.5 \ - --hash=sha256:9f135d8c1d277db67be514be579c4c4a26c8c0e962219aaca5a721b04bd6d0d8 \ - --hash=sha256:a4abe5385bf856df094c1e6cadf24a2351b12057be3670b99a12c05a01d209f5 +sphinx==7.4.7 \ + --hash=sha256:242f92a7ea7e6c5b406fdc2615413890ba9f699114a9c09192d7dfead2ee9cfe \ + --hash=sha256:c2419e2135d11f1951cd994d6eb18a1835bd8fdd8429f9ca375dc1f3281bd239 # via # rules-python-docs (docs/sphinx/pyproject.toml) # myst-parser @@ -305,17 +305,17 @@ sphinx-rtd-theme==2.0.0 \ --hash=sha256:bd5d7b80622406762073a04ef8fadc5f9151261563d47027de09910ce03afe6b \ --hash=sha256:ec93d0856dc280cf3aee9a4c9807c60e027c7f7b461b77aeffed682e68f0e586 # via rules-python-docs (docs/sphinx/pyproject.toml) -sphinxcontrib-applehelp==1.0.8 \ - --hash=sha256:c40a4f96f3776c4393d933412053962fac2b84f4c99a7982ba42e09576a70619 \ - --hash=sha256:cb61eb0ec1b61f349e5cc36b2028e9e7ca765be05e49641c97241274753067b4 +sphinxcontrib-applehelp==2.0.0 \ + --hash=sha256:2f29ef331735ce958efa4734873f084941970894c6090408b079c61b2e1c06d1 \ + --hash=sha256:4cd3f0ec4ac5dd9c17ec65e9ab272c9b867ea77425228e68ecf08d6b28ddbdb5 # via sphinx -sphinxcontrib-devhelp==1.0.6 \ - --hash=sha256:6485d09629944511c893fa11355bda18b742b83a2b181f9a009f7e500595c90f \ - --hash=sha256:9893fd3f90506bc4b97bdb977ceb8fbd823989f4316b28c3841ec128544372d3 +sphinxcontrib-devhelp==2.0.0 \ + --hash=sha256:411f5d96d445d1d73bb5d52133377b4248ec79db5c793ce7dbe59e074b4dd1ad \ + --hash=sha256:aefb8b83854e4b0998877524d1029fd3e6879210422ee3780459e28a1f03a8a2 # via sphinx -sphinxcontrib-htmlhelp==2.0.6 \ - --hash=sha256:1b9af5a2671a61410a868fce050cab7ca393c218e6205cbc7f590136f207395c \ - --hash=sha256:c6597da06185f0e3b4dc952777a04200611ef563882e0c244d27a15ee22afa73 +sphinxcontrib-htmlhelp==2.1.0 \ + --hash=sha256:166759820b47002d22914d64a075ce08f4c46818e17cfc9470a9786b759b19f8 \ + --hash=sha256:c9e2916ace8aad64cc13a0d233ee22317f2b9025b9cf3295249fa985cc7082e9 # via sphinx sphinxcontrib-jquery==4.1 \ --hash=sha256:1620739f04e36a2c779f1a131a2dfd49b2fd07351bf1968ced074365933abc7a \ @@ -329,9 +329,9 @@ sphinxcontrib-qthelp==2.0.0 \ --hash=sha256:4fe7d0ac8fc171045be623aba3e2a8f613f8682731f9153bb2e40ece16b9bbab \ --hash=sha256:b18a828cdba941ccd6ee8445dbe72ffa3ef8cbe7505d8cd1fa0d42d3f2d5f3eb # via sphinx -sphinxcontrib-serializinghtml==1.1.10 \ - --hash=sha256:326369b8df80a7d2d8d7f99aa5ac577f51ea51556ed974e7716cfd4fca3f6cb7 \ - --hash=sha256:93f3f5dc458b91b192fe10c397e324f262cf163d79f3282c158e8436a2c4511f +sphinxcontrib-serializinghtml==2.0.0 \ + --hash=sha256:6e2cb0eef194e10c27ec0023bfeb25badbbb5868244cf5bc5bdc04e4464bf331 \ + --hash=sha256:e9d912827f872c029017a53f0ef2180b327c3f7fd23c87229f7a8e8b70031d4d # via sphinx typing-extensions==4.12.2 \ --hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \ From 51424cf978a1bd223b54afc54afa6aaa83bb597b Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:08:58 +0300 Subject: [PATCH 35/40] create a utility method to run python scripts and ensure the srcs are added to the bzlmod lockfile to re-evaluate the files if the sources change --- python/private/pypi/BUILD.bazel | 1 - python/private/pypi/evaluate_markers.bzl | 71 ++++++------------------ python/private/pypi/extension.bzl | 10 +++- python/private/pypi/pip_repository.bzl | 10 +++- python/private/pypi/pypi_repo_utils.bzl | 53 +++++++++++++++++- 5 files changed, 87 insertions(+), 58 deletions(-) diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 55bb17e4b2..3d2b98293e 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -95,7 +95,6 @@ bzl_library( srcs = ["evaluate_markers.bzl"], deps = [ ":pypi_repo_utils_bzl", - "//python/private:repo_utils_bzl", ], ) diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index 540c50a609..b27997f862 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -14,33 +14,18 @@ """A simple function that evaluates markers using a python interpreter.""" -load("//python/private:repo_utils.bzl", "repo_utils") load(":pypi_repo_utils.bzl", "pypi_repo_utils") -_SRCS = { - Label("@pypi__packaging//:BUILD.bazel"): [ - Label("@pypi__packaging//:packaging/__init__.py"), - Label("@pypi__packaging//:packaging/_elffile.py"), - Label("@pypi__packaging//:packaging/_manylinux.py"), - Label("@pypi__packaging//:packaging/_musllinux.py"), - Label("@pypi__packaging//:packaging/_parser.py"), - Label("@pypi__packaging//:packaging/_structures.py"), - Label("@pypi__packaging//:packaging/_tokenizer.py"), - Label("@pypi__packaging//:packaging/markers.py"), - Label("@pypi__packaging//:packaging/metadata.py"), - Label("@pypi__packaging//:packaging/requirements.py"), - Label("@pypi__packaging//:packaging/specifiers.py"), - Label("@pypi__packaging//:packaging/tags.py"), - Label("@pypi__packaging//:packaging/utils.py"), - Label("@pypi__packaging//:packaging/version.py"), - ], - Label("//:BUILD.bazel"): [ - Label("//python/private/pypi/requirements_parser:resolve_target_platforms.py"), - Label("//python/private/pypi/whl_installer:platform.py"), - ], -} +# Used as a default value in a rule to ensure we fetch the dependencies. In the future we could create a `venv` with the said packages in the `repository_ctx` and only include the sources from the `rules_python` project that we use, but for now this will suffice. +SRCS = [ + # When the version, or any of the files in `packaging` package changes, + # this file will change as well. + Label("@pypi__packaging//:packaging-24.0.dist-info/RECORD"), + Label("//python/private/pypi/requirements_parser:resolve_target_platforms.py"), + Label("//python/private/pypi/whl_installer:platform.py"), +] -def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpreter_target, logger = None): +def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpreter_target, srcs, logger = None): """Return the list of supported platforms per requirements line. Args: @@ -52,6 +37,7 @@ def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpre should be something that is in your PATH or an absolute path. python_interpreter_target: Label, same as python_interpreter, but in a label format. + srcs: list[Label], the value of SRCS passed from the `rctx` or `mctx` to this function. logger: repo_utils.logger or None, a simple struct to log diagnostic messages. Defaults to None. @@ -61,49 +47,26 @@ def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpre if not requirements: return {} - _watch_srcs(mrctx) - in_file = mrctx.path("requirements_with_markers.in.json") out_file = mrctx.path("requirements_with_markers.out.json") mrctx.file(in_file, json.encode(requirements)) - repo_utils.execute_checked( + pypi_repo_utils.execute_checked( mrctx, op = "ResolveRequirementEnvMarkers({})".format(in_file), + python = python_interpreter or python_interpreter_target, arguments = [ - pypi_repo_utils.resolve_python_interpreter( - mrctx, - python_interpreter = python_interpreter, - python_interpreter_target = python_interpreter_target, - ), - "-m", "python.private.pypi.requirements_parser.resolve_target_platforms", in_file, out_file, ], + srcs = srcs, environment = { - "PYTHONPATH": pypi_repo_utils.construct_pythonpath(mrctx, entries = _SRCS), + "PYTHONPATH": [ + Label("@pypi__packaging//:BUILD.bazel"), + Label("//:BUILD.bazel"), + ], }, logger = logger, ) return json.decode(mrctx.read(out_file)) - -def _watch_srcs(mrctx): - """watch python srcs that do work here. - - NOTE @aignas 2024-07-13: we could in theory have a label list that - lists the files that we should include as dependencies to the pip - repo, however, this way works better because we can select files from - within the `pypi__packaging` repository and re-execute whenever they - change. This includes re-executing when the 'packaging' version is - upgraded. - - Args: - mrctx: repository_ctx or module_ctx. - """ - if not hasattr(mrctx, "watch"): - return - - for srcs in _SRCS.values(): - for src in srcs: - mrctx.watch(mrctx.path(src)) diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index e4d3d5b1b3..15b671809f 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -21,7 +21,7 @@ load("//python/private:normalize_name.bzl", "normalize_name") load("//python/private:repo_utils.bzl", "repo_utils") load("//python/private:version_label.bzl", "version_label") load(":attrs.bzl", "use_isolated") -load(":evaluate_markers.bzl", "evaluate_markers") +load(":evaluate_markers.bzl", "evaluate_markers", EVALUATE_MARKERS_SRCS = "SRCS") load(":hub_repository.bzl", "hub_repository") load(":parse_requirements.bzl", "host_platform", "parse_requirements", "select_requirement") load(":parse_whl_name.bzl", "parse_whl_name") @@ -215,6 +215,7 @@ def _create_whl_repos(module_ctx, pip_attr, whl_map, whl_overrides, group_map, s requirements = requirements, python_interpreter = pip_attr.python_interpreter, python_interpreter_target = python_interpreter_target, + srcs = pip_attr._evaluate_markers_srcs, logger = logger, ), logger = logger, @@ -647,6 +648,13 @@ A dict of labels to wheel names that is typically generated by the whl_modificat The labels are JSON config files describing the modifications. """, ), + "_evaluate_markers_srcs": attr.label_list( + default = EVALUATE_MARKERS_SRCS, + doc = """\ + The list of labels to use as SRCS for the marker evaluation code. This ensures that the + code will be re-evaluated when any of files in the default changes. + """, + ), }, **ATTRS) attrs.update(AUTH_ATTRS) diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl index 875a0dc7a4..2f54fdaca8 100644 --- a/python/private/pypi/pip_repository.bzl +++ b/python/private/pypi/pip_repository.bzl @@ -18,7 +18,7 @@ load("@bazel_skylib//lib:sets.bzl", "sets") load("//python/private:normalize_name.bzl", "normalize_name") load("//python/private:repo_utils.bzl", "REPO_DEBUG_ENV_VAR") load("//python/private:text_util.bzl", "render") -load(":evaluate_markers.bzl", "evaluate_markers") +load(":evaluate_markers.bzl", "evaluate_markers", EVALUATE_MARKERS_SRCS = "SRCS") load(":parse_requirements.bzl", "host_platform", "parse_requirements", "select_requirement") load(":pip_repository_attrs.bzl", "ATTRS") load(":render_pkg_aliases.bzl", "render_pkg_aliases", "whl_alias") @@ -87,6 +87,7 @@ def _pip_repository_impl(rctx): requirements = requirements, python_interpreter = rctx.attr.python_interpreter, python_interpreter_target = rctx.attr.python_interpreter_target, + srcs = rctx.attr._evaluate_markers_srcs, ), ) selected_requirements = {} @@ -231,6 +232,13 @@ file](https://github.com/bazelbuild/rules_python/blob/main/examples/pip_reposito _template = attr.label( default = ":requirements.bzl.tmpl.workspace", ), + _evaluate_markers_srcs = attr.label_list( + default = EVALUATE_MARKERS_SRCS, + doc = """\ + The list of labels to use as SRCS for the marker evaluation code. This ensures that the + code will be re-evaluated when any of files in the default changes. + """, + ), **ATTRS ), doc = """Accepts a locked/compiled requirements file and installs the dependencies listed within. diff --git a/python/private/pypi/pypi_repo_utils.bzl b/python/private/pypi/pypi_repo_utils.bzl index a4189493e9..ee4a559766 100644 --- a/python/private/pypi/pypi_repo_utils.bzl +++ b/python/private/pypi/pypi_repo_utils.bzl @@ -77,6 +77,9 @@ def _construct_pypath(mrctx, *, entries): Returns: String of the PYTHONPATH. """ + if not entries: + return None + os = repo_utils.get_platforms_os_name(mrctx) separator = ";" if "windows" in os else ":" pypath = separator.join([ @@ -86,7 +89,55 @@ def _construct_pypath(mrctx, *, entries): ]) return pypath +def _execute_checked(mrctx, *, python, arguments, srcs, **kwargs): + """Helper function to run a python script and modify the PYTHONPATH to include external deps. + + Args: + mrctx: Handle to the module_ctx or repository_ctx. + python: Label or str pointing to the interpreter. If it is a `str` then + it is assumed to be in on the PATH or the string is a path. + arguments: Extra arguments, which would be present in the `python -m ` place. + srcs: The src files that the script depends on. This is important to + ensure that the bazel repository cache or the bzlmod lock file gets + invalidated when any one file changes. It is advisable to use + `RECORD` files for external deps and the list of srcs from the + rules_python repo for any scripts. + **kwargs: Extra arguments forwarded to `repo_utils.execute_checked`. If + the `environment` has a value `PYTHONPATH` and it is a list, then + it will be passed to `construct_pythonpath` function. + """ + + for src in srcs: + # This will ensure that we will re-evaluate the bzlmod extension or + # refetch the repository_rule when the srcs change. This should work on + # bazel versions without `mrctx.watch` as well. + repo_utils.watch(mrctx.path(src)) + + python_interpreter = "" if str(python).startswith("@") else python + python_interpreter_target = python if not python_interpreter else None + + env = kwargs.pop("environment", {}) + pythonpath = env.get("PYTHONPATH", "") + if pythonpath and isinstance(pythonpath, list): + env["PYTHONPATH"] = _construct_pypath(mrctx, entries = pythonpath) + + return repo_utils.execute_checked( + mrctx, + op = op, + arguments = [ + _resolve_python_interpreter( + mrctx, + python_interpreter = python_interpreter, + python_interpreter_target = python_interpreter_target, + ), + "-m", + ] + arguments, + environment = env, + **kwargs + ) + pypi_repo_utils = struct( - resolve_python_interpreter = _resolve_python_interpreter, construct_pythonpath = _construct_pypath, + execute_checked = _execute_checked, + resolve_python_interpreter = _resolve_python_interpreter, ) From 8f148065a7fb46686e83852ac1c6c341a7892df6 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:22:45 +0300 Subject: [PATCH 36/40] distil the interface --- python/private/pypi/BUILD.bazel | 1 + python/private/pypi/evaluate_markers.bzl | 7 +++++- python/private/pypi/pypi_repo_utils.bzl | 27 ++++++------------------ 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 3d2b98293e..3b11dbe7f8 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -245,6 +245,7 @@ bzl_library( srcs = ["pypi_repo_utils.bzl"], deps = [ "//python/private:repo_utils_bzl", + "@bazel_skylib//lib:types", ], ) diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index b27997f862..6960b748c1 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -54,8 +54,13 @@ def evaluate_markers(mrctx, *, requirements, python_interpreter, python_interpre pypi_repo_utils.execute_checked( mrctx, op = "ResolveRequirementEnvMarkers({})".format(in_file), - python = python_interpreter or python_interpreter_target, arguments = [ + pypi_repo_utils.resolve_python_interpreter( + mrctx, + python_interpreter = python_interpreter, + python_interpreter_target = python_interpreter_target, + ), + "-m", "python.private.pypi.requirements_parser.resolve_target_platforms", in_file, out_file, diff --git a/python/private/pypi/pypi_repo_utils.bzl b/python/private/pypi/pypi_repo_utils.bzl index ee4a559766..39927bd063 100644 --- a/python/private/pypi/pypi_repo_utils.bzl +++ b/python/private/pypi/pypi_repo_utils.bzl @@ -14,6 +14,7 @@ "" +load("@bazel_skylib//lib:types.bzl", "types") load("//python/private:repo_utils.bzl", "repo_utils") def _get_python_interpreter_attr(mrctx, *, python_interpreter = None): @@ -40,8 +41,9 @@ def _resolve_python_interpreter(mrctx, *, python_interpreter = None, python_inte Args: mrctx: Handle to the module_ctx or repository_ctx. - python_interpreter: The python interpreter to use. - python_interpreter_target: The python interpreter to use after downloading the label. + python_interpreter: str, the python interpreter to use. + python_interpreter_target: Label, the python interpreter to use after + downloading the label. Returns: `path` object, for the resolved path to the Python interpreter. @@ -89,20 +91,17 @@ def _construct_pypath(mrctx, *, entries): ]) return pypath -def _execute_checked(mrctx, *, python, arguments, srcs, **kwargs): +def _execute_checked(mrctx, *, srcs, **kwargs): """Helper function to run a python script and modify the PYTHONPATH to include external deps. Args: mrctx: Handle to the module_ctx or repository_ctx. - python: Label or str pointing to the interpreter. If it is a `str` then - it is assumed to be in on the PATH or the string is a path. - arguments: Extra arguments, which would be present in the `python -m ` place. srcs: The src files that the script depends on. This is important to ensure that the bazel repository cache or the bzlmod lock file gets invalidated when any one file changes. It is advisable to use `RECORD` files for external deps and the list of srcs from the rules_python repo for any scripts. - **kwargs: Extra arguments forwarded to `repo_utils.execute_checked`. If + **kwargs: Arguments forwarded to `repo_utils.execute_checked`. If the `environment` has a value `PYTHONPATH` and it is a list, then it will be passed to `construct_pythonpath` function. """ @@ -113,25 +112,13 @@ def _execute_checked(mrctx, *, python, arguments, srcs, **kwargs): # bazel versions without `mrctx.watch` as well. repo_utils.watch(mrctx.path(src)) - python_interpreter = "" if str(python).startswith("@") else python - python_interpreter_target = python if not python_interpreter else None - env = kwargs.pop("environment", {}) pythonpath = env.get("PYTHONPATH", "") - if pythonpath and isinstance(pythonpath, list): + if pythonpath and not types.is_string(pythonpath): env["PYTHONPATH"] = _construct_pypath(mrctx, entries = pythonpath) return repo_utils.execute_checked( mrctx, - op = op, - arguments = [ - _resolve_python_interpreter( - mrctx, - python_interpreter = python_interpreter, - python_interpreter_target = python_interpreter_target, - ), - "-m", - ] + arguments, environment = env, **kwargs ) From 20c643cb33924bb68534026f9e5bc9b2eef3d76c Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:36:35 +0300 Subject: [PATCH 37/40] Apply suggestions from self code review --- docs/sphinx/BUILD.bazel | 11 ----------- python/private/pypi/evaluate_markers.bzl | 2 +- python/private/pypi/extension.bzl | 6 +++--- python/private/pypi/pip_repository.bzl | 6 +++--- .../requirements_parser/resolve_target_platforms.py | 2 -- 5 files changed, 7 insertions(+), 20 deletions(-) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index a03fa6801f..1fac7e6660 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -166,17 +166,6 @@ genrule( ], ) -diff_test( - name = "requirements.test", - file1 = "requirements", - file2 = "requirements.txt", - tags = [ - "manual", - "no-cache", - ], - target_compatible_with = _REQUIREMENTS_TARGET_COMPATIBLE_WITH, -) - # Write a script that can be used for updating the in-tree version of the # requirements file write_file( diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl index 6960b748c1..c805fd7a59 100644 --- a/python/private/pypi/evaluate_markers.bzl +++ b/python/private/pypi/evaluate_markers.bzl @@ -16,7 +16,7 @@ load(":pypi_repo_utils.bzl", "pypi_repo_utils") -# Used as a default value in a rule to ensure we fetch the dependencies. In the future we could create a `venv` with the said packages in the `repository_ctx` and only include the sources from the `rules_python` project that we use, but for now this will suffice. +# Used as a default value in a rule to ensure we fetch the dependencies. SRCS = [ # When the version, or any of the files in `packaging` package changes, # this file will change as well. diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index 15b671809f..1bc8f15149 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -651,9 +651,9 @@ The labels are JSON config files describing the modifications. "_evaluate_markers_srcs": attr.label_list( default = EVALUATE_MARKERS_SRCS, doc = """\ - The list of labels to use as SRCS for the marker evaluation code. This ensures that the - code will be re-evaluated when any of files in the default changes. - """, +The list of labels to use as SRCS for the marker evaluation code. This ensures that the +code will be re-evaluated when any of files in the default changes. +""", ), }, **ATTRS) attrs.update(AUTH_ATTRS) diff --git a/python/private/pypi/pip_repository.bzl b/python/private/pypi/pip_repository.bzl index 2f54fdaca8..0c9e300a4d 100644 --- a/python/private/pypi/pip_repository.bzl +++ b/python/private/pypi/pip_repository.bzl @@ -235,9 +235,9 @@ file](https://github.com/bazelbuild/rules_python/blob/main/examples/pip_reposito _evaluate_markers_srcs = attr.label_list( default = EVALUATE_MARKERS_SRCS, doc = """\ - The list of labels to use as SRCS for the marker evaluation code. This ensures that the - code will be re-evaluated when any of files in the default changes. - """, +The list of labels to use as SRCS for the marker evaluation code. This ensures that the +code will be re-evaluated when any of files in the default changes. +""", ), **ATTRS ), diff --git a/python/private/pypi/requirements_parser/resolve_target_platforms.py b/python/private/pypi/requirements_parser/resolve_target_platforms.py index 817853409a..c899a943cc 100755 --- a/python/private/pypi/requirements_parser/resolve_target_platforms.py +++ b/python/private/pypi/requirements_parser/resolve_target_platforms.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 - """A CLI to evaluate env markers for requirements files. A simple script to evaluate the `requirements.txt` files. Currently it is only From 824491b5f61c690a368fae6a0b3e556df1029322 Mon Sep 17 00:00:00 2001 From: aignas <240938+aignas@users.noreply.github.com> Date: Tue, 6 Aug 2024 16:52:59 +0300 Subject: [PATCH 38/40] buildifier --- docs/sphinx/BUILD.bazel | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index 1fac7e6660..1243072b65 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@bazel_skylib//rules:diff_test.bzl", "diff_test") load("@bazel_skylib//rules:write_file.bzl", "write_file") load("@dev_pip//:requirements.bzl", "requirement") load("//python:py_binary.bzl", "py_binary") From c454a7de2b361532020cb954916f015710fdbcad Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Thu, 15 Aug 2024 11:38:48 -0700 Subject: [PATCH 39/40] clarify changelog doc --- CHANGELOG.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b26bd06c68..8448a6dac1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,7 +54,7 @@ A brief description of the categories of changes: `experimental_index_url` feature. Fixes [#2091](https://github.com/bazelbuild/rules_python/issues/2090). * (gazelle) Make `gazelle_python_manifest.update` manual to avoid unnecessary - network behavior. + network behavior. ### Added * (rules) `PYTHONSAFEPATH` is inherited from the calling environment to allow @@ -69,8 +69,9 @@ A brief description of the categories of changes: * (toolchains) New Python versions available: `3.12.4` using the [20240726] release. * (pypi) Support env markers in requirements files. Note, that this means that if your requirements files contain env markers, the Python interpreter will - have to be downloaded (if you are not using system Python) to evaluate the - bzlmod extension. + need to be run during bzlmod phase to evaluate them. This may incur + downloading an interpreter (for hermetic-based builds) or cause non-hermetic + behavior (if using a system Python). [rules_python_pytest]: https://github.com/caseyduquettesc/rules_python_pytest [py_test_main]: https://docs.aspect.build/rulesets/aspect_rules_py/docs/rules/#py_pytest_main From b424d3603c0c9bbebf484e65ebc762d695011ea6 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Thu, 15 Aug 2024 12:00:38 -0700 Subject: [PATCH 40/40] typo: bazel -> Bazel --- python/private/pypi/pypi_repo_utils.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/private/pypi/pypi_repo_utils.bzl b/python/private/pypi/pypi_repo_utils.bzl index 39927bd063..da449b4b50 100644 --- a/python/private/pypi/pypi_repo_utils.bzl +++ b/python/private/pypi/pypi_repo_utils.bzl @@ -97,7 +97,7 @@ def _execute_checked(mrctx, *, srcs, **kwargs): Args: mrctx: Handle to the module_ctx or repository_ctx. srcs: The src files that the script depends on. This is important to - ensure that the bazel repository cache or the bzlmod lock file gets + ensure that the Bazel repository cache or the bzlmod lock file gets invalidated when any one file changes. It is advisable to use `RECORD` files for external deps and the list of srcs from the rules_python repo for any scripts. @@ -109,7 +109,7 @@ def _execute_checked(mrctx, *, srcs, **kwargs): for src in srcs: # This will ensure that we will re-evaluate the bzlmod extension or # refetch the repository_rule when the srcs change. This should work on - # bazel versions without `mrctx.watch` as well. + # Bazel versions without `mrctx.watch` as well. repo_utils.watch(mrctx.path(src)) env = kwargs.pop("environment", {})