Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is it safe to change python3.11 to 3.12 by default ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
kgdrenefort
Apprentice
Apprentice


Joined: 19 Sep 2023
Posts: 216
Location: Somewhere in the 77

PostPosted: Wed Apr 03, 2024 12:00 pm    Post subject: Is it safe to change python3.11 to 3.12 by default ? Reply with quote

Hello,

If I was not on Gentoo, I'll not even question myself. But since Python is the core of portage and must of the Gentoo's stuff, as stated by the wiki, I would like a confirmation.

Is using the package app-eselect/eselect-python to move from 3.11 to 3.12 is risky ?

I would not want to fix my Gentoo for such a «trivial» things as my Python's default version.

Code:
kgdrenefort@Mephistopheles ~/Documents/prog/python/GoTDA $ eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.11
  [2]   python3.12 (fallback)


I think I can go for 3.12, but default is Python 3.11.8 and it already makes me had problem while trying to use pydoc as in this topic of mine.

I do not find a clear statement that it is safe to in these pages:
- https://wiki.gentoo.org/wiki/Python
- https://wiki.gentoo.org/wiki/Project:Python/python-exec

I also think it's safe from what theses page says, I might have understand that if a version isn't supported by something, it'll pick the V-1 of Python. So as far as I do not remove any release considered deprecated, it should be fine. Correct ?

Regards,
GASPARD DE RENEFORT Kévin
_________________
wiki/User:Kgdrenefort/captain_logs My system info
G. does not have problems, only learning opportunities. - NeddyS.
If your installation isn't valuable to you, feel free to continue to ignore the instructions. - figue.
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1584

PostPosted: Wed Apr 03, 2024 12:48 pm    Post subject: Reply with quote

Eselect python is not a thing for quite some time. Are you sure you know what you're doing and why you want to do it?

Best Regards,
Georgi
Back to top
View user's profile Send private message
kgdrenefort
Apprentice
Apprentice


Joined: 19 Sep 2023
Posts: 216
Location: Somewhere in the 77

PostPosted: Wed Apr 03, 2024 12:50 pm    Post subject: Reply with quote

logrusx wrote:
Eselect python is not a thing for quite some time. Are you sure you know what you're doing and why you want to do it?

Best Regards,
Georgi


I only want to have 3.12 as the default Python.

I started to learn some Python and I would prefer to avoid running pydoc, for example, with a version that is:

1/ Not matching my version while coding
2/ Have to remember it each it I call it.

So far my script are okay because my shebang state to use 3.12.

Regards,
GASPARD DE RENEFORT Kévin
_________________
wiki/User:Kgdrenefort/captain_logs My system info
G. does not have problems, only learning opportunities. - NeddyS.
If your installation isn't valuable to you, feel free to continue to ignore the instructions. - figue.
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1584

PostPosted: Wed Apr 03, 2024 1:17 pm    Post subject: Reply with quote

I don't know python, but I know there's this thing virtual environment, can't you create and work inside of one?

Most likely you won't be able to get rid of python 3.11 anytime soon.

p.s. pydoc doesn't seem to support 3.12 yet:

Code:
eix pydoc
* app-vim/pydoc
     Available versions:  2.0-r2 {PYTHON_SINGLE_TARGET="python3_10 python3_11"}


Unless there's some way to tell it to show you 3.12 documentation.

But I think Ionen's suggestion below will do exactly what you want.

Best Regards,
Georgi


Last edited by logrusx on Wed Apr 03, 2024 2:10 pm; edited 2 times in total
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2727

PostPosted: Wed Apr 03, 2024 1:30 pm    Post subject: Reply with quote

Changing python-exec's default (done by either editing /etc/python-exec/python-exec.conf or using the old eselect python) is always safe as far as portage-installed packages go, this is just for your own preferences really. Portage-installed packages will still use 3.11 if they can't use 3.12 yet (aka built without PYTHON_TARGETS="python3_12").

By changing python-exec's default your own python/python3 shebang scripts will use 3.12 if that's just what you want, albeit without python3_12 target on system packages you won't have access to a lot of system-wide python site-packages (doesn't matter if using virtualenv/pip or just stdlib).

python3_12 target will become a default "likely" in 2-3 months if it goes like usual, you *could* use it now but given a lot of packages haven't been migrated yet you'll still need to keep 3_11 as a target a well. Generally this is not worth bothering with, just let the distro handle this for you.
Back to top
View user's profile Send private message
kgdrenefort
Apprentice
Apprentice


Joined: 19 Sep 2023
Posts: 216
Location: Somewhere in the 77

PostPosted: Wed Apr 03, 2024 3:50 pm    Post subject: Reply with quote

Thanks for these answers.

But I'll add I do not want to remove Python3.11, just have 3.12 as default, if it's safe.

And it's not even about my script, the shebang make my system use 3.12 anyway, but I didn't checked in detail, will take a look at it.

I'll just in case backup my system before proceeding.

Regards,
GASPARD DE RENEFORT Kévin
_________________
wiki/User:Kgdrenefort/captain_logs My system info
G. does not have problems, only learning opportunities. - NeddyS.
If your installation isn't valuable to you, feel free to continue to ignore the instructions. - figue.
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1688

PostPosted: Wed Apr 03, 2024 4:18 pm    Post subject: Reply with quote

kgdrenefort wrote:
Thanks for these answers.

But I'll add I do not want to remove Python3.11, just have 3.12 as default, if it's safe.

And it's not even about my script, the shebang make my system use 3.12 anyway, but I didn't checked in detail, will take a look at it.

I'll just in case backup my system before proceeding.

Regards,
GASPARD DE RENEFORT Kévin

An automatic way of setting this is to do this in package.use:
Code:
dev-lang/python-exec-conf python_targets_python3_12

then rebuilding python-exec-conf. It will put python 3.12 first and look for 3.11 second. As python3.11 falls off, then it will just go away.

All that python-exec-conf package does is creates a configuration file so it is safe to add that flag without worries for other packages.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2965
Location: Edge of marsh USA

PostPosted: Thu Apr 04, 2024 4:49 am    Post subject: Reply with quote

logrusx wrote:
Eselect python is not a thing for quite some time. Are you sure you know what you're doing and why you want to do it? ...

For those who want it, it's still available:
Code:
$ eix eselect-python
[I] app-eselect/eselect-python
     Available versions:  20200719
     Installed versions:  20200719(01:59:16 PM 03/27/2024)
     Homepage:            https://wiki.gentoo.org/wiki/Project:Python
     Description:         Eselect module for management of multiple Python versions

_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum