JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.45k stars 186 forks source link

Rename `distutils.sysconfig` to `sysconfig` #1068

Closed MilesCranmer closed 6 months ago

MilesCranmer commented 6 months ago

Required for Python 3.12 as distutils is removed.

@stevengj do you think you review and merge this when you get a chance? It's only a one-word change and is required for 3.12 compatibility in PyJulia.

cc @mkitti

Fixes https://github.com/JuliaPy/pyjulia/pull/538 (hopefully)

codecov-commenter commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (d407513) 67.75% compared to head (f4915f1) 67.75%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1068 +/- ## ======================================= Coverage 67.75% 67.75% ======================================= Files 20 20 Lines 2025 2025 ======================================= Hits 1372 1372 Misses 653 653 ``` | [Flag](https://app.codecov.io/gh/JuliaPy/PyCall.jl/pull/1068/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaPy) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/JuliaPy/PyCall.jl/pull/1068/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaPy) | `67.75% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaPy#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

stevengj commented 6 months ago

Then it will break earlier versions? Can you try both names in a try-catch block?

MilesCranmer commented 6 months ago

This sysconfig module was introduced by itself in Python 3.2. distutils has basically been a symlink to it since 3.2, then deprecated in 3.10 and 3.11, and removed in 3.12. But sysconfig has been there since 3.2.

stevengj commented 6 months ago

We still support older versions.

MilesCranmer commented 6 months ago

Even before Python 3.2? I don’t think they are even supported from Python itself anymore:

All official maintenance for Python 3.2, including security patches, has ended.

Python 2.7 is also retired and has no support from Python itself.

I could add a try catch if you want though?

MilesCranmer commented 6 months ago

2.7 was retired in 2020 after a decade of maintenance patches:

We have decided that January 1, 2020, was the day that we sunset Python 2. That means that we will not improve it anymore after that day, even if someone finds a security problem in it.

https://www.python.org/doc/sunset-python-2/

We dropped support for 2.7 in PyJulia because of this. Maybe could do the same in PyCall.jl?

MilesCranmer commented 6 months ago

If someone really wants to use an unmaintained, 10+ year old version of Python, with all of its security issues, I assume they would be technically skilled enough to also install an old version of PyCall that does support it, right?

And if they don’t have the technical knowledge to do that, I think it’s actually safer to throw an error about unsupported Python, than to let themselves put themselves at risk.

MilesCranmer commented 6 months ago

@stevengj I realise this is likely something to discuss in a future PR though. So to help speed up this fix I have implemented a try-catch for earlier Python.

FYI the Python 2.7 CI failures look to be from 2.7 not being available.

stevengj commented 6 months ago

Thanks, LGTM. Indeed, I would prefer having a conversation about dropping older Python versions in a separate PR.