quaint-piano-62770
12/18/2025, 10:13 AMsrc/core-lib-a , src/core-lib-b which are python libraries typically imported in almost all other projects. They depend on 3rd party projects which are fairly common and supported across most platforms/archs, like numpy, pandas, pydantic , etc.
b. src/lib-x , src/lib-y are larger python libraries which depend on projects from point a. But they depend on more 3rd party libraries, often having different variants for CPU vs GPU, macos vs linux and so on, like torch, transformers, etc.
c. and finally, src/proj-i, src/proj-j are more "deployable" projects that depend on projects from points a and b but essentially provide some utility on top like an app, HTTP API or command line utils and hence depend on things like fastapi, streamlit, etc.
2. So far, I have been using a single resolve to house them making it easier for me. But pants generate-lockfiles is painful to run at this point and has started taking upwards of 20mins to finish. How do I break things up cleanly?
a. I want to make the default resolve only for projects in point 1.a. And then projects in points 1.b and 1.c get their own resolves. I know I might end up making quite a few resolves but I am hoping it would be faster to resolve the dependencies in them that it pays off. Is this recommended or foolish of me to do?
b. Assuming I go ahead with this, how do I nest requirements so that python_sources / python_tests for projects in points 1.b and 1.c don't need to define 3rd party dependencies for projects in 1.a again. This will help avoid mistakes that might appear because of duplication.
c. I have been looking at uv_requirements for speedup (did not gain too much tbh) as well as `local_environment`/`docker_environment` to help with some of my troubles with torch on macos (ended up doing this in the end) etc.
An example repo of how people do it out there might help to validate if I am using it correctly.š
elegant-florist-94385
12/18/2025, 10:52 AMwant to make the default resolve only for projects in point 1.a. And then projects in points 1.b and 1.c get their own resolves.This is an impossible situation. If your libraries mentioned in 1.b import code from the core libraries in 1.a, then they must be in the same resolve. (likewise for the apps in 1.c) The general wisdom I've seen is that you should only use multiple resolves when you have apps that are explicitly incompatible, such as requiring different versions of the same 3rd party package. (And I would suggest trying to get them to align on the version before going to multiple resolves. I do understand the pain of a slow
generate-lockfiles, but how often do you actually need to run it? It is quite infrequent in my case.quaint-piano-62770
12/18/2025, 11:21 AMonnxruntime-gpu>=1.19,<1.20; sys_platform != 'darwin'
onnxruntime>=1.19,<1.20; sys_platform == 'darwin'
for example.
Some of my teammates still work with multiple conda envs because of these challenges making our adoption of pants incomplete š
elegant-florist-94385
12/18/2025, 12:13 PMpython_requirements(source="app-base-requirements.txt", resolve=parametrize("no-ML-resolve", "ML-resolve")
python_requirements(source="ML-requirements.txt", resolve="ML-resolve")
This makes two resolves, one intended for apps with ML capabilities and one intended for apps that don't. Note that the app-base which would include fastapi, streamlit, pydantic, etc. uses parametrize so it ends up in both resolves, but the ML requirements (torch, transformers , etc.) are only in the ML-resolve
Then any app (like your 1.c) can go into the appropriate resolve, while any library (1.a and 1.b) needs to be decided which resolve (or if it should be parametrized to both).
Remember that a resolve is just a virtualenv. You want resolves that match your runtime environments.elegant-florist-94385
12/18/2025, 12:14 PMbrief-scientist-13682
12/18/2025, 12:23 PMquaint-piano-62770
12/18/2025, 12:33 PM[python]
interpreter_constraints = [">=3.11,<3.12"]
default_resolve = "python-default"
enable_resolves = true
pip_version = "latest"
[pex-cli]
known_versions = [
"v2.66.0|macos_arm64|f471dcbffecfdc7d0f9128b5ec839c60fb9e2567ab5c9506405feb5b2fb153fd|4927719",
"v2.66.0|linux_x86_64|f471dcbffecfdc7d0f9128b5ec839c60fb9e2567ab5c9506405feb5b2fb153fd|4927719",
"v2.66.0|macos_x86_64|f471dcbffecfdc7d0f9128b5ec839c60fb9e2567ab5c9506405feb5b2fb153fd|4927719",
]
version = "v2.66.0"
can you give an example of what you mean by scoped indices?brief-scientist-13682
12/18/2025, 12:34 PMbrief-scientist-13682
12/18/2025, 12:34 PMbrief-scientist-13682
12/18/2025, 12:35 PMquaint-piano-62770
12/18/2025, 12:35 PMbrief-scientist-13682
12/18/2025, 12:36 PMbrief-scientist-13682
12/18/2025, 12:39 PMquaint-piano-62770
12/18/2025, 12:39 PMonnxruntime-gpu>=1.19,<1.20; sys_platform != 'darwin'
onnxruntime>=1.19,<1.20; sys_platform == 'darwin'brief-scientist-13682
12/18/2025, 12:40 PMbrief-scientist-13682
12/18/2025, 12:41 PMquaint-piano-62770
12/18/2025, 12:42 PMbrief-scientist-13682
12/18/2025, 12:43 PMbrief-scientist-13682
12/18/2025, 12:43 PMquaint-piano-62770
12/18/2025, 12:47 PMbrief-scientist-13682
12/18/2025, 12:52 PMthankful-stone-5860
12/18/2025, 4:05 PMuv by itself? I'm a huge proponent of Pants in general, but it's not a magic bullet. And it seems disingenuous to claim they don't care. The project maintainers are community stewards who may or may not have full time jobs that don't involve maintaining Pants. Which means development efforts tend to focus on the largest community demand signals (language and tool integrations, updates, feature support, etc). As it grows in what it supports, it becomes more difficult to address more esoteric problems like this.brief-scientist-13682
12/18/2025, 4:33 PMthankful-stone-5860
12/18/2025, 7:53 PMquaint-piano-62770
12/19/2025, 10:14 AMpid 10142 -> /Users/narayan/.cache/pants/named_caches/pex_root/venvs/3/a4f3052730dcb8c53032b22d097b15148f13a52e/2fa36aa9e14d5074d008690effb919f0552cfb0a/bin/python /Users/narayan/.cache/pants/named_caches/pex_root/venvs/3/a4f3052730dcb8c53032b22d097b15148f13a52e/2fa36aa9e14d5074d008690effb919f0552cfb0a/pex --disable-pip-version-check --exists-action a --no-input --isolated --log pex-pip-download.log -q --cache-dir /Users/narayan/.cache/pants/named_caches/pex_root/pip/3/25.3/pip_cache install --no-clean --dry-run --ignore-installed --report /Users/narayan/.cache/pants/named_caches/pex_root/downloads/1/.tmp/resolver_report.dr3kantv/universal-CPython-linux-and-mac-96757483faa0ed6b15bd36d212122810187341ad/pip-report.json awscli<1.33,>=1.32 boto3<1.37,>=1.34 botocore<1.37,>=1.34 cached-path<=1.6.5 dm-allennlp-models==2.10.3 dm-allennlp==2.10.3 fastapi-key-auth>=0.12 fastapi<0.121,>=0.120.1 flake8<3.10.0,>=3.8.0 floret<0.11,>=0.10.2 hiredis<2.2,>=2.0.0 httpx huggingface-hub<0.26 joblib<1.3.0,>=1.2.0 mlflow-skinny<3.5,>=3.4 nltk<4,>=3.9.1 numpy<1.25 onnxruntime<1.20,>=1.19 opensearch-py<3,>=2.5 pre-commit>=2.13.0 prometheus-client==0.17.1 prometheus-fastapi-instrumentator pydantic<3.0,>=2.6 pytest-html pytest-mock pytest<8 python-consul2>=0.1.5 pyyaml>=6.0.1 redis<5.0,>=4.6 scikit-learn<1.6,>=1.5 scipy<=1.13.1 sentence-transformers<2.3,>=2.0.0 spacy<3.8,>=3.7 tabulate torch==2.8.0; sys_platform != "darwin" torchvision==0.23.0; sys_platform != "darwin" transformers>=4.48.0 uvicorn>=0.27.0.post1 wandb<0.17.0 --index-url <https://pypi.org/simple> --extra-index-url "<http://user:pwd@host:8081/repository/pypi/simple>" --find-links <https://download.pytorch.org/whl/torch/cu129/> --find-links <https://download.pytorch.org/whl/torchvision/> --retries 5 --resume-retries 3 --timeout 15 exited with 1 and STDERR:
pip: WARNING: The index url ""<http://user:pwd@host:8081/repository/pypi/simple>"" seems invalid, please provide a scheme.
pip: WARNING: Location '"<http://user:pwd@host:8081/repository/pypi/simple>"/awscli/' is ignored: it is either a non-existing path or lacks a specific scheme.
pip: WARNING: Location '"<http://user:pwd@host:8081/repository/pypi/simple>"/boto3/' is ignored: it is either a non-existing path or lacks a specific scheme.
Maybe how I specify our internal nexus repo is problematic and its trying too many of these poorly formatted URL hits? In the log lines here I've replaced it with user:pwd@host to hide credentials
[python-repos]
indexes = [
"<https://pypi.org/simple>",
"%(env.PIP_EXTRA_INDEX_URL)s"
]
find_links = [
"<https://download.pytorch.org/whl/torch/cu129/>",
"<https://download.pytorch.org/whl/torchvision/>"
]
Btw, I am not sure <https://download.pytorch.org/whl/torch/cu129/> does not work but <https://download.pytorch.org/whl/torch/> does work here.brief-scientist-13682
12/19/2025, 10:49 AMbrief-scientist-13682
12/19/2025, 10:50 AMbrief-scientist-13682
12/19/2025, 10:52 AM--index-url suggested in the wizard here: https://pytorch.org/get-started/locally/brief-scientist-13682
12/19/2025, 10:56 AM" quotes in your warning coming from Pip. That should be fixed.quaint-piano-62770
12/19/2025, 11:24 AM" quotes w/ my internal nexus repo URL + moved to scoped indices as
[python-repos]
indexes = [
"<https://pypi.org/simple>",
"%(env.PIP_EXTRA_INDEX_URL)s",
"<https://download.pytorch.org/whl/torch/cu129/>",
"<https://download.pytorch.org/whl/torchvision/>",
]
and this brings time for pants generate-lockfiles down from ~25-30mins to ~10-11mins. Thanks @brief-scientist-13682 for the pointers šbrief-scientist-13682
12/19/2025, 6:57 PMpowerful-scooter-95162
12/19/2025, 6:59 PMbrief-scientist-13682
12/19/2025, 7:00 PM