How to Stop Worrying and Start a Project
with Python 3
Viacheslav Kakovskyi
Austin Python Meetup 2017
Me!
Backend Software Technical Lead
Python 2 and Twisted → Python 3 and asyncio
Ukraine → Austin, Texas
Share knowledge at Python events
● PyCon Ukraine 2016
● PyCon Poland 2016
● KyivPy 2015, WebCamp Ukraine 2016
● Austin Python Meetup 2017
2
@kakovskyi
3
3 months back from today...
https://www.slideshare.net/mariczhuck/austin-python-meetup-2017-whats-new-in-pythons-35-and-36
Agenda
1. The story about my journey from 2 to 3
2. Should I use Python 3, not 2?
3. Discover the benefits with your team
4. How to discuss switching to Python 3 with your
manager
5. Summary
4
Who uses
Python 3
in production?
5
The story about my journey
6
# python2
@defer.inlineCallbacks
# python2, small projects
@app.route('')
The story about my journey
7
# python2, big project
d = defer.Deferred()
d.addCallback(foo)
d.addErrback(bar)
# python3, non-commercial project
async / await
The story about my journey
8
# python3, big project
Should I use
Python 3, not 2?
9
Reasons to use Python 3 for a developer
10
Reasons to use Python 3 for a developer
11
New syntax features make our life easier
● PEP 448, additional unpacking generalizations
● PEP 465, a new matrix multiplication operator `a @ b`
● PEP 492, coroutines with async and await syntax
● PEP 498, formatted string literals
● PEP 515, underscores in numeric literals
● PEP 525, asynchronous generators
● PEP 526, syntax for variable annotations
● PEP 530, asynchronous comprehensions
● and others
PyCharm: in late 2017 py3.users > py2.users
12
Does ... work with Python 3?
13
95% of most popular
PyPI libraries support
Python 3
http://py3readiness.org/
New Python libraries will be Python 3 only
14
Libs tagged on PyPI
● Python 3: 55.5%
○ 75669 releases
● Python 2: 44.5%
○ 60732 releases
Libs releases tagged on PyPI
15
Python 3 (75669)
● 3 (22701)
● 3.0 (733)
● 3.1 (1161)
● 3.2 (4902)
● 3.3 (13462)
● 3.4 (17117)
● 3.5 (12793)
● 3.6 (2800)
Python 2 (60732)
● 2 (16725)
● 2.3 (87)
● 2.4 (440)
● 2.5 (1333)
● 2.6 (11142)
● 2.7 (31005)
Py2 EOL in 3 yrs
16
https://pythonclock.org/
17
Is Python 3 a thing
for your team?
Rewriting
Python 2 service
from scratch
with Python 3
18
19
(STARE)
ARE YOU SURE?
Extending functionality with new services
20
Creating
async
services
easily
21
Welcome to the async World!
22
○ aiohttp_admin
○ aiomcache
○ aiocouchdb
○ aiomeasures
○ aiobotocore
○ aiozmq
○ aioodbc
○ aiokafka
○ aioes
○ your async library here
○ aiohttp
○ aiopg
○ aiomysql
○ aioredis
○ aiokafka
Better developers experience
23
● async /await
● typing module and type hinting
● tracemalloc module
● asynctest library
● hypothesis library
● behave library
Discuss
switching to
Python 3 with
your manager
24
0. Make side
project with
Python 3
25
1. Find small
isolated part
of your
project
26
2. Implement
that with
Python 3 using
the new things
27
28
3. Tell the manager that the
part will still be working in
2020... not as the rest of
codebase
(previous slide was a joke)
29
Experience of my team:
Dev speed is pretty good
after the first month
30
Summary
● The future is already here
● Learn new Python 3 features - they are great
● Make side projects and prototypes to gain experience
● New learners - invest your time only in Python 3
● Start new projects only with Python 3
31
32
33
@kakovskyi
viach.kakovskyi@gmail.com
Questions?

