Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2 end of life #1460

Closed
acrymble opened this issue Sep 24, 2019 · 36 comments
Closed

Python 2 end of life #1460

acrymble opened this issue Sep 24, 2019 · 36 comments
Assignees

Comments

@acrymble
Copy link

acrymble commented Sep 24, 2019

The majority of our older Python lessons are written in Python 2. This is now going to be deprecated at the end of 2019.

https://www.activestate.com/blog/python-2-eol-now-what/

These lessons have almost all been translated into Spanish, so any changes require changes to translated lessons as well. I'm a co-author on these, so I'd rather not see us deprecate 34 lessons. That leaves us with a question of how best to update them to be Python 3 friendly. I welcome ideas, keeping workloads in mind for all those affected.

@jenniferisasi
Copy link
Contributor

Ouch, that is bad news. It is going to require a lot of work to do updates but I agree that deprecating 34 lessons (I did not realize it was that many) all of a sudden is not ideal. Off the top of my head right now, would it be plausible to put a call for updating lessons X-number at a time? Maybe a few people are willing to workaround the update without the need to write the whole lesson?

Since I don't work with Python and, thus, I have not used these lessons, did you use any application that runs on Python 2 that you anticipate/know will not be updated to run on Python 3? Could those be deprecated?

@walshbr
Copy link
Contributor

walshbr commented Sep 24, 2019

If the lessons are just using the standard Python library, then it might not be that much work to update them. But if the lessons depend on an external library (like Beautiful Soup or something similar), then that is a different question that we'll have to handle on a case-by-case basis I think. If that library hasn't itself been updated to Python 3 then we probably won't have any choice but to deprecate those lessons.

@jenniferisasi
Copy link
Contributor

@walshbr expressed my concern/idea better, thanks!

@walshbr
Copy link
Contributor

walshbr commented Sep 24, 2019

Oh sorry @jenniferisasi I think we were typing at the same time and I didn't see your response. :)

@acrymble
Copy link
Author

We should probably start with an audit of which lessons are affected. Can anyone on the Spanish or French teams responsible for deciding on priorities make sure Python lessons that may be affected are not chosen for translation until we sort this out?

@acrymble
Copy link
Author

acrymble commented Sep 24, 2019

Published lessons that may be affected:

FRENCH (1):

SPANISH (18):

Original Python in Spanish

ENGLISH (22):

Original English Python series

@acrymble
Copy link
Author

Key differences between Python 2 and 3: https://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html

@spapastamkou
Copy link
Contributor

There is also a third translation in French that is ready but were not able to edit yet. But yes, we can put further translations in standby.

@sgillies
Copy link

@acrymble if you add me as a collaborator I would be happy to help you migrate a few lessons to Python 3. I know the paths well.

@frederik-elwert
Copy link
Contributor

I might also be able to help with a few. Maybe we can set up a mechanism where volunteers can claim articles they are updating, so that we don't accidentally update the same lesson twice? Maybe as a wiki page, here in the issue, or by creating one issue per lesson?

@acrymble
Copy link
Author

Thanks @sgillies and @frederik-elwert for getting in touch. We've got a workflow of submitting changes via pull request (https://github.com/programminghistorian/jekyll/wiki/Making-Technical-Contributions) which I believe anyone can already do.

Before we get started, is this l ikely to involve considerable changes, or are they generally minor code syntax things? I want to make sure we approach this the right way. So if it's just a few changes to code blocks then that's relatively easy. If we have to re-write explanations we might have to think about re-testing each lesson using our reviewing processes.

@frederik-elwert
Copy link
Contributor

Before we get started, is this l ikely to involve considerable changes, or are they generally minor code syntax things? I want to make sure we approach this the right way. So if it's just a few changes to code blocks then that's relatively easy. If we have to re-write explanations we might have to think about re-testing each lesson using our reviewing processes.

I would have to check the details, but I assume in most cases it would be minor syntax changes. In some cases, “modern” Python 2 could be run under Python 3 without changes. I guess the most disrupting changes would be related to external modules.

Maybe it would even be possible to semi-automate this by extracting the code parts and running Python’s conversion utility 2to3 over it to see required changes.

@frederik-elwert
Copy link
Contributor

Okay, I created a small script that tries to make the required changes automatically by using 2to3. It will still require manual inspection, but might be helpful:

https://gist.github.com/frederik-elwert/c99ceee72293035aeef05ccbb53dea83

Call like this:

python3 md2to3.py -w en/lessons/extracting-keywords.md 

@frederik-elwert
Copy link
Contributor

This is a tricky one: https://programminghistorian.org/en/lessons/transliterating

I created a separate issue #1471 for it.

@acrymble
Copy link
Author

acrymble commented Oct 6, 2019

@frederik-elwert would you be willing to run your script on a few more of the above lessons, and I'll re-test them manually?

@frederik-elwert
Copy link
Contributor

frederik-elwert commented Oct 6, 2019 via email

@frederik-elwert
Copy link
Contributor

Okay, I guess it’s a good idea to start with the basic introduction, i.e. introduction-and-installation and following. I started re-writing it with reference to Python 3. However, I guess it’s a good idea to use this opportunity to update it more thoroughly, as this foundational series was originally published in 2012. E.g., it still references Ubuntu 12.04.

One key question: The install introduction, but also other lessons, refer to Komodo Edit as the preferred editor, including screenshots. Is this still the best option? It seems a bit marginal today. (I personally use Sublime Text a lot, but Visual Studio Code might be a better option, also because it’s Free/OpenSource.)

