5 things to watch in Python in 2017
An improved asyncio module, Pyjion for speed, and moving to Python 3 will make for a rich Python ecosystem.
Python is everywhere. It’s easy to learn, can be used for lots of things, and often is the right tool for the right job. The huge standard library and refreshingly abundant libraries and tools make for a very productive programming biosphere. The 3.6 release was just last month, and included various improvements, such as:
- New features in the asyncio module
- Addition of a file system path protocol
- Formatted string literals
Here I’ll offer a few thoughts on a some things from this recent release and elsewhere in the Python biome that have caught my eye. This is nowhere near an exhaustive list, so let me know other things you think will be important for Python for 2017.
Will Pyjion’s boost be just in time?
Speeding up runtime performance has been in Python’s sights for a while. PyPy has aimed to tackle the issue since its official release in 2007, while many developers have turned to Cython (the C extension of Python) to improve speed, and numerous just-in-time (JIT) compilers have been created to step up runtime. Pyjion is one new JIT compiler for revving up speed; it accelerates CPython (the Python interpreter) by boosting its stock interpreter with a JIT API from Microsoft’s CoreCLR project.
The goals of the Pyjion project, as explained in the FAQ section of the Pyjion Github repository, are: “… to make it so that CPython can have a JIT plugged in as desired. That would allow for an ecosystem of JIT implementations for Python where users can choose the JIT that works best for their use-case.” Such an ecosystem would be a great boost for Python, so I’m hopeful, along with a lot of other folks, that 2017 will see Pyjion or others like it make faster Python fauna.
To explore Cython as one alternative for speedier Python, check out the Learning Cython video course by Caleb Hattingh. You can also download Hattingh’s free ebook, 20 Python Libraries You Aren’t Using (But Should).
Asyncio is no longer provisional. Let the concurrency begin!
In Python 3.6, the asyncio module is no longer provisional and its API is now considered stable; it’s had usability and performance tweaks, and several bug fixes. This module supports writing single-threaded concurrent code. I know a lot of Python developers who work with asynchronous code are eager to check out this improved module and see what the new level of concurrency can do for their projects.
An uptick in use of the asyncio module will likely draw even more attention to the CPU-bound performance of CPython, since the upper bound of achievable concurrent connections becomes CPU-bound for a wide range of typical services. This gives us another reason to root for a great JIT compiler to speed things up!
For more on making your Python more powerful, check out Aaron Maxwell’s trainings, Python: Beyond the Basics and Python: The Next Level, and Luciano Ramalho’s Oriole online tutorial, Fluent Python: The Power of Special Methods.
Python 3 is king of the mountain!
Python 2.7 was the last major release of Python 2, and no more feature releases are planned, as support is moving to Python 3. Regardless of how you feel about that change, the future is Python 3! There will be many discussions on migrating legacy projects from Python 2 over to Python 3 in 2017 and beyond. I’ll be watching as this happens and working on O’Reilly resources and training to help developers make this move. I’d love to hear from you about the Python 3 content you’d like to see.
For more on moving from Python 2 to 3, check out Ben Straub’s Porting from Python 2 to Python 3.
Loads of tools for science and education
I’ve heard it said the Python is this (scientific) generation’s Fortran, with tools like Cython often providing the bridge between the interpreter and the optimized scientific libraries. The “this generation” part of that idea mostly makes me feel old, since my first programming language was Fortran, but there is some truth there. Two of the big growth areas for Python have been science and education. Hardware and IoT have seen MicroPython gaining a lot of ground in the embedded world, and as embedded programmers begin using Python and collaborating with Python developers working in vastly different areas, we should see some interesting projects not even imagined yet.
Also, in case you forgot, Python 3 is now king of the mountain, and the buzz is that Raspberry Pi, micro:bit, and Calliope all support Python 3. AdaFruit also now has updated Python software libraries that support Python 3 for the Raspberry Pi and other small Linux computers. All of this means potentially exponential growth for Python 3 in education circles.
For more on Python in education, download the free ebook, Python in Education: Teach, Learn, Program, by Nicholas Tollervey.
Data science and Python growing at a fast clip
That Python ecosystem I mentioned at the beginning of the article is full of data science tools, and for good reason: there’s a ton of data science work out there and much of it is being done with open-source tools like those in Python. Fintech, big business, and science can all use Python’s ever-growing toolset. Some folks are noticing a lot of growth in the non-programmer use of Python data science tools for their data, which brings a whole new set of fauna into the Python ecosystem!
For an excellent overview of using Python for data science, flip through the Python Data Science Handbook, by Jake VanderPlas.