Austin Python Meetup 2017: How to Stop Worrying and Start a Project with Python 3

  • 1.
    How to StopWorrying and Start a Project with Python 3 Viacheslav Kakovskyi Austin Python Meetup 2017
  • 2.
    Me! Backend Software TechnicalLead Python 2 and Twisted → Python 3 and asyncio Ukraine → Austin, Texas Share knowledge at Python events ● PyCon Ukraine 2016 ● PyCon Poland 2016 ● KyivPy 2015, WebCamp Ukraine 2016 ● Austin Python Meetup 2017 2 @kakovskyi
  • 3.
    3 3 months backfrom today... https://www.slideshare.net/mariczhuck/austin-python-meetup-2017-whats-new-in-pythons-35-and-36
  • 4.
    Agenda 1. The storyabout my journey from 2 to 3 2. Should I use Python 3, not 2? 3. Discover the benefits with your team 4. How to discuss switching to Python 3 with your manager 5. Summary 4
  • 5.
    Who uses Python 3 inproduction? 5
  • 6.
    The story aboutmy journey 6 # python2 @defer.inlineCallbacks # python2, small projects @app.route('')
  • 7.
    The story aboutmy journey 7 # python2, big project d = defer.Deferred() d.addCallback(foo) d.addErrback(bar) # python3, non-commercial project async / await
  • 8.
    The story aboutmy journey 8 # python3, big project
  • 9.
  • 10.
    Reasons to usePython 3 for a developer 10
  • 11.
    Reasons to usePython 3 for a developer 11 New syntax features make our life easier ● PEP 448, additional unpacking generalizations ● PEP 465, a new matrix multiplication operator `a @ b` ● PEP 492, coroutines with async and await syntax ● PEP 498, formatted string literals ● PEP 515, underscores in numeric literals ● PEP 525, asynchronous generators ● PEP 526, syntax for variable annotations ● PEP 530, asynchronous comprehensions ● and others
  • 12.
    PyCharm: in late2017 py3.users > py2.users 12
  • 13.
    Does ... workwith Python 3? 13 95% of most popular PyPI libraries support Python 3 http://py3readiness.org/
  • 14.
    New Python librarieswill be Python 3 only 14 Libs tagged on PyPI ● Python 3: 55.5% ○ 75669 releases ● Python 2: 44.5% ○ 60732 releases
  • 15.
    Libs releases taggedon PyPI 15 Python 3 (75669) ● 3 (22701) ● 3.0 (733) ● 3.1 (1161) ● 3.2 (4902) ● 3.3 (13462) ● 3.4 (17117) ● 3.5 (12793) ● 3.6 (2800) Python 2 (60732) ● 2 (16725) ● 2.3 (87) ● 2.4 (440) ● 2.5 (1333) ● 2.6 (11142) ● 2.7 (31005)
  • 16.
    Py2 EOL in3 yrs 16 https://pythonclock.org/
  • 17.
    17 Is Python 3a thing for your team?
  • 18.
    Rewriting Python 2 service fromscratch with Python 3 18
  • 19.
  • 20.
  • 21.
  • 22.
    Welcome to theasync World! 22 ○ aiohttp_admin ○ aiomcache ○ aiocouchdb ○ aiomeasures ○ aiobotocore ○ aiozmq ○ aioodbc ○ aiokafka ○ aioes ○ your async library here ○ aiohttp ○ aiopg ○ aiomysql ○ aioredis ○ aiokafka
  • 23.
    Better developers experience 23 ●async /await ● typing module and type hinting ● tracemalloc module ● asynctest library ● hypothesis library ● behave library
  • 24.
    Discuss switching to Python 3with your manager 24
  • 25.
    0. Make side projectwith Python 3 25
  • 26.
    1. Find small isolatedpart of your project 26
  • 27.
    2. Implement that with Python3 using the new things 27
  • 28.
    28 3. Tell themanager that the part will still be working in 2020... not as the rest of codebase
  • 29.
  • 30.
    Experience of myteam: Dev speed is pretty good after the first month 30
  • 31.
    Summary ● The futureis already here ● Learn new Python 3 features - they are great ● Make side projects and prototypes to gain experience ● New learners - invest your time only in Python 3 ● Start new projects only with Python 3 31
  • 32.
  • 33.