@@ -40,16 +40,19 @@ simple==0.0.1 \
4040
4141def hub_builder (
4242 env ,
43+ enable_pipstar = False ,
4344 debug = False ,
4445 config = None ,
4546 minor_mapping = {},
47+ evaluate_markers_fn = None ,
4648 simpleapi_download_fn = None ,
4749 available_interpreters = {}):
4850 builder = _hub_builder (
4951 name = "pypi" ,
5052 module_name = "unit_test" ,
5153 config = config or struct (
5254 # no need to evaluate the markers with the interpreter
55+ enable_pipstar = enable_pipstar ,
5356 platforms = {
5457 "{}_{}{}" .format (os , cpu , freethreaded ): _plat (
5558 name = "{}_{}{}" .format (os , cpu , freethreaded ),
@@ -73,13 +76,13 @@ def hub_builder(
7376 netrc = None ,
7477 auth_patterns = None ,
7578 ),
76- evaluate_markers_fn = None ,
7779 whl_overrides = {},
7880 minor_mapping = minor_mapping or {"3.15" : "3.15.19" },
7981 available_interpreters = available_interpreters or {
8082 "python_3_15_host" : "unit_test_interpreter_target" ,
8183 },
8284 simpleapi_download_fn = simpleapi_download_fn or (lambda * a , ** k : {}),
85+ evaluate_markers_fn = evaluate_markers_fn ,
8386 logger = repo_utils .logger (
8487 struct (
8588 os = struct (
@@ -300,6 +303,14 @@ _tests.append(_test_simple_multiple_python_versions)
300303def _test_simple_with_markers (env ):
301304 builder = hub_builder (
302305 env ,
306+ evaluate_markers_fn = lambda _ , requirements , ** __ : {
307+ key : [
308+ platform
309+ for platform in platforms
310+ if ("x86_64" in platform and "platform_machine ==" in key ) or ("x86_64" not in platform and "platform_machine !=" in key )
311+ ]
312+ for key , platforms in requirements .items ()
313+ },
303314 )
304315 builder .pip_parse (
305316 _mock_mctx (
@@ -394,6 +405,7 @@ def _test_torch_experimental_index_url(env):
394405 env ,
395406 config = struct (
396407 netrc = None ,
408+ enable_pipstar = False ,
397409 auth_patterns = {},
398410 platforms = {
399411 "{}_{}" .format (os , cpu ): _plat (
@@ -419,6 +431,15 @@ def _test_torch_experimental_index_url(env):
419431 "python_3_12_host" : "unit_test_interpreter_target" ,
420432 },
421433 minor_mapping = {"3.12" : "3.12.19" },
434+ evaluate_markers_fn = lambda _ , requirements , ** __ : {
435+ # todo once 2692 is merged, this is going to be easier to test.
436+ key : [
437+ platform
438+ for platform in platforms
439+ if ("x86_64" in platform and "platform_machine ==" in key ) or ("x86_64" not in platform and "platform_machine !=" in key )
440+ ]
441+ for key , platforms in requirements .items ()
442+ },
422443 simpleapi_download_fn = mocksimpleapi_download ,
423444 )
424445 builder .pip_parse (
@@ -495,6 +516,7 @@ torch==2.4.1+cpu ; platform_machine == 'x86_64' \
495516 pypi .whl_libraries ().contains_exactly ({
496517 "pypi_312_torch_cp312_cp312_linux_x86_64_8800deef" : {
497518 "dep_template" : "@pypi//{name}:{target}" ,
519+ "experimental_target_platforms" : ["linux_x86_64" ],
498520 "filename" : "torch-2.4.1+cpu-cp312-cp312-linux_x86_64.whl" ,
499521 "python_interpreter_target" : "unit_test_interpreter_target" ,
500522 "requirement" : "torch==2.4.1+cpu" ,
@@ -503,6 +525,7 @@ torch==2.4.1+cpu ; platform_machine == 'x86_64' \
503525 },
504526 "pypi_312_torch_cp312_cp312_manylinux_2_17_aarch64_36109432" : {
505527 "dep_template" : "@pypi//{name}:{target}" ,
528+ "experimental_target_platforms" : ["linux_aarch64" ],
506529 "filename" : "torch-2.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl" ,
507530 "python_interpreter_target" : "unit_test_interpreter_target" ,
508531 "requirement" : "torch==2.4.1" ,
@@ -511,6 +534,7 @@ torch==2.4.1+cpu ; platform_machine == 'x86_64' \
511534 },
512535 "pypi_312_torch_cp312_cp312_win_amd64_3a570e5c" : {
513536 "dep_template" : "@pypi//{name}:{target}" ,
537+ "experimental_target_platforms" : ["windows_x86_64" ],
514538 "filename" : "torch-2.4.1+cpu-cp312-cp312-win_amd64.whl" ,
515539 "python_interpreter_target" : "unit_test_interpreter_target" ,
516540 "requirement" : "torch==2.4.1+cpu" ,
@@ -519,6 +543,7 @@ torch==2.4.1+cpu ; platform_machine == 'x86_64' \
519543 },
520544 "pypi_312_torch_cp312_none_macosx_11_0_arm64_72b484d5" : {
521545 "dep_template" : "@pypi//{name}:{target}" ,
546+ "experimental_target_platforms" : ["osx_aarch64" ],
522547 "filename" : "torch-2.4.1-cp312-none-macosx_11_0_arm64.whl" ,
523548 "python_interpreter_target" : "unit_test_interpreter_target" ,
524549 "requirement" : "torch==2.4.1" ,
@@ -596,6 +621,8 @@ simple==0.0.3 \
596621 "pypi_315_extra" : {
597622 "dep_template" : "@pypi//{name}:{target}" ,
598623 "download_only" : True ,
624+ # TODO @aignas 2025-04-20: ensure that this is in the hub repo
625+ # "experimental_target_platforms": ["cp315_linux_x86_64"],
599626 "extra_pip_args" : ["--platform=manylinux_2_17_x86_64" , "--python-version=315" , "--implementation=cp" , "--abi=cp315" ],
600627 "python_interpreter_target" : "unit_test_interpreter_target" ,
601628 "requirement" : "extra==0.0.1 --hash=sha256:deadb00f" ,
@@ -794,6 +821,12 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
794821 pypi .whl_libraries ().contains_exactly ({
795822 "pypi_315_any_name" : {
796823 "dep_template" : "@pypi//{name}:{target}" ,
824+ "experimental_target_platforms" : [
825+ "linux_aarch64" ,
826+ "linux_x86_64" ,
827+ "osx_aarch64" ,
828+ "windows_aarch64" ,
829+ ],
797830 "extra_pip_args" : ["--extra-args-for-sdist-building" ],
798831 "filename" : "any-name.tar.gz" ,
799832 "python_interpreter_target" : "unit_test_interpreter_target" ,
@@ -803,6 +836,12 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
803836 },
804837 "pypi_315_direct_without_sha_0_0_1_py3_none_any" : {
805838 "dep_template" : "@pypi//{name}:{target}" ,
839+ "experimental_target_platforms" : [
840+ "linux_aarch64" ,
841+ "linux_x86_64" ,
842+ "osx_aarch64" ,
843+ "windows_aarch64" ,
844+ ],
806845 "filename" : "direct_without_sha-0.0.1-py3-none-any.whl" ,
807846 "python_interpreter_target" : "unit_test_interpreter_target" ,
808847 "requirement" : "direct_without_sha==0.0.1" ,
@@ -823,6 +862,12 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
823862 },
824863 "pypi_315_simple_py3_none_any_deadb00f" : {
825864 "dep_template" : "@pypi//{name}:{target}" ,
865+ "experimental_target_platforms" : [
866+ "linux_aarch64" ,
867+ "linux_x86_64" ,
868+ "osx_aarch64" ,
869+ "windows_aarch64" ,
870+ ],
826871 "filename" : "simple-0.0.1-py3-none-any.whl" ,
827872 "python_interpreter_target" : "unit_test_interpreter_target" ,
828873 "requirement" : "simple==0.0.1" ,
@@ -831,6 +876,12 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
831876 },
832877 "pypi_315_some_pkg_py3_none_any_deadbaaf" : {
833878 "dep_template" : "@pypi//{name}:{target}" ,
879+ "experimental_target_platforms" : [
880+ "linux_aarch64" ,
881+ "linux_x86_64" ,
882+ "osx_aarch64" ,
883+ "windows_aarch64" ,
884+ ],
834885 "filename" : "some_pkg-0.0.1-py3-none-any.whl" ,
835886 "python_interpreter_target" : "unit_test_interpreter_target" ,
836887 "requirement" : "some_pkg==0.0.1" ,
@@ -839,6 +890,12 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
839890 },
840891 "pypi_315_some_py3_none_any_deadb33f" : {
841892 "dep_template" : "@pypi//{name}:{target}" ,
893+ "experimental_target_platforms" : [
894+ "linux_aarch64" ,
895+ "linux_x86_64" ,
896+ "osx_aarch64" ,
897+ "windows_aarch64" ,
898+ ],
842899 "filename" : "some-other-pkg-0.0.1-py3-none-any.whl" ,
843900 "python_interpreter_target" : "unit_test_interpreter_target" ,
844901 "requirement" : "some_other_pkg==0.0.1" ,
@@ -868,6 +925,14 @@ _tests.append(_test_simple_get_index)
868925def _test_optimum_sys_platform_extra (env ):
869926 builder = hub_builder (
870927 env ,
928+ evaluate_markers_fn = lambda _ , requirements , ** __ : {
929+ key : [
930+ platform
931+ for platform in platforms
932+ if ("darwin" in key and "osx" in platform ) or ("linux" in key and "linux" in platform )
933+ ]
934+ for key , platforms in requirements .items ()
935+ },
871936 )
872937 builder .pip_parse (
873938 _mock_mctx (
@@ -881,14 +946,13 @@ optimum[onnxruntime-gpu]==1.17.1 ; sys_platform == 'linux'
881946 _parse (
882947 hub_name = "pypi" ,
883948 python_version = "3.15" ,
884- requirements_by_platform = {
885- "universal.txt" : "linux_*,osx_*" ,
886- },
949+ requirements_lock = "universal.txt" ,
887950 ),
888951 )
889952 pypi = builder .build ()
890953
891- pypi .exposed_packages ().contains_exactly (["optimum" ])
954+ # FIXME @aignas 2025-09-07: we should expose the `optimum` package
955+ pypi .exposed_packages ().contains_exactly ([])
892956 pypi .group_map ().contains_exactly ({})
893957 pypi .whl_map ().contains_exactly ({
894958 "optimum" : {
@@ -931,7 +995,9 @@ _tests.append(_test_optimum_sys_platform_extra)
931995def _test_pipstar_platforms (env ):
932996 builder = hub_builder (
933997 env ,
998+ enable_pipstar = True ,
934999 config = struct (
1000+ enable_pipstar = True ,
9351001 netrc = None ,
9361002 auth_patterns = {},
9371003 platforms = {
0 commit comments