SlideShare ist ein Scribd-Unternehmen logo
1 von 77
Downloaden Sie, um offline zu lesen
P L O N E P Y T H O N 3
PHILIP BAUER
♥
TEXT (WAS UNICODE IN PY2)
BYTE S (WAS STRING IN PY2)
STRING (BYTES IN PY2 / TEXT IN PY3)
BYTES ARE MEASURED IN
KILOS, STORED IN DISKS
AND TRANSFERED
THROUGH CABLES
SAY: TEXT & BYTES

NOT: UNICODE & STRING
U N I C O D E S A N D W I C H
B Y T E S | T E X T | B Y T E ST E X T
safe_text (safe_unicode)
safe_bytes (safe_encode)
s a f e _ n a t i v e s t r i n g
b y t e s i n p y 3
t e x t i n p y 3
>>> 'foo' == u'foo'

True

>>> 'foo' + u'foo'

u'foofoo'

>>> u'foo' + 'foo'

u'foofoo'
Python 2
IMPLICIT CONVERSION
>>> b'foo' == 'foo'

False

>>> 'foo' + b'foo'

TypeError: can only concatenate str (not
"bytes") to str

>>> b'foo' + 'foo'

TypeError: can't concat str to bytes
Python 3
IMPLICIT CONVERSION
>>> byte = b'huhu'

>>> byte

'huhu'

>>> byte.decode('utf8')

u'huhu'

>>> byte.encode('utf8')

'huhu'
Python 2: bytes
EXPLICIT CONVERSION
>>> byte = b'huhu'

>>> byte

b'huhu'

>>> byte.decode('utf8')

'huhu'

>>> byte.encode('utf8')

AttributeError: 'bytes' object has no
attribute 'encode'
Python 3: bytes
EXPLICIT CONVERSION
>>> text = u'foo'

>>> text

u'foo'

>>> text.encode('utf8')

'foo'

>>> text.decode('utf8')

u'foo'
Python 2: text
EXPLICIT CONVERSION
>>> text = 'foo'

>>> text

'foo'

>>> text.encode('utf8')

b'foo'

>>> text.decode('utf8')

AttributeError: 'str' object has no attribute
'decode'
Python 3: text
EXPLICIT CONVERSION
ITERATING IS WEIRD
>>> [i for i in 'huhu']

['h', 'u', 'h', 'u']
Python 2
ITERATING OVER BYTES
>>> [i for i in b'huhu']

[104, 117, 104, 117]

>>> [chr(i) for i in b'huhu']

['h', 'u', 'h', 'u']

>>> [chr(i).encode('utf8') for i in b'huhu']

