The Python ecosystem has been rapidly evolving during the recent years. Here's a subjective take on what are the hot topics at the moment.
Python 🤝 Rust
Boosting CPU-bound work with C extensions have gotten a worthy competitor from Rust. The key enabler has been PyO3 which offers Rust bindings for Python. PyO3 makes it possible to easily use Rust code from Python. It also has support for using Python from Rust but I believe the former has more significant impact on the Python ecosystem.
Some concrete examples of the Python + Rust friendship:
- pydantic-core: the validation core for pydantic v2 (the v2 plan). Samuel Colvin, the author of pydantic, will give a related talk in Pycon 2023.
- ruff: extremely fast linter. It already has almost feature parity with Flake8 including some of the popular plugins. Additionally, it has the same features as tools like autoflake, isort, pydocstyle, and pyupgrade. Thus, it's basically becoming a Swiss army knife for linting Python code.
- polars: faster DataFrames, aka a performant competitor for super widely used pandas.
- Robyn: async Python web framework with Rust runtime. Here's a blog post about Robyn's roadmap for 2023.
In addition to PyO3, increase in Rust's adoption and popularity hasn't hurt either. I expect to see more Rust in Python related projects and tooling in the coming years. Python + Rust combination may also be in high demand in the future job market.
Another category is Python in the browser which is already feasible via Pyodide, PyScript and friends. The fundamental enabler is WASM (WebAssembly) which is compatible with all the major browsers. At the time of writing this blog post, there's experimental support for WASM builds of CPython in the CPython source code repository. If you want to dive deeper, have a look at Python 3.11 in the Web Browser talk by Cristian Heimes in PyConDE 2022.
The WASM story is in its early days but it has a huge potential to make Python more accessible and enable new use cases. I expect loads of innovation in this space in the near future.
Typing support is constantly evolving in CPython. For example, Python 3.10 shipped four and 3.11 five typing related PEPs. Also, there's dedicated Typing Summit as part of PyCon. At the same time, tooling around typing has matured and diversified. For example, nowadays there's at least a handful of static type checkers to choose from (e.g. mypy, Pyright, pytype, and Pyre). Additionally, some of the packages (e.g. pydantic) cleverly utilise type information in runtime.
The era of
*args, **kwargs is coming to an end. Well-specified, type annotated signatures are taking over. Around the time of Python 3.6 and 3.7, I was among the typing skeptics but I've slowly turned into a believer during the past couple of years after witnessing the practical benefits in professional life. Most importantly, types improve readability tremendously. When the readability aspect is combined with IDEs providing a set of convenience features enabled by type information, navigating bigger Python codebases has become a sensible exercise. On the flip side, battling with untyped codebases feels burdensome after getting used to the superpowers that type information brings.
Increasing number of open source packages, that we all love and depend on, have gradually started adding type information. It's awesome! The workarounds with type stubs are clumsy, require extra work, and bring unnecessary complexity. Sunsetting support for older Python versions certainly helps open source package maintainers to adopt type hints inline with the actual implementation. Once you've added types in your source code, remember to include py.typed file in the root level of your package (read more in PEP 561)! Otherwise static type checkers of the dependants of your package will ignore the precious type information.
Perhaps it's worth noting that I mainly focus on backend development and the list above likely reflects that. I'm sure the list of hot topics would quite different if it would be written by a data scientist or a machine learning engineer.
I obviously couldn't resist asking what ChatGPT thinks about the matter:
Whatever the ongoing and future trends, Python is more popular than ever. At the time of writing this (February 2023), there are 431k projects and 665k users in PyPI. Python is leading the "how often language tutorials are searched in Google" with 27.93 % stake (source). r/Python has 1.1M and r/learnpython has 680k members. Let's see what those numbers are in a year.
Happy coding with Python (and Rust 😉)!