hey all I am having trouble generating a lock-file...
# general
w
hey all I am having trouble generating a lock-file that due a dependency that does not seem to play nice with the
--style=universal
parameter pex(it seems like python-forge, is not publishing the proper files). How are people getting around dependencies that can only be resolved via
style=strict
??
e
@wooden-ability-49079, I bet you can't even install that package with Pip. What Python version are you targeting? Unless you use a VCS requirement, that project should only work with Python 3.5 since it publishes no source distribution and just a py35 wheel for each of the two versions.
In other words, locking vs Pip, etc is not the issue. The issue is Python 3.5 only. So do you have interpreter constraints configured as
==3.5.*
?
That would be required here.
w
ah right, didn't notice the python constriant, surprsingly pip just works, we are actually targetting 3.9+
Copy code
❯ python --version
Python 3.11.6
❯ pip install python-forge==18.6.0
Looking in indexes: <https://pypi.org/simple/>
Collecting python-forge==18.6.0
  Using cached python_forge-18.6.0-py35-none-any.whl (31 kB)
Installing collected packages: python-forge
Successfully installed python-forge-18.6.0
❯ pip --version
pip 23.2.1 from /Users/user/throwaway/lib/python3.11/site-packages/pip (python 3.11)
is there a way to override that constraint and have pants installed the dependency regardless, or perhaps I can create an override for that particular dependency? how would one get around this?
e
@wooden-ability-49079, I still don't grok what's going on here exactly, but can you please reveal the interpreter constraints you configured? Also potentially relevant is the Pants version you are using.
Ok, although this handles the
abi3
ABI correctly, it does not apparently handle the
none
ABI correctly after examining a few complete platform compatible tags sets: https://github.com/pantsbuild/pex/blob/a43c48c2a4b18b352be2c3175e0ae363ff8876d7/pex/resolve/locker_patches.py#L93-L121
@wooden-ability-49079 I'm out of country and AFK through November 2nd but can file and fix then.
w
gotcha, happy to collaborate on this once I understand what is actually broken, apologize I still don't fully understand what's going on
e
For clarity it would be awesome if you did provide ICs and Pants version.
w
Copy code
❯ pants --version
21:07:31.54 [INFO] Initialization options changed: reinitializing scheduler...
21:07:35.25 [INFO] Scheduler initialized.
2.17.0
Copy code
[python]
interpreter_constraints = ['==3.9.*']
enable_resolves = true
from pants.toml
but this fails on 3.11 as well as constraint, let me try 3.5
e
Ok, thanks. I'm pretty sure the issue is the Pex logic I identified above. Roughly zero projects publish a wheel with that style tag plus no sdist; so it makes sense this wouldn't show up for 2 years.
It will work for a
==3.5.*
IC, but you certainly don't actually want that for your IC in 2023.
w
agreed
e
It will work, but other things fail most likely. Many projects floor at 3.7 now.
w
exactly, I can't realistically set the constraint to 3.5, but I was hoping to understand what is going here, as this particular issue is kind of blocking me, would it be helpful to create a gh issue?
e
Yes, thank you.
You can unblock with a VCS requirement.
Is this a direct dep or transitive?
w
transitive unfortuantely
VCS as in point to the github repo of the dep?
e
Well, you can add a top level req anyhow with a comment explaining the workaround.
Yes, just a sec...
python_forge @ git+<https://github.com/dfee/forge@SHA|https://github.com/dfee/forge@SHA>
Replace
SHA
with the sha of the tag you want.
Or, if you trust they don't mutate release tags, use
v18.6.0
instead of its sha.
w
gotcha, yes that worked!! nice thanks a heap for your help @enough-analyst-54434, I'll open gh ticket, would love to publish a patch for this, but I super new at pants, so I am still learning how this all works
e
No worries and thank you. This is not a Pants issue, it's a Pex issue. Please file here: https://github.com/pantsbuild/pex
w
👍
e
Thanks @wooden-ability-49079