This week we welcome Roman Right (@roman_the_right) as our PyDev of the Week! Roman is the creator of Beanie, an Asynchronous Python object-document mapper (ODM) for MongoDB.
You can see what else Roman contributes to over on GitHub. Let’s take some time to get to know Roman better!
Can you tell us a little about yourself (hobbies, education, etc):
I’m a lucky man – the husband of the most beautiful woman and father of the cutest and smartest boy (hey, Anna, Mark!). This role is the most important and interesting for me now.
In addition, I’m a big fan of Lego blocks. Really can stay in front of the sets in the shop and just stare for hours. Or try to reproduce some model but with the details I have. There is something mesmerizing in this.
I work as a Principal Software Developer in OneTrust. We with my colleagues build a service that removes sensitive information from digital documents.
Also, I can be known as the author of Beanie – MongoDB ODM.
Why did you start using Python?
The very first programming language that I used professionally was ActionScript. In ancient times, when web pages were mostly static, there was a technology called Flash which had this family of languages – ActionScript. It allowed adding fantastic things to the sites like animation, complicated client-server logic, etc. There were a lot of games (and some very good) you could play in your browser, which was built with flash. Some websites were written fully in Flash and had a magically responsive interface instead of page reloading. But this worked on the client-side only. I saw the backend as a logical continuation of my growth in the industry. This is how Python (with Django at that time) came into my life. Flash was replaced with html5 and silently forgotten soon, but Python is still with me.
What other programming languages do you know and which is your favorite?
I can not say I know any language on the same level as I know Python, as I use mostly Python in my working tasks. I can passably write in Rust and I really like its syntax. This language is for developers, not vice versa.
Sometimes I make extensions to Python applications with Nim. Highly recommend it. Anyone can start using it in 5 minutes after opening the documentation. And at the same time, it is nearly as fast as C. It can be super useful if you need to speed up some CPU-bound things in your Python application.
I like to play with some not very popular languages like Dart or Elixir. It is nice to look at new patterns, you couldn’t use before.
What projects are you working on now?
I continue to work on my main open source project Beanie ODM. It is a library that maps MongoDB documents to Python objects and simplifies the interaction of Python and MongoDB. It is based on Pydantic and brings features and (I hope) the spirit of this great library to the database communication field. Beanie is already mature lib. It not only simplifies work with Mongo but even extends it. There are features like relations, event-based actions, cache, race condition protection, and others there. Here is the link to the project, if anyone finds it interesting https://github.com/roman-
Also, I started a new project. It has no name for now. It is really hard to come up with not occupied names for open-source projects. Many tell about lack of support, absence of unified standards, extreme level of pressure, and other problems in open source. But I vote for the naming problem. We literally run out of words! Hey, linguists, please do something with it! This is a joke, for sure. The new project. Working on Beanie I support developers, who use it. And I faced a lot of databases usage scenarios and related problems. Some of them are fundamental on the design level. And I decided to try and create a new database. It will be a NoSQL database with relations. Without network interface for now (similar to SQLite). And it will be not performance-focused (it will be good enough, thx Rust) but will be developer-oriented. The target audience is small projects, Discord, Slack or Telegram bots, small web services, prototypes. I’m coming up with the query language now – super exciting. Unimaginable level of freedom. Highly recommend to everyone.
Which Python libraries are your favorite (core or 3rd party)?
I mentioned already Pydantic. It is awesome. I truly believe that it will change the whole Python world, concepts, and approaches to how we use it. At least for me it already happened.
Another one I really like is Pathlib. I thought everything was ok with the file management in Python. Then Pathlib appeared and I found how much we suffered before. Weird emotions.
Yarl is also one of the libs I try recommending to everyone. It is like Pathlib but for URLs.
How did the Beanie project come about?
I like to come up with pet projects to play with new tech stack, libs, etc. When FastAPI just emerged, I started using it in one of the web-service prototypes. FastAPI is an async web framework. And what surprised me so much is there was literally no async ODM for MongoDB at that time. I had no choice and I implemented a small lib based on Pydantic (as FastAPI uses it for the modeling) and Motor (async engine for MongoDB). It supported native MongoDB find and aggregations syntax only. There were no indexes even (Hi Michael! @mkennedy). But it worked great for the API services prototyping. This prompted me to publish Beanie on GitHub – in case it could be helpful for others. Suddenly people came and told what else they would like to see in this package and others helped to realize it. (Yes, as in the Disney fairy tale, but about Python developers). I am very grateful to all contributors and feature requesters. Thanks to them, Beanie was grown up.
What challenges have you had creating / maintaining the Beanie package and how did you overcome them?
A really difficult part of the Beanie development for me is task prioritization. There is no lack of feature ideas. People bring a lot of them. But I have something like a general development track and limited resources. Each time it is a trade-off: implement a really important brought feature, that someone needs right now and definitely will use, but postpone the planned major release. Or add this to the TODO list and get back, when the planned feature will appear. I try getting all the use-case details to decide if this is a widespread problem or a special case and develop solutions for the popular situations first.
Another thing is documentation. When I read, for example, FastAPI documentation, I get excited. Everything is well structured and explained. What I can not say about the first version of the Beanie doc. I hadn’t revealed the secret of the documentation writing yet. Luckily sometimes people come and improve add, add details, usage examples. Now it is much better.
Is there anything else you’d like to say?
Yes. I want to say thank you, Mike. I appreciate what you do for our community.