[b'h', b'u', b'h', b'u']
Python 3
ITERATING OVER BYTES
P Y T H O N 3 . 3
• Py3: u'text'
• Py2: b'bytes'
• u'text' is text in py2 and py3
• b'bytes' is bytes in py2 and py3
• text/bytes is the main issue when migrating code
• It makes much more sense in py3
• Writing code that works in py2/py3 is not easy
L E T ' S TA L K A B O U T B R A Z I L
ZOPE 4
POR TING PLONE TO
PYTHON 3
1. MIGRATE PACKAGES FLYING BLIND
• Tools: six, sixer and python-modernize
• Educated Guessing™
• Testing in Python 2
2 . S TA R T U P A N D M A N U A L T E S T
• Fix what breaks
• Test features manually
• Nightly demo
3 . A U T O M AT E D T E S T S
• Get > 10.000 tests to work on Python 3
• Hunt & kill test-isolation issues
• doctests oh my
CURRENT STATE (DEMO)
THANK YOU TO ALL
THAT HELPED
STEFFEN ALLNER | PHILIP BAUER | ROEL
BRUGGINK | GODEFROID CHAPELLE | MAIK
DERSTAPPEN | GIL FORCADA | HARALD
FRISENEGGER | DAVID GLICK | DANIEL
HAVLIK | MICHAEL HOWITZ | JENS KLEIN |
DAVI LIMA | ALEXANDER LOECHEL |
THOMAS LOTZE | PETER MATHIS | JAN
MEVISSEN | ROBERT NIEDERREITER | JONI
ORPONEN | ALESSANDRO PISA | JOHANNES
RAGGAM | MAURITS VAN REES | MANUEL
REINHARDT | THOMAS SCHORR | ERIC
STEELE | JENS VAGELPOHL | MATTHEW
WILKES | ANDI ZEIDLER
UPGRADE TO PYTHON 3
6 STEP PROCESS
1 . U P G R A D E T O P L O N E 5 . 2
• Use Python 2.7
2 . D R O P A R C H E T Y P E S
• It's not asking too much
• Migration for default types is available since 2013
• Migration for custom types is available since 2015
3 . M I G R AT E Y O U R C O D E T O P Y T H O N 3
• Without Database
• Support Python 2 and Python 3
• Small addons: Startup and fix whatever fails
• Bigger addons: Use python-modernize
• Same with tests
• Beware of complex doctests
4 . M I G R AT E A D D O N S
• Same as above
• Everyone benefits
5 . M I G R AT E Y O U R D ATA B A S E
• See David Glick's Talk
• Downtime/Read-only might be ineviable
6 . D E P L O Y O N P Y T H O N 3
• Test the production-setup with WSGI early
STAR T NOW
DON'T WAIT
WORK ITERATIVELY
R O A D M A P
• 5.2a1 now
• 5.2 final in February
T O D O
• FTP and/or WebDAV
• DB Migration
• Upgrade- and porting-guide
• Migrate Addons
• Performance-tests
COME TO THE SPRINT
BRING YOUR ADDONS
QUESTIONS
WHAT ABOUT PYTHON 4?
W H E N W I L L P L O N E D R O P
S U P P O R T F O R P Y T H O N 2 ?
WHAT ABOUT ZOPE 5?
WILL ARCHETYPES BE
POR TED TO PYTHON 3?
HOW DO WE REPLACE
FTP/WEBDAV?
W H Y D I D Y O U N O T ' S I M P LY '
M I G R AT E T O G U I L L I O T I N A ?
CAN I NOW USE ASYNC/
AWAIT?
W H Y D O E S N ' T T H E P L O N E
F O U N D AT I O N S I M P LY B U Y
S U P P O R T F O R P Y T H O N 2 . 7 F R O M
R E D H AT / I B M F O R A L L O F U S ?
DOES PYTHON 3 MAKE
PLONE RUN FASTER?
CAN I RUN THE SAME DB
IN PY2 AND PY3?
I S A D D O N < Y O U R N A M E H E R E >
A L R E A D Y P O R T E D ?
W I L L T H I S I N C R E A S E
P L O N E ' S M A R K E T S H A R E ?
HOW DO I DEPLOY INTO
PRODUCTION?
WILL THIS WORK ON
WINDOWS?
ARE PRODUCTION-TOOLS
ALREADY WORK, LIKE BACKUP,
ZRS OR RELSTORAGE?
DOES BOBTEMPLATES.PLONE AND
PLONECLI ALREADY WORK IN PY3?
MORE QUESTIONS...
@StarzelDe
pbauer
P L O N E P Y T H O N 3
PHILIP BAUER
♥
THANKS

Weitere ähnliche Inhalte

Ähnlich wie Plone ♥︎ Python 3

200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet Code200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet CodeDavid Danzilio
 
Connecting The Digital To Analog - Brian Suda
Connecting The Digital To Analog - Brian SudaConnecting The Digital To Analog - Brian Suda
Connecting The Digital To Analog - Brian Sudabeyond tellerrand
 
Python 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUGPython 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUGNEWLUG
 
