This week we welcome Bryan Weber (@darthbith) as our PyDev of the Week! Bryan is a contributor for Real Python and a core developer for Cantera. If you’d like to learn more about Bryan, you can check out his website or his Github profile. Let’s take a few moment to get to know him better!
Can you tell us a little about yourself (hobbies, education, etc):
I am a teaching professor at the University of Connecticut, as well as the Director of Undergraduate Studies for Mechanical Engineering. This means that I focus mostly on improving the education of our undergraduate students. I teach a lot of thermodynamics and fluid mechanics courses, and I’ve developed a few Python packages to help with that.
I got my doctorate in Mechanical Engineering in 2014, also from the University of Connecticut. One of my favorite things about mechanical engineering is that it is a super broad field, covering everything from robotics to chemistry, cars and trucks to planes and rockets, and everything in between.
My hobbies are open source software, Ultimate Frisbee, and cooking. I have a daughter and I love spending time as a family. Aside from that, there isn’t much time for anything else!
Why did you start using Python?
While I was in grad school, my dissertation was focused on developing experimental data for biofuels. Originally, I wrote all of my data processing in MATLAB because that was the language I knew from undergrad. At some point, I realized that if I wanted to practice open science, that included sharing the data processing scripts as well as the raw data. Of course, MATLAB is proprietary software and is quite expensive. This means that my work would not be really open and free (as in speech).
So I rewrote everything in Python, so that I could share it all! I chose Python because another package that I wanted to use had a Python interface, and it made it easy to integrate everything together. The package I wrote for data processing is still on GitHub (it is called UConnRCMPy) although I’m not sure if anyone uses it at all.
What other programming languages do you know and which is your favorite?
I used to know FORTRAN and MATLAB pretty well, but those skills have mostly atrophied. I can read most C++ code, but can’t write it all that well. Python is by far my favorite language that I’ve learned so far. I’m also very interested to learn Julia and see how it compares!
What projects are you working on now?
I have developed a few software packages to use in my classes. I’ve written an extension for the Jupyter Notebook that allows one to download several Notebooks as PDFs. This uses nbconvert and pdfrw to automatically stitch together the converted Notebooks into one PDF. I use this in my classes for students to do their homework right in the Jupyter Notebook and then submit a PDF of their code + explanations. For my classes, autograding doesn’t work very well, so this is a nice substitute.
Aside from teaching, I spend most of the rest of my time working on Cantera, the open source package for thermodynamics, chemical kinetics, and transport phenomena. I’ve been one of the lead developers since about 2013, but Cantera was the package that inspired me to use Python in the first place, so I must have known about it in 2010 or 2011. The core of Cantera is written in C++ because it needs to be fast and we use Cython to generate a Python interface. Cython is an excellent package that makes it really easy to write code that looks a lot like Python but can be compiled to a C library. Since Cython generates a C library, it is pretty simple to link with other C or C++ code like the core of Cantera.
I’m a pretty heavy user of Conda, the cross-platform package manager as well. I’ve written Conda recipes to build packages for Cantera and the other libraries that I’ve developed, and even contributed a small change to conda-build itself! I’ve learned a lot about compiling and linking C/C++ code on all the major platforms and I have a ton of appreciation and respect for the people who really get this stuff.
Which Python libraries are your favorite (core or 3rd party)?
NumPy is so foundational to everything I do, that has to be one of my favorites. I also love the Pint library, which handles physical unit conversions (how many feet in a meter?). Pint was just featured on the Python Bytes podcast as well! I also use the Nikola and Pelican static HTML generators pretty frequently for Cantera and my personal website, respectively.
How did you end up writing for Real Python?
I saw a tweet from Real Python that they were looking for authors, and decided to apply! My first article was about how to write a main() function in Python, and I’ve since written an article about switching from MATLAB to Python, and I have a few more in the pipeline I’m excited to share!
How do you choose what articles to write?
I typically look for articles that cover something I already know pretty well, like switching from MATLAB to Python, or something that I want to learn about. My upcoming articles are about doing optimization with SciPy and getting started with the datetime library. I think time in programming is such a fascinating idea, especially because it’s so complicated!
Is there anything else you’d like to say?
If you don’t donate to the Python Software Foundation or other non-profit organizations in the open-source space, please consider doing so. Cantera is a fiscally sponsored project under the NumFOCUS umbrella, another non-profit that accepts donations on behalf of the projects. If you use open-source software in your work, please consider a program like Tidelift so your company can help support open source as well. And if you don’t have the financial resources to give back, and you do have the time to give back, contributing code or editing documentation is another great way to be involved!
Thanks for doing the interview Bryan!