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: 3073
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Python 2 deprecation

#1 Post by Imperf3kt » 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?

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.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

User avatar
namastaii
Eileen-Class Veteran
Posts: 1348
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 » Mon Sep 02, 2019 9:33 pm

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: 3073
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Python 2 deprecation

#3 Post by Imperf3kt » Mon Sep 02, 2019 10:10 pm

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.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

User avatar
Kia
Miko-Class Veteran
Posts: 921
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Skype: KiaAzad
Contact:

Re: Python 2 deprecation

#4 Post by Kia » Thu Sep 05, 2019 11:25 am

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 » Thu Sep 05, 2019 10:16 pm

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: 3073
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Python 2 deprecation

#6 Post by Imperf3kt » Fri Sep 06, 2019 3:07 am

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.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

User avatar
PyTom
Ren'Py Creator
Posts: 15478
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 » Sun Sep 08, 2019 12:27 am

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
"Silly and fun things are important." - Elon Musk
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 » Wed Sep 11, 2019 5:42 am

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: 4
Joined: Tue Jun 23, 2020 7:31 am
Contact:

Re: Python 2 deprecation

#9 Post by DsyD » Tue Jun 23, 2020 9:10 am

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: 15478
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 » Tue Jun 23, 2020 6:13 pm

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
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

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

Re: Python 2 deprecation

#11 Post by DsyD » Tue Jun 23, 2020 8:40 pm

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 » Sat Jun 27, 2020 2:16 pm

Hopefully this means that linux repos might still work.

Post Reply

Who is online

Users browsing this forum: No registered users