Learning python with flask (PyLadies Malaysia 2017 Workshop #1)
Learning python with flask (PyLadies Malaysia 2017 Workshop #1)Learning python with flask (PyLadies Malaysia 2017 Workshop #1)
Learning python with flask (PyLadies Malaysia 2017 Workshop #1)Sian Lerk Lau
 
2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metricsBuddy Brewer
 
Python 2 is dead! Drag your old code into the modern age
Python 2 is dead! Drag your old code into the modern agePython 2 is dead! Drag your old code into the modern age
Python 2 is dead! Drag your old code into the modern ageBecky Smith
 
Python interview question for students
Python interview question for studentsPython interview question for students
Python interview question for studentsCorey McCreary
 
The net is dark and full of terrors - James Bennett
The net is dark and full of terrors - James BennettThe net is dark and full of terrors - James Bennett
The net is dark and full of terrors - James BennettLeo Zhou
 
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266iMasters
 
InterCon 2016 - Blockchain e smart-contracts em Ethereu
InterCon 2016 - Blockchain e smart-contracts em EthereuInterCon 2016 - Blockchain e smart-contracts em Ethereu
InterCon 2016 - Blockchain e smart-contracts em EthereuiMasters
 
Using React for the Mobile Web
Using React for the Mobile WebUsing React for the Mobile Web
Using React for the Mobile WebC4Media
 
SFSCON23 - Tommaso Bailetti - Improving developer experience in Open Source P...
SFSCON23 - Tommaso Bailetti - Improving developer experience in Open Source P...SFSCON23 - Tommaso Bailetti - Improving developer experience in Open Source P...
SFSCON23 - Tommaso Bailetti - Improving developer experience in Open Source P...South Tyrol Free Software Conference
 
Http3 fullstackfest-2019
Http3 fullstackfest-2019Http3 fullstackfest-2019
Http3 fullstackfest-2019Daniel Stenberg
 
3rd week internship report
3rd week internship report3rd week internship report
3rd week internship reportYafie Abdillah
 
Network Forensic Packet Analysis Using Wireshark
Network Forensic   Packet Analysis Using WiresharkNetwork Forensic   Packet Analysis Using Wireshark
Network Forensic Packet Analysis Using Wiresharktitanlambda
 
SEWM'14 keynote: Mining Events from Multimedia Streams
SEWM'14 keynote: Mining Events from Multimedia StreamsSEWM'14 keynote: Mining Events from Multimedia Streams
SEWM'14 keynote: Mining Events from Multimedia StreamsJonathon Hare
 

Ähnlich wie Plone ♥︎ Python 3 (20)

200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet Code200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet Code
 
Connecting The Digital To Analog - Brian Suda
Connecting The Digital To Analog - Brian SudaConnecting The Digital To Analog - Brian Suda
Connecting The Digital To Analog - Brian Suda
 
Python 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUGPython 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUG
 
Códigos
CódigosCódigos
Códigos
 
Learning python with flask (PyLadies Malaysia 2017 Workshop #1)
Learning python with flask (PyLadies Malaysia 2017 Workshop #1)Learning python with flask (PyLadies Malaysia 2017 Workshop #1)
Learning python with flask (PyLadies Malaysia 2017 Workshop #1)
 
2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics
 
Python 2 is dead! Drag your old code into the modern age
Python 2 is dead! Drag your old code into the modern agePython 2 is dead! Drag your old code into the modern age
Python 2 is dead! Drag your old code into the modern age
 
Python interview question for students
Python interview question for studentsPython interview question for students
Python interview question for students
 
The net is dark and full of terrors - James Bennett
The net is dark and full of terrors - James BennettThe net is dark and full of terrors - James Bennett
The net is dark and full of terrors - James Bennett
 
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
InterCon 2016 - Internet of “Thinking” – IoT sem BS com ESP8266
 
InterCon 2016 - Blockchain e smart-contracts em Ethereu
InterCon 2016 - Blockchain e smart-contracts em EthereuInterCon 2016 - Blockchain e smart-contracts em Ethereu
InterCon 2016 - Blockchain e smart-contracts em Ethereu
 
Using React for the Mobile Web
Using React for the Mobile WebUsing React for the Mobile Web
Using React for the Mobile Web
 
SFSCON23 - Tommaso Bailetti - Improving developer experience in Open Source P...
SFSCON23 - Tommaso Bailetti - Improving developer experience in Open Source P...SFSCON23 - Tommaso Bailetti - Improving developer experience in Open Source P...
SFSCON23 - Tommaso Bailetti - Improving developer experience in Open Source P...
 
Http3 fullstackfest-2019
Http3 fullstackfest-2019Http3 fullstackfest-2019
Http3 fullstackfest-2019
 
3rd week internship report
3rd week internship report3rd week internship report
3rd week internship report
 
Voice Assistant (1).pdf
Voice Assistant (1).pdfVoice Assistant (1).pdf
Voice Assistant (1).pdf
 
Network Forensics: Packet Analysis Using Wireshark
Network Forensics: Packet Analysis Using WiresharkNetwork Forensics: Packet Analysis Using Wireshark
Network Forensics: Packet Analysis Using Wireshark
 
Network Forensic Packet Analysis Using Wireshark
Network Forensic   Packet Analysis Using WiresharkNetwork Forensic   Packet Analysis Using Wireshark
Network Forensic Packet Analysis Using Wireshark
 
Python Presentation
Python PresentationPython Presentation
Python Presentation
 
SEWM'14 keynote: Mining Events from Multimedia Streams
SEWM'14 keynote: Mining Events from Multimedia StreamsSEWM'14 keynote: Mining Events from Multimedia Streams
SEWM'14 keynote: Mining Events from Multimedia Streams
 

Mehr von Philip Bauer

Growing pains - PosKeyErrors and other malaises
Growing pains - PosKeyErrors and other malaisesGrowing pains - PosKeyErrors and other malaises
Growing pains - PosKeyErrors and other malaisesPhilip Bauer
 
Migrations migrations migrations
Migrations migrations migrationsMigrations migrations migrations
Migrations migrations migrationsPhilip Bauer
 
Mosaic - The Layout Solution You Always Wanted
Mosaic - The Layout Solution You Always WantedMosaic - The Layout Solution You Always Wanted
Mosaic - The Layout Solution You Always WantedPhilip Bauer
 
Upgrade to Plone 5
Upgrade to Plone 5Upgrade to Plone 5
Upgrade to Plone 5Philip Bauer
 
Migrations, Upgrades and Relaunches
Migrations, Upgrades and RelaunchesMigrations, Upgrades and Relaunches
Migrations, Upgrades and RelaunchesPhilip Bauer
 
It's the way of the present - Why you should use plone.app.contenttypes
It's the way of the present - Why you should use plone.app.contenttypesIt's the way of the present - Why you should use plone.app.contenttypes
It's the way of the present - Why you should use plone.app.contenttypesPhilip Bauer
 
Alles in Allem. Wie man mit Deliverance existierende Inhalte oder Anwendungen...
Alles in Allem. Wie man mit Deliverance existierende Inhalte oder Anwendungen...Alles in Allem. Wie man mit Deliverance existierende Inhalte oder Anwendungen...
Alles in Allem. Wie man mit Deliverance existierende Inhalte oder Anwendungen...Philip Bauer
 
Plone-Content-Typen mit Dexterity
Plone-Content-Typen mit DexterityPlone-Content-Typen mit Dexterity
Plone-Content-Typen mit DexterityPhilip Bauer
 

Mehr von Philip Bauer (10)

Growing pains - PosKeyErrors and other malaises
Growing pains - PosKeyErrors and other malaisesGrowing pains - PosKeyErrors and other malaises
Growing pains - PosKeyErrors and other malaises
 
Migrations migrations migrations
Migrations migrations migrationsMigrations migrations migrations
Migrations migrations migrations
 
pdb like a pro
pdb like a propdb like a pro
pdb like a pro
 
Mosaic - The Layout Solution You Always Wanted
Mosaic - The Layout Solution You Always WantedMosaic - The Layout Solution You Always Wanted
Mosaic - The Layout Solution You Always Wanted
 
Upgrade to Plone 5
Upgrade to Plone 5Upgrade to Plone 5
Upgrade to Plone 5
 
Migrations, Upgrades and Relaunches
Migrations, Upgrades and RelaunchesMigrations, Upgrades and Relaunches
Migrations, Upgrades and Relaunches
 
Pimp my Plone
Pimp my PlonePimp my Plone
Pimp my Plone
 
It's the way of the present - Why you should use plone.app.contenttypes
It's the way of the present - Why you should use plone.app.contenttypesIt's the way of the present - Why you should use plone.app.contenttypes
It's the way of the present - Why you should use plone.app.contenttypes
 
Alles in Allem. Wie man mit Deliverance existierende Inhalte oder Anwendungen...
Alles in Allem. Wie man mit Deliverance existierende Inhalte oder Anwendungen...Alles in Allem. Wie man mit Deliverance existierende Inhalte oder Anwendungen...
Alles in Allem. Wie man mit Deliverance existierende Inhalte oder Anwendungen...
 
Plone-Content-Typen mit Dexterity
Plone-Content-Typen mit DexterityPlone-Content-Typen mit Dexterity
Plone-Content-Typen mit Dexterity
 

Kürzlich hochgeladen

Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 

Kürzlich hochgeladen (20)

Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 

Plone ♥︎ Python 3

  • 1. P L O N E P Y T H O N 3 PHILIP BAUER ♥
  • 2. TEXT (WAS UNICODE IN PY2) BYTE S (WAS STRING IN PY2) STRING (BYTES IN PY2 / TEXT IN PY3)
  • 3. BYTES ARE MEASURED IN KILOS, STORED IN DISKS AND TRANSFERED THROUGH CABLES
  • 4. SAY: TEXT & BYTES
 NOT: UNICODE & STRING
  • 5. U N I C O D E S A N D W I C H B Y T E S | T E X T | B Y T E ST E X T
  • 7. s a f e _ n a t i v e s t r i n g b y t e s i n p y 3 t e x t i n p y 3
  • 8. >>> 'foo' == u'foo' True >>> 'foo' + u'foo' u'foofoo' >>> u'foo' + 'foo' u'foofoo' Python 2 IMPLICIT CONVERSION
  • 9. >>> b'foo' == 'foo' False >>> 'foo' + b'foo' TypeError: can only concatenate str (not "bytes") to str >>> b'foo' + 'foo' TypeError: can't concat str to bytes Python 3 IMPLICIT CONVERSION
  • 10. >>> byte = b'huhu' >>> byte 'huhu' >>> byte.decode('utf8') u'huhu' >>> byte.encode('utf8') 'huhu' Python 2: bytes EXPLICIT CONVERSION
  • 11. >>> byte = b'huhu' >>> byte b'huhu' >>> byte.decode('utf8') 'huhu' >>> byte.encode('utf8') AttributeError: 'bytes' object has no attribute 'encode' Python 3: bytes EXPLICIT CONVERSION
  • 12. >>> text = u'foo' >>> text u'foo' >>> text.encode('utf8') 'foo' >>> text.decode('utf8') u'foo' Python 2: text EXPLICIT CONVERSION
  • 13. >>> text = 'foo' >>> text 'foo' >>> text.encode('utf8') b'foo' >>> text.decode('utf8') AttributeError: 'str' object has no attribute 'decode' Python 3: text EXPLICIT CONVERSION
  • 15. >>> [i for i in 'huhu'] ['h', 'u', 'h', 'u'] Python 2 ITERATING OVER BYTES
  • 16. >>> [i for i in b'huhu'] [104, 117, 104, 117] >>> [chr(i) for i in b'huhu'] ['h', 'u', 'h', 'u'] >>> [chr(i).encode('utf8') for i in b'huhu'] [b'h', b'u', b'h', b'u'] Python 3 ITERATING OVER BYTES
  • 17. P Y T H O N 3 . 3 • Py3: u'text' • Py2: b'bytes' • u'text' is text in py2 and py3 • b'bytes' is bytes in py2 and py3
  • 18. • text/bytes is the main issue when migrating code • It makes much more sense in py3 • Writing code that works in py2/py3 is not easy
  • 19. L E T ' S TA L K A B O U T B R A Z I L
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 28.
  • 29. POR TING PLONE TO PYTHON 3
  • 30.
  • 31. 1. MIGRATE PACKAGES FLYING BLIND • Tools: six, sixer and python-modernize • Educated Guessing™ • Testing in Python 2
  • 32. 2 . S TA R T U P A N D M A N U A L T E S T • Fix what breaks • Test features manually • Nightly demo
  • 33. 3 . A U T O M AT E D T E S T S • Get > 10.000 tests to work on Python 3 • Hunt & kill test-isolation issues • doctests oh my
  • 34.
  • 36. THANK YOU TO ALL THAT HELPED
  • 37. STEFFEN ALLNER | PHILIP BAUER | ROEL BRUGGINK | GODEFROID CHAPELLE | MAIK DERSTAPPEN | GIL FORCADA | HARALD FRISENEGGER | DAVID GLICK | DANIEL HAVLIK | MICHAEL HOWITZ | JENS KLEIN | DAVI LIMA | ALEXANDER LOECHEL | THOMAS LOTZE | PETER MATHIS | JAN MEVISSEN | ROBERT NIEDERREITER | JONI ORPONEN | ALESSANDRO PISA | JOHANNES RAGGAM | MAURITS VAN REES | MANUEL REINHARDT | THOMAS SCHORR | ERIC STEELE | JENS VAGELPOHL | MATTHEW WILKES | ANDI ZEIDLER
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 48. 1 . U P G R A D E T O P L O N E 5 . 2 • Use Python 2.7
  • 49. 2 . D R O P A R C H E T Y P E S • It's not asking too much • Migration for default types is available since 2013 • Migration for custom types is available since 2015
  • 50. 3 . M I G R AT E Y O U R C O D E T O P Y T H O N 3 • Without Database • Support Python 2 and Python 3 • Small addons: Startup and fix whatever fails • Bigger addons: Use python-modernize • Same with tests • Beware of complex doctests
  • 51. 4 . M I G R AT E A D D O N S • Same as above • Everyone benefits
  • 52. 5 . M I G R AT E Y O U R D ATA B A S E • See David Glick's Talk • Downtime/Read-only might be ineviable
  • 53. 6 . D E P L O Y O N P Y T H O N 3 • Test the production-setup with WSGI early
  • 54. STAR T NOW DON'T WAIT WORK ITERATIVELY
  • 55. R O A D M A P • 5.2a1 now • 5.2 final in February
  • 56. T O D O • FTP and/or WebDAV • DB Migration • Upgrade- and porting-guide • Migrate Addons • Performance-tests
  • 57. COME TO THE SPRINT
  • 61. W H E N W I L L P L O N E D R O P S U P P O R T F O R P Y T H O N 2 ?
  • 63. WILL ARCHETYPES BE POR TED TO PYTHON 3?
  • 64. HOW DO WE REPLACE FTP/WEBDAV?
  • 65. W H Y D I D Y O U N O T ' S I M P LY ' M I G R AT E T O G U I L L I O T I N A ?
  • 66. CAN I NOW USE ASYNC/ AWAIT?
  • 67. W H Y D O E S N ' T T H E P L O N E F O U N D AT I O N S I M P LY B U Y S U P P O R T F O R P Y T H O N 2 . 7 F R O M R E D H AT / I B M F O R A L L O F U S ?
  • 68. DOES PYTHON 3 MAKE PLONE RUN FASTER?
  • 69. CAN I RUN THE SAME DB IN PY2 AND PY3?
  • 70. I S A D D O N < Y O U R N A M E H E R E > A L R E A D Y P O R T E D ?
  • 71. W I L L T H I S I N C R E A S E P L O N E ' S M A R K E T S H A R E ?
  • 72. HOW DO I DEPLOY INTO PRODUCTION?
  • 73. WILL THIS WORK ON WINDOWS?
  • 74. ARE PRODUCTION-TOOLS ALREADY WORK, LIKE BACKUP, ZRS OR RELSTORAGE?
  • 75. DOES BOBTEMPLATES.PLONE AND PLONECLI ALREADY WORK IN PY3?
  • 77. @StarzelDe pbauer P L O N E P Y T H O N 3 PHILIP BAUER ♥ THANKS