Python 2 deprecation

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Python 2 deprecation

#1 Post by Imperf3kt »

I know PyTom has previously stated that he does not wish to move Ren'Py to Python 3, but with most package managers actively removing Python 2, what will this mean for Ren'Py?

Python 2 has already been extended by 5 years with support to be fully removed by January 2020.

https://github.com/python/peps/blob/master/pep-0373.txt
https://www.python.org/dev/peps/pep-0404/
https://pythonclock.org/
https://python3statement.org/
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Python 2 deprecation

#2 Post by namastaii »

I know that you can only find python 2 in renpy files but.. renpy can still read python 3, can it not? I don't fully know or understand but I was pretty sure that syntax such as .format() was only introduced in python 3?

edit* ah I see that was back ported to 2.7

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Python 2 deprecation

#3 Post by Imperf3kt »

Nope, it currently runs on 2.7
PyTom wrote: Wed Feb 08, 2017 6:34 pm Ren'Py runs in Python 2, with many of the Python 3 compatibility options enabled. Right now, you should target the Python 2 / Python 3 intersection.
with no intention of moving to Python 3 in order to keep backward compatibility.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Kia
Eileen-Class Veteran
Posts: 1039
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: Python 2 deprecation

#4 Post by Kia »

I do support moving to python 3, even if it means starting from the scratch, showing an image and a text to start with then adding the features on top. it would be an opportunity to build it better.
I know the compatibility is a huge issue, but the python 2 version doesn't have to change, a python 3 version can be started and exist alongside the old version.
The question is: would Tom consider creating a new repository and start us with the basics?

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Python 2 deprecation

#5 Post by isobellesophia »

I agree, Python 2 has been inside RenPy in a long time, i dont think it is really going to shut down Python 2, i guess when PyTom released Python 3, i am not sure if the RenPy launcher will gonna update the launcher itself if the Python 2 is removed. (It's gonna change alot isn't?)
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Python 2 deprecation

#6 Post by Imperf3kt »

Well, the only thing that will happen should renpy stay with Python 2 is that it won't be available in most Linux repositories, you'll have to source it elsewhere or compile it yourself.

It won't affect Windows or Mac.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Python 2 deprecation

#7 Post by PyTom »

Imperf3kt wrote: Mon Sep 02, 2019 6:27 pm I know PyTom has previously stated that he does not wish to move Ren'Py to Python 3, but with most package managers actively removing Python 2, what will this mean for Ren'Py?
I've never said this. I plan to support Python 3 - probably Python 2 in parallel with Python 3 for a few years, at least. I don't support sloppy ports that give up Python 2 compatibility to make Python3. That being said, there are other things that are higher priority. It's not like Python 2 will stop working, or there is a security boundary we need to worry about.

I wouldn't support some other project that calls itself Ren'Py. That being said, the current codebase should be able to be made Python 3 compatible with a month or so of work. (The open source NX port runs on python 3, but it isn't backwards compatible the way I'd like it to be.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: Python 2 deprecation

#8 Post by SleepKirby »

For those who don't know, there are a lot of Python projects (on PyPI for example) which support Python 2 and 3 simultaneously on their latest version. To clarify, 'support' for Python 2 and 3, in Ren'Py's context, would mean that:
  • The Python version that runs when your game runs can be either Python 2 or 3. Presumably, Ren'Py would have to make the Python version an option, defined in the launcher or something.
  • Your Ren'Py game's code can be written to support only Python 2, or only Python 3, and it should still work (provided that the aforementioned version option is selected correctly).
Probably the most common tool to achieve this support is the six package. If you look at six's source code, the general premise is fairly simple - detect the currently-running Python version, do an if-else based on that, and assign common names to the differing Python 2/3 concepts.

Code: Select all

if PY3:
    string_types = str,
    integer_types = int,
    class_types = type,
    text_type = str
    ...
else:
    string_types = basestring,
    integer_types = (int, long)
    class_types = (type, types.ClassType)
    text_type = unicode
    ...
Once six takes care of that, a project like Ren'Py would use 'text_type' instead of 'str' or 'unicode', thus making that particular aspect of the Ren'Py code work on both Python 2 and 3. And so on.

So, using tools like six, it's absolutely not necessary to drop Python 2 support in order to support Python 3.

That said, there are benefits to dropping Python 2 eventually: Python 3 will add more and more convenient features which don't have an equivalent in Python 2. And having to support both Python 2 and 3 does add a bit of overhead to the code; for example, developers have to remember to use six's imports instead of the Python built-in names. So eventually, when the backward compatibility demand for Python 2 dies down, it should make sense to drop 2.

As PyTom indicated, the reason many other Python projects are being quicker to drop 2 is that their target applications - websites, for example - could end up with serious security holes if they continue to use software which no longer receives security patches. Thus, the demand for Python 2 compatibility in said applications would be a lot lower. Compare a website to a PC game you bought in the 2000s - that game's software packages are almost certainly no longer supported, but playing the game isn't much of a security risk unless you're using its network features.

DsyD
Newbie
Posts: 6
Joined: Tue Jun 23, 2020 7:31 am
Contact:

Re: Python 2 deprecation

#9 Post by DsyD »

I was wondering if there have been any updates on this?

I think the issue is less about security and more about quality of life and possibly performance. Third-party packages are also starting to drop support for Python 2 (or never had it in the first place) and I think there are definitely Python 3 features that would benefit Ren'Py users. I can think of a few off the top of my head:

- dict preserves key insertion order
- f-string literals
- typing
- dataclasses - I've seen a lot of Ren'Py projects that create classes just for data storage!
- singledispatch and lru_cache

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Python 2 deprecation

#10 Post by PyTom »

I'm working on it. The new renpy-build systems was created so that I'll be able to build Ren'Py for Python 3, and 7.4 will be able to support that python2+python3 intersection. Once 7.4 is out, I'm planning to have Ren'Py 7.x that supports Python 2, and Ren'Py 8.x that supports Python 3.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

DsyD
Newbie
Posts: 6
Joined: Tue Jun 23, 2020 7:31 am
Contact:

Re: Python 2 deprecation

#11 Post by DsyD »

That sounds great! Looking forward to it!

otaking
Newbie
Posts: 3
Joined: Thu Jun 25, 2020 5:46 pm
Contact:

Re: Python 2 deprecation

#12 Post by otaking »

Hopefully this means that linux repos might still work.

DsyD
Newbie
Posts: 6
Joined: Tue Jun 23, 2020 7:31 am
Contact:

Re: Python 2 deprecation

#13 Post by DsyD »

Any updates on this?

Looks like a ton of work done daily but no release yet...hopefully soon?

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Python 2 deprecation

#14 Post by PyTom »

While I don't give estimates, my current thinking is that once 7.4 is out (the prerelease is about to come out), the next release will be both the Python 2 based Ren'Py 7.5, and the Python 3 based Ren'Py 8.0. But that could change.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: No registered users