This week we welcome Kyle Stanley (@aeros_py) as our PyDev of the Week! Kyle is a core developer of the Python programming language. If you'd like to see what Kyle is working on, you can check out his Github profile. You can also connect with Kyle on LinkedIn.
Let's spend some time getting to know Kyle better!
Can you tell us a little about yourself (hobbies, education, etc):
Hi, my name is Kyle Stanley. I'm a 23-year-old college student finishing up the last year of my B.S. degree (Information Systems Technology, Programming spec.). Most notably, I was recently promoted to the role of core developer for CPython, the default/reference implementation of the Python programming language (in April 2020). I mostly contribute to the standard library through reviews and my own authored changes, as both a hobby that I enjoy and a means of building my professional experience in the software development industry. Most of my significant contributions have been to the modules asyncio and concurrent.futures.
I'm also decently active in various CPython development communities, such as discuss.python.org, email@example.com, and firstname.lastname@example.org. Although, I probably end up spending far more time reading posts from the wide variety of experts in the community than I do writing my own posts. Over time, I've discovered that there's an infinite well of knowledge to be gained from the discussions, as long as one has the time and patience to sort through the significant volume of content to find the "hidden" gems. I'm very grateful to the many active experts on there.
Outside of CPython, I'm involved in the Python Discord community as a Moderator. As far as other hobbies go, I also enjoy programming challenge sites such as Codewars, reading fantasy novels, playing RPG video games (recently Mount and Blade 2: Bannerlord), watching various sci-fi TV series such as Star Trek, and riding my bike.
Why did you start using Python?
~6-7 years ago, Python was my first serious programming language. From back in high school when I joined my school's STEM academy, I had a strong interest in technology and wanted to pick up programming as a skill once I realized how fundamentally important it is for many IT career paths. After a significant amount of "testing the waters" with other languages, I found Python to have the most intuitive and human-friendly syntax out of the languages that had significant real-world utility. Although there is a significant amount of depth underneath the surface, I find that the core syntax seamlessly flows from thought to code.
What projects are you working on now?
I have a few ongoing CPython projects, but my most substantial current project is probably asyncio.ThreadPool, which is a high-level asynchronous thread pool designed to be used as a context manager (e.g. ``async with asyncio.ThreadPool() as pool:``). The primary use case for it in CPython is concurrent execution of long-running, IO-bound subroutines (non-async functions/methods) that would normally block the event loop (such as for network programming, DB connectors, inter-process communication, file IO, etc.), particularly for existing code or libraries that can't be easily converted to use async/await. Threads have a bit more overhead than using coroutines (`async def` functions/methods), but when it's not a realistic or available option to convert the existing code to use them, it's often far more efficient to execute the subroutine in a thread pool rather than blocking the event loop for a significant period of time.
This can technically already be done using the existing `asyncio.loop.run_in_executor()` method, but it's significantly less intuitive, and gives far less flexibility to the user for controlling when the thread pool's resources are created and finalized. Also, it's a more long-term goal for asyncio.ThreadPool to have a completely asyncio-native implementation, instead of relying upon concurrent.futures under the hood (which wasn't really a viable option for `loop.run_in_executor()`). There's a non-trivial cost incurred in the conversion process, so converting to a completely asyncio-native version could very likely result in significant performance improvements. We're starting with one that relies on concurrent.futures for initial stability and giving users the chance to provide feedback on the API.
See https://github.com/python/cpython/pull/18410 for details.
What other programming languages do you know and which is your favorite?
I also know C#, Java, JS, and C/C++, roughly in order of familiarity. Of course, I would consider Python to be my favorite, and C# to be my second favorite, with Java ranking in last. Although Java has a strong presence in the software development industry and is not going away anytime soon, I find it to be rather excessively heavy in boilerplate. I'm also not of fan of some of the common design patterns and library APIs.
Which Python libraries are your favorite (core or 3rd party)?
My favorites in the standard library are probably the ones I've spent the most time contributing to, asyncio and concurrent.futures! Outside of that, it's very hard to select a few favorites with all of the great modules, but I also very much like the API of the threading and multiprocessing modules; and find collections, functools, and itertools to provide a significant amount of practical utility on a regular basis. I also find myself rather frequently using the os, json, shutil, and pathlib modules. Also, honorable mentions to the more recent dataclass module added in 3.7.
As for 3rd party modules, there are a bit too many to really pin down a few favorites, but just to name a few that I've used the most: requests, bs4, flask, aiohttp, and asyncpg. Here's a few that I've been learning or wanting to learn: Django, NumPy, pandas, and PyTorch.
How did you end up becoming a Python core developer?
It started with my first contribution to the CPython repository, which was a rather trivial change to the documentation that served mostly as an introduction to the workflow. All it really did was make some minor grammatical improvements to the wording in the design FAQ section. Over time, I gradually worked on issues of increasing complexity, from helping to reorganize tests, replacing an obsolete function, more involved documentation changes, bug fixes, PR review, and eventually helping Mariatta Wijaya with creating the "Python Triage" team that I ended up joining. It served as an excellent stepping stone position, as it provided some responsibilities with the management of issues and PRs, such as prioritization, labeling, closing, etc.
Then, I reached out to a core developer that I had worked with on a project for asyncio, Yury Selivanov. He's mainly known as one of the two primary maintainers of the asyncio module, creator of async/await, and CEO of EdgeDB. He very graciously accepted my request for starting a core developer mentorship. Over the course of several months (starting from September 2019), he provided guidance, answered my countless questions, gave invaluable feedback on my PRs, and strongly encouraged my contributions. I am eternally grateful for his support, both past and ongoing.
Finally, on April 14, 2020, Yury proposed to promote me to the role of core developer. In order to become one, it requires a yes vote from at least 2/3rds of the core developers that choose to participate. I'll openly admit that I had some serious doubts that I would meet their standards, considering the extensive professional backgrounds of the existing core developers; and my rather limited knowledge of the C-API and interpreter internals. But, based on my contributions to the standard library in Python code and docs, PR reviews, and involvement on the mailings lists, I was promoted with 100% approval out of 27 votes. The amount of support honestly blew me away and made me incredibly happy; I had really not expected that at all.
It's been a goal of mine for quite some time to give back to Python in some meaningful way for introducing me to real programming in the first place. But, if someone had told me around year ago when made my first contribution that I would become a core developer in the next year, I probably wouldn't believe them!
I'm very proud to be able call myself a member of the Python core development team; however, I still have a lot to learn. 🙂
Do you have any favorite obscure libraries or features of Python?
I'm not certain as to how obscure this would actually be, but my recent favorite "lesser-known" feature of Python is probably the `__enter__`/`__exit__` and `__aenter__`/`__aexit__` dunder methods that are used for implementing context managers. Most users are probably familiar with using context managers in general (e.g. ``with open(...) as f:``) and with using them in 3rd party libraries, but many may not aware how they work under the hood, and how easily they can be used to replace many `try-finally` statements for safe resource finalization. Not only does it help to ensure that finalization calls are not forgotten, it also helps the code focus more on the core logic. I find that reducing common lines of boilerplate is almost always a good thing, and is a strong advantage of using high-level languages.
I'd recommend reading the following blog post for more information, for anyone that isn't aware of how context managers work: https://jeffknupp.com/blog/2016/03/07/python-with-context-managers/.
In general, I'm a huge fan of Python's data model, and all of the various dunder methods that can be used for incredible amounts of class customization, which is frequently not available in other languages. For any intermediate+ user of Python, I very highly recommend reading over the following documentation: https://docs.python.org/3/reference/datamodel.html. I still find myself frequently revisiting that page.
Is there anything else you’d like to say?
Thank you very much for asking me to do this interview! It's the first public one I've ever done, so apologies if I went too far into detail on anything. Thank you to anyone who read this far. If anyone is curious about some of my contributions to CPython, I'd recommend checking out my GitHub. For future substantial contributions, I've been trying to make the habit of mentioning them on twitter.
Also, although my primary focus at the moment is on finishing my B.S. degree in December (after the Fall 2020 semester), I am open to any exceptional job opportunities; especially ones that would allow me to make use of my experience with Python and open-source software development. Feel free to reach out to me via email at email@example.com or on LinkedIn.
Thanks for doing the interview, Kyle!
Copyright © 2022 Mouse Vs Python | Powered by Pythonlibrary