Using PyOxidizer for the first time: ```ERROR: Pac...
# general
b
Using PyOxidizer for the first time:
Copy code
ERROR: Package 'pkglocker' requires a different Python: 3.9.7 not in '==3.8.*'
Coming from:
Copy code
python_sources()

pex_binary(
    name="pkglocker-binary",
    entry_point="pkglocker.py",
    layout="packed",
)

python_distribution(
    name="pkglocker-dist",
    dependencies=["./pkglocker.py"],
    provides=python_artifact(name="pkglocker", version="0.0.1"),
)

pyoxidizer_binary(
    name="pkglocker-pyox",
    dependencies=[":pkglocker-dist"],
    entry_point="pkglocker.py",
)
pants.toml
has:
Copy code
[python]
interpreter_constraints = ["CPython==3.8.*"]
But Pants itself is using
3.9
I think. So I'm guessing we are running something in Pants' env instead of a materialized one? Or I'm missing something ๐Ÿ™‚
src/python/pants/backend/python/packaging/pyoxidizer/subsystem.py
has an ICs of
"CPython>=3.8,<4"
๐Ÿค”
Liberally blasting my code with
interpreter_constraints=["CPython>=3.8,<4"],
fixes it, but still ๐Ÿ˜ž
FYI @wide-midnight-78598
w
Just to verify, is the subsystem using the latest PyOx? I think itโ€™s 0.22 or newer now. I set it up as 0.18 back in the day, and wanted to update it, but wanted to not rock any boats until Chrisโ€™s Pants PyOx was ready
a
@wide-midnight-78598 feel free to rock any boats there
b
I'm on 2.14 so maybe not
w
Hmm, now that I think about this, I not sure if 0.22 is related. I wonder if the wrong python is embedded?
Just for clarity on one item, Python 3.8 is the minimum for PyOx (https://pyoxidizer.readthedocs.io/en/stable/pyoxidizer_faq.html#why-is-python-3-8-required) - though, I think there should be a comment to that effect in the help note and/or the default interpreter_constraints. Maybe it should even fail out otherwise - but maybe it's okay to let PyOx fail it out. What's strange here is that I don't see the option to specify which interpreter is used in the PyOx'd build (unless you use your own config). It should default to 3.10, but still weird it's not there. I guess I missed it
b
Yeah I have 3.8 installed and my ICs are just 3.8
But I also have 3.9 installed, which Pants prefers (and seemingly PyOx)
(and the two might be unrelated. ould be a red herring)
w
Trying to remember, as I wrote this a long time ago - but I -think- PyOx will default to whichever Python is used by Pants, since Pants is kinda informing it. But, it was so long ago and I clearly didn't document what happens by default ๐Ÿ˜ข
Orrr... PyOx defaults to the latest interpreter it can find - which for me, the two are often the same
Oh, I also want to support this: https://pyoxidizer.readthedocs.io/en/stable/pyoxidizer_managing_projects.html#managed-rust-toolchain No reason to pay for that download if we can use system (sometimes)
b
So I think this is an issue then, pypx should respect the users ICs
w
Feels like it - do you have a repro repo? I can take a crack at it this weekend to see what's the scoop, and maybe make some of those other changes
b
No but should be easily unit testable? In the integration test, set the ICs to 3.8 (and mark the test skip if not 3.8 and 3.9). Since the GHA runner will have 3.9 installed that should be preferred, but with an ICs of 3.8 it shouldn't be runnable
w
Sigh... womps... https://github.com/pantsbuild/pants/issues/14734 back from March 8th, entirely forgot about it
b
So we need to wire that up to ICs?
w
At the very least, yeah - pull it out as a separate thing from the default config at the least. Would investigate what the other options are. Like, should you be able to specify your python version and what happens if the ICs don't line up, etc
๐Ÿ‘€ 1
What happens if you have your own custom config, which specifies a python version, but then your ICs aren't in-line. Lots of considerations, lots of possibilities. I think step one is some sort of in-rule IC/Python version comparison and failing out if you have an impossible situation
b
Anywho I'm not blocked currently because I just widened my ICs for my little script
๐Ÿ‘ 1
w
For sure, I just need to enumerate some possibilities before I go after that. The inferred option is ideal, where Pants picks the most recent Python that doesn't break your ICs, but there are so many side effects.