green-match-60388
08/22/2023, 1:17 AMsnowflake-snowpark-python in pants when generating a lock file. i've created this repo that can be used to reproduce.
i added more info to the readme in that repo, but the jist is that if i try and use `snowflake-snowpark-python`(i haven't found any others that fail) and then do pants generate-lockfiles --resolve=python-default i get a No matching distribution found for snowflake-snowpark-python error. But I expect it to work, I suppose, because of some other steps like copying the errored command from the output and trying it with pip install in the "same" environment.enough-analyst-54434
08/22/2023, 1:39 AMRequires: Python >=3.8, <3.11 for https://pypi.org/project/snowflake-snowpark-python/1.6.1/ (I did not check older versions). Combine that with your interpreter_constraints = [">=3.10.*"] and totally expected since you don't upper bound and both 3.11 and 3.12 violate `snowflake-snowpark-python`'s Python requirement and so ... the lock is impossible.enough-analyst-54434
08/22/2023, 1:40 AM$ git diff
diff --git a/pants.toml b/pants.toml
index d045243..6cc4502 100644
--- a/pants.toml
+++ b/pants.toml
@@ -7,5 +7,5 @@ backend_packages = ["pants.backend.python"]
enabled = false
[python]
-interpreter_constraints = [">=3.10.*"]
+interpreter_constraints = ["==3.10.*"]
enable_resolves = trueenough-analyst-54434
08/22/2023, 1:41 AM>=3.10.* doesn't make much sense, that's just >=3.10.enough-analyst-54434
08/22/2023, 1:41 AMlate-advantage-75311
08/22/2023, 11:12 AMenough-analyst-54434
08/22/2023, 11:22 AMenough-analyst-54434
08/22/2023, 11:23 AMenough-analyst-54434
08/22/2023, 11:24 AMenough-analyst-54434
08/22/2023, 11:29 AMlate-advantage-75311
08/22/2023, 11:51 AM">=3.10.*"enough-analyst-54434
08/22/2023, 11:55 AMenough-analyst-54434
08/22/2023, 11:58 AM">=3.10", but that's exactly what I intend, I won't be happy.enough-analyst-54434
08/22/2023, 12:27 PMpip install success to try said same in a Python 3.11 venv. That would have failed and maybe made it more clear why the lock is impossible.green-match-60388
08/22/2023, 4:33 PMgreen-match-60388
08/22/2023, 4:39 PMpex is doing.
So, pex uses pip under the hood(makes sense why the arguments to python pex look like pip args). and when i copy the same python pex command that is in the "error" output and run it successfully, that is an invalid test because i'm in 3.10?green-match-60388
08/22/2023, 4:46 PMconstraints or can we list multiple with parametrize or something and have them all tried until successful or exhausted? my guess is this brute force approach is likely super time consuming and still might not be super helpful.enough-analyst-54434
08/22/2023, 5:22 PMSo, pex uses pip under the hood(makes sense why the arguments to python pex look like pip args). and when i copy the same python pex command that is in the "error" output and run it successfully, that is an invalid test because i'm in 3.10?So Pex uses Pip but it does not do the same thing as Pip. When you issue
pip install it resolves distributions for the current Python on the current computer and installs those. When you ask Pex to create a lock file (which is what Pants is doing here), you're asking it to resolve distributions for every possible machine and interpreter you specify. Now Pants doesn't give you control over which machines (it tells Pex --target-system linux --target-system mac unconditionall currently - and so it limits to linux and mac (i.e.: the lock won't work for Windows Python interpreters)), but it does give you control over which interpreters via interpreter_constraints. Since your interpreter_constraints specified the open range >=3.10, Pex was told to solve a lock that works for both linux and mac machines and every Python interpreter >=3.10. So 3.10.0, 3.10.1, ..., 3.11.0, 3.11.1, ..., etc.enough-analyst-54434
08/22/2023, 5:23 PMdo you think there could possible be an option that iterates over a few different constraints or can we list multiple with parametrize or something and have them all tried until successful or exhausted? my guess is this brute force approach is likely super time consuming and still might not be super helpful. (edited)I really have no clue what you're getting at here. So do you actually need
>=3.10, i.e. 3.11 too and thus you've moved on in this paragraph to try to solve that problem?enough-analyst-54434
08/22/2023, 5:25 PMenough-analyst-54434
08/22/2023, 5:31 PMgreen-match-60388
08/22/2023, 7:26 PM>=3.10 because we use python match statements and i believe those are support in 3.10 and greater. so, it made sense to me to do that.
i also believe this was working in `poetry`(which i'm migrating from), but now that i check we had the upper bound set to <3.11.enough-analyst-54434
08/22/2023, 7:30 PMmatch statement? you mean Poetry's version of an interpreter_constraint? If so, OK. That makes more sense. You had a transcription error and wrote >=3.10.* instead of transcribing >=3.10,<3.11 from the Poetry setup.enough-analyst-54434
08/22/2023, 7:31 PMgreen-match-60388
08/22/2023, 7:45 PMpoetry like 6 months ago...
and when i mentioned the python match, i mean that structural pattern matching that was introduced in python 3.10.enough-analyst-54434
08/22/2023, 7:54 PMgreen-match-60388
08/22/2023, 7:56 PM