The other question: I could update the install instructions for Linux, but would somebody else be willing to do the same for Windows/Mac?

Also, the lesson has been translated to Spanish. How do we coordinate the translations? I guess starting with the English one is not bad, but it would be desirable to let the other languages not lag behind.

@acrymble
Copy link
Author

@frederik-elwert thanks for this. I think in the first instance what we need to do is to identify any lessons that are already Python3 compatible, so we can remove them from the list.

I agree that the setting up an integrated development environment series in particular may need a new lesson, but I would suggest the best approach there is simply a new lesson going through peer review.

The others, from memory, I think will be fine with more minor changes, and shouldn't require many new screenshots.

Is there a way we can get a yes/no this lesson's code examples are fine for Python3?

@acrymble
Copy link
Author

acrymble commented Oct 13, 2019

Keeping in mind the idea that the setup lessons may need to be re-written, I've started going through the original python lessons to identify ones that don't need updating because the code is already fine (using the script provided by @frederik-elwert). I've adjusted the list above to reflect the lessons that don't need fixing, and have submitted 3 pull requests to fix both the Spanish and English versions of code for specific lessons. I've asked for reviews for those from our respective managing editors, so that they have control over the publication. #1493 #1494 #1495

@frederik-elwert
Copy link
Contributor

Okay, here’s a pull request for the Intro and Install on Linux lesson of the original English series: #1501.

@frederik-elwert
Copy link
Contributor

Just to prevent duplicate work: I started updating https://programminghistorian.org/en/lessons/downloading-multiple-records-using-query-strings.

@acrymble
Copy link
Author

Can anyone with WINDOWS help update the https://programminghistorian.org/en/lessons/windows-installation lesson please? I don't have a machine I can test it on. It only needs updating to point to Python3 resources instead of 2.7. This should be a 15 minute fix. I would appreciate someone coming forward. @programminghistorian/project-team

@acrymble
Copy link
Author

I am unable to update the following Spanish language lessons because of my lack of language skills:

Can anyone on @programminghistorian/spanish-team help with this? I estimate each one is a 15 minute fix. I can Skype you to talk you through it.

@JMParr
Copy link
Contributor

JMParr commented Nov 19, 2019 via email

@acrymble
Copy link
Author

As long as you don't think it will make more work for you. Thanks.

@rivaquiroga
Copy link
Member

@JoshuaGOB, can you help with this? It seems that you are the most Python-proficient editor in the Spanish team. It's around 1 hour work.

@JoshuaGOB
Copy link
Contributor

JoshuaGOB commented Nov 20, 2019 via email

@JoshuaGOB
Copy link
Contributor

Quick question: Are there any objections to removing the Komodo Edit section in:

I can't see the relevance for those intro sections but I can see how the mismatch between the images and updated versions of Komodo might confuse readers.

Since these are translations I wanted to emulate whatever was in the original but I see that the originals haven't been updated for the Python 3 changes either. Please advise.

@frederik-elwert
Copy link
Contributor

I was unsure about the Komodo section as well. But in the end I wanted to separate the Python3 update from other revisions, so I kept most things as they were. You can see, however, that I did update the screenshots for the Linux installation: https://programminghistorian.org/en/lessons/linux-installation It might be good to do the same for Windows and Mac, but I currently don’t have access to those systems. Feel free to re-use those screenshot if using an up-to-date Linux screenshot is less confusing than an outdated Mac screenshot.

JoshuaGOB added a commit that referenced this issue Nov 25, 2019
Small changes to print function and installation justification in instalacion-mac.md #1460
@acrymble
Copy link
Author

@JoshuaGOB The original English ones (Mac and Linux) have been updated to Python3 and keep the Komodo edit in.

@JoshuaGOB
Copy link
Contributor

Thank @acrymble. Would you mind checking the images in the lessons for Mac and Linux in es. I’m confused about where to put them. Thanks.

@acrymble
Copy link
Author

acrymble commented Dec 4, 2019

@JoshuaGOB I believe there are only two very small changes needed to close this ticket.

https://programminghistorian.org/es/lecciones/instalacion-windows
https://programminghistorian.org/en/lessons/windows-installation

Since these are the same lesson in two languages, would you be able to make the change? Then we will be fully Python3

@mdlincoln
Copy link
Contributor

Hey it looks like a new, incorrectly-named file was made:

https://github.com/programminghistorian/jekyll/blob/gh-pages/es/lecciones/contrar-frecuencias.md

Please make sure the changes are properly incorporated into the correct file:

https://github.com/programminghistorian/jekyll/blob/gh-pages/es/lecciones/contar-frecuencias.md

and then delete the misspelled one

@acrymble
Copy link
Author

acrymble commented Dec 6, 2019

THanks @mdlincoln I've submitted a pull request to fix this.

mdlincoln pushed a commit that referenced this issue Dec 9, 2019
* Updated Spanish text and images for Python3 

#1460

* Updated images for Komodo 11 and Python3

Needed new images for the screenshots

* Updated English images and texts for Python3
@acrymble
Copy link
Author

acrymble commented Jan 3, 2020

these last two lessons have been fixed, but I missed closing this. I believe we are now officially Python 3 compliant!

@acrymble acrymble closed this as completed Jan 3, 2020
@drjwbaker
Copy link
Member

Great job all involved. I've been watching from afar and can see this has been a big chunk of work. Chapeau.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests