Talk Python to Me, episode number one, with guest Nicola Ioroshi, recorded Tuesday, March 31st, 2015.
Hello and welcome to Talk Python to Me, a weekly podcast on Python,
the language, the libraries, the ecosystem, and the personalities.
This is your host, Michael Kennedy. Follow me on Twitter where I'm @mkennedy.
Keep up with the show and listen to past episodes at talkpythontome.com.
This episode, we'll be talking to Nicola Ioroshi about EVE.
Before we get to the interview with Nicola, a quick announcement.
Since recording this episode, Nicola and I teamed up to create a dedicated course about EVE.
This demo-driven journey is just the course you need to effortlessly build RESTful services based on Flask and MongoDB.
We dive deep into every aspect of the EVE REST framework.
After a quick introduction to MongoDB and Flask, we'll dig into EVE,
build our schemas and endpoints, and start serving HTTP clients right away.
And that's just the beginning.
And who better to learn EVE from than Nicola, the creator and maintainer himself.
To learn more and get started, just visit talkpython.fm/EVE or click the link in the show notes.
Let me introduce Nicola.
Nicola is a passionate Python and C# open source hacker based in Ravina, Italy.
Back in 1991, he co-founded CIR2000, a small company focusing on delivering accounting software solutions for the small businesses.
He's the creator and maintainer of a few open source projects, including EVE and a conference speaker who happens to be on sabbatical.
When he's not hacking on code or spending time with his three kids, he's usually busy running, swimming, hiking, or reading a good old paper book.
Nicola, welcome to the show.
Hi, Michael.
Thank you for having me.
Yeah, it's really great.
Thanks for helping me kick off this podcast.
So you and I have known each other for a few years, and it's really nice to get a chance to speak with you again.
I think it's been about a year since we last met on an aircraft carrier in New York City, right?
Right, that's true.
Yeah, that was a lot of fun.
Yeah, indeed.
Yeah, so let's sort of start at the beginning.
You, like myself, do Python and C#.
So how did you get into Python?
Yes, as you say, I've actually always been a C# guy, mostly.
Our flagship product is a Windows desktop application, so you usually deploy it on your user client server setup and stuff like that.
And as long as we were working in that context, we never really felt the need to look anywhere else.
C# in general was, and the Microsoft stack in general, was just doing fine for us.
Then, like anyone else, a few years ago, we started looking at moving to the web and mobile and stuff like that.
And I believe that's when I thought it was the perfect time, the perfect opportunity to move out of my, let's say, comfort zone.
My view back then, the micro stack was still a good bet for all things related to the web.
But there was so much else out there, you know?
So I started looking at the JavaScript first and then Python and other languages.
And there were so many options, I mean, and I really wanted to...
Maybe I was also a little bored about what I was doing by then.
So that was a perfect opportunity for me to start doing something else and looking around.
And Python came...
I don't really remember how...
Maybe I was just reading some tutorial online and I was immediately hooked by the language itself and the community
and the open source machine in general.
It was allowing me for incredible performance boost, for example.
I remember one of the first times I was playing around with Flask
and something just did not work as I expected.
And I was stuck there.
I couldn't make any progress.
Now, I don't really remember what it was really,
but something very stupid, most likely, you know?
That's how it is when you're learning, right?
Yeah, I was just learning a new language.
So it was truly had to be something very stupid.
And I had this moment when I realized that I could just go a stepfather and look at the source code.
That, you know, from someone coming from the .network and the closer source in general,
that's not a given.
I mean, it was really awesome to be able to go on the website, on the tab,
and check out on the source code for Flask
and understand what actually was doing behind the scenes.
And that's when really open source and the general Python and open source in general,
really, I saw what the potential was about it.
But then we were, in our world, we were, I would say, behind an arrow of car time,
something like that.
Developer tools, for example, they had to buy licenses for them.
And most of the time, even if you bought a license,
you still did not get any access to the source code.
And so it was really an epiphany for me.
Yeah, it's fantastic.
Yeah.
That's really awesome.
Yeah, I think a lot of developers spend their time in worlds where much of what you do is a black box
and you just can't know.
And I think, you know, in the Python world, we're kind of spoiled in that you can just keep looking farther down inside,
you know, and that's really great.
So you got into Python and it sounded like you were getting started in Flask.
And then I guess EVE is kind of a natural extension.
What is EVE, actually?
So EVE is an open source Python REST API framework designed for human beings,
which means that it is supposed to be easy to use and powerful.
And its goal is to allow any developer to effectively build and deploy highly customizable and fully featured web services.
Or at least that's the idea.
It is powered by Flask and it offers support for MongoDB out of the box.
And there's also a SQL Archemy extension provided by the community.
So you can use EVE both with MongoDB and Postgres or MySQL or whatever.
So, yeah, that's fantastic.
So I kind of looked at it.
I don't know all that much about EVE.
I've just played with it a little.
I saw some tutorials and checked them out.
And it looks really interesting.
I also picked up that it was inspired by the requests package.
So that's cool.
Basically, the way it works, let me try to paraphrase how your library works,
is I have some sort of data source.
And it's by default MongoDB, which is an awesome data source, by the way.
Or also SQLAlchemy, so against a lot of the relational databases.
And I can easily put like a RESTful API over my data.
Is that how it works?
Yeah, exactly.
That's the idea, basically.
You have your data source somewhere and you bind it to EVE, to any instance.
You configure it by just setting up a configuration file where you basically give your API topology,
your endpoints, how they work, to which collection on MongoDB or table on SQL each endpoint maps to.
And then you are good to go.
The idea, basically, is that you have a lot of features out of the box.
So you don't have to code much in order to get started with your API.
And then you can, of course, go in and add the callback functions, for example.
So when some RESTful API gets in, you can add your own code that makes whatever you need to do.
But the basic idea is that if you just need a front-end API for your data, you just have very little to do.
I mean, you just have to set up the configuration file and you are good to go in a few minutes.
But, yeah, it looks super easy to get started.
It looks great.
And I think it's inspired by requests in that sense as well.
So are people using more sort of JavaScript front-ends and using that to get to their data?
Or are they using this for more, like, back-end services, right?
So do you know, like, what the main consumption model is?
Yeah, well, it is being used for all kinds of use cases, actually.
We have a lot of websites consuming EVE instances, but we also have a lot of mobile clients, for example.
I, myself, am using EVE from iOS and Android applications, for example, which are being coded in C-sharp, actually.
We are using SAMRIN framework for writing our own mobile applications.
So you have all kinds of use cases, really.
And also, of course, desktop application.
And all kinds of languages are consuming the EVE instance, since you are just dealing with, you know, JSON, basically,
which goes back and forth between the client and the server.
So you can deploy it whenever you want, actually.
Yeah, that's fantastic.
So you said MongoDB is the default back-end.
Why did you choose Mongo?
Well, MongoDB has a few interesting features for me.
The first is that in the REST world, you basically are sending JSON back and forth between clients and servers.
And MongoDB also stores JSON, or actually B-zone, which is a variation of JSON, but basically it's the same stuff.
And then you have Python dictionaries, which are the perfect match for JSON as well.
So when I was researching for building my own API, it came kind of, you know, the natural choice.
I don't have to serialize and deserialize objects back and forth between the client and the REST server and the database.
So everything is smooth and easy and there isn't a lot of code in the middle doing conversions and serialization and stuff like that.
You don't have anything like that when you're working with MongoDB.
And also REST APIs are stateless by default.
So you don't usually have to, you know, you're usually sending small data packets for each request.
And that's something that makes MongoDB lack of transactions really a non-issue because you are already dealing with the concept of being stateless between your request and the client.
And in some way it has to deal with the fact that a single request can go wrong or can go fine.
And so what always is a concept for people going to use MongoDB is not really an issue in this particular use case.
It's an interesting point that, you know, MongoDB has all of these really positive features, scalability, simplicity, lightweight, all these things.
But one of its sometimes criticisms is its lack of cross-document transactions.
But if you're doing REST over HTTP, that's a stateless protocol anyway.
So you're kind of, it's like you said, a non-issue.
That's really interesting.
Yeah, yeah.
And then there is MongoDB being schemeless, which is really nice for me because when you are building a prototype in your API,
you are going to change your schema or if in API terms, your endpoint configuration, your payload, quite a lot you are adding fields.
And between API versions, you are going to add new fields, remove old fields, stuff like that.
You are doing that constantly, at least at the beginning.
And here MongoDB is very nice to use because it allows you to change your schema on the fly without having to update the database.
And so without any impact on performance as well.
So it kind of made sense for what we were doing by then, working with MongoDB on the back end and Python on the server side.
And yeah, that's what a lot of people agree with, I believe, because it has been adopted by a lot of people.
And also, as I was saying earlier, there is a SQL extension, actually, which connects EVE to SQL ArchMere.
And so you can, in fact, use your standard SQL database with EVE as well.
Right, yeah, that's really interesting.
You just have to do a little bit more work.
So, you know, when you built the framework, who was the intended user that you were thinking of?
Like, what's the most common use case?
Well, I would say that the unexpected user can benefit a great deal from EVE because, and I think about EVE is that you can,
you basically get a lot of design choices and implementation already done for you.
So you can quickly prototype an API if you need to put your mobile or front-end developers at work.
You can probably give them an API, a functioning API in a few minutes or maybe in a few hours.
And that's surely very interesting for a lot of people.
I'm having, I see there are PHP guys, for example, that are learning Python because they want to use EVE, which is kind of a surprise to me.
That's pretty amazing.
So you must be kind of proud that, you know, you're bringing people into the Python world literally so that, you know, because they want to use EVE.
Yeah, yeah, that's awesome.
When I get emails from people who are learning Python because they want to use EVE, that's totally awesome.
It means that, you know, kind of makes, tells you that your goal has been achieved somehow.
And then you're also bringing new people to the Python world, which is also awesome.
So I'm really glad for it.
Being based on Flask itself.
In fact, we also have a lot of experience with Python guys working with EVE and building extensions because, you know, EVE is just a Flask subclass.
And so whatever works with Flask, you can use with EVE.
And so you can also get access to the Flask documentation and whatever works there also with EVE as well.
So you can go on Stack Overflow or browse the Flask documentation, which is also excellent.
And you can move in the layers, between the layers, you know, EVE at the top and Flask is right behind EVE.
And then eventually MongoDB or your SQL database.
And so while it is very easy to start with, probably if you are already using Flask, you can enjoy EVE so much more because you can do whatever you want with it.
You can, for example, you can build a Flask extension and use it with EVE, which is in fact what most people are doing.
We have a few community extensions, which are basically Flask extensions themselves.
So it is good for the beginner, but it is also good for the experienced developer, I believe.
Yeah, that's really cool.
So all the great stuff that's out there for Flask, you can just use it.
And maybe even if you already have a Flask website for HTML, you know, for like browsers to consume, you could add services to it pretty easily by adding EVE into your web app, yeah?
Exactly, exactly.
That's exactly what people are doing.
And for example, there is a guy who wrote a EVE docs extension, which basically what he's doing is building the API documentation and serving them as a static HTML pages.
And what it does is reading the API configuration files and building a browsable documentation for the user.
So if you go to the, I don't know, example.com slash docs, you get the API documentation for free because it's being done as a Flask extension by this EVE docs extension.
So you can mix and match HTML pages with REST APIs.
That's cool.
So what this guy's project does is basically it's like a self-documenting API or self-documentation for the API just depending on how you configure EVE, yeah?
Yeah, yeah, yeah.
I get a lot of questions about this actually even on Stack Overflow.
So how can I serve static pages along with my API endpoints?
And that's actually very easy to do.
You just have to add a route to Flask as you would do with the Plex itself.
So it's very, very easy to pull off.
Very nice.
So it sounds like, you know, this is a very popular project.
And I looked on GitHub and it's got, you know, like 2,000 stars and 300 or so forks.
That's a lot of people contributing.
And this is not your full-time job, right?
This is like a second project.
So how much work is it and challenges it to balance making your awesome open source project successful and actually keeping the day job running?
Yes, it's actually becoming quite a challenge because, you know, EVE is becoming a huge work.
There are a lot of use cases and people want to do like all kinds of stuff with EVE, which is super cool.
The community is awesome.
We have about 70 contributors to the project at this moment in time.
And they contributed with a lot of very cool features.
On the other hand, you end up doing a lot of work for free.
You know, it's kind of, I mean, for what we need EVE for, we'd be happy with what EVE was maybe one year ago.
And now all the additions to the project are basically coming from the community.
And they are either or adding new features themselves or asking for new features.
And when something new and interesting is proposed, I usually end up coding it for the community and for myself, of course, as well.
But that takes a lot of time.
So, yeah, it's kind of a challenge because you have to balance your work life with your family and hobbies and open source activity.
It's not that easy, but you also get a lot of, you know, gratification for doing this.
I get emails from all around the world from people using EVE in so many strange, odd and amazing use cases.
And so, yeah, it's hard to do, to pull it up, but it is also very well worth it for me.
Yeah, I'm sure it's very rewarding.
That's great.
Are there other contributors to it, people who actually are putting a lot of effort into it?
Are you looking for new contributors or what's the status there?
Yes, we have, as I was saying, we have about 70 contributors of these.
Maybe 10 of them are very active and have been contributing to the project quite a lot lately.
Some are very skilled with both Flask and EVE itself.
So, I still have to do a lot of work or most of the work.
But, yes, I would really appreciate if more people would join the community and help with, even with simple things like, you know, updating the documentation, fixes titles.
As you can say, I'm not an English speaker.
So, it is very easy to find incorrect mistakes in the documentation, for example, or in DocStrengths, in the source code, stuff like that.
But, also, we have people who are adding amazing features.
Like, we had, I think, in 0.5, we had versioning feature added to EVE.
So, you can store multiple versions of your documents and your API.
And then, you can get back the version that you need with simple request.
And that's a very cool feature, which was entirely contributed by the community from one guy, actually.
And that's very cool.
And so, we had a lot of other additions like that from the community.
And so, yes, there is a lot of room for improvement.
And I really would love to see more people jump in and help us with going further.
That's great.
Yeah.
I think people have a hard time realizing how much work it is to actually get something like EVE out the door and ready for the community.
I mean, there's obviously the writing of the application or the library and then maybe a sample.
But there's the GitHub repository, the website, the documentation, all the little stuff, the little polish that you have to put on there.
It seems like, you know, when you feel like you're done, you're halfway there and you still have a ton of little things that are somewhat uninteresting but have to be there, like documentation.
Yeah.
Absolutely.
How's the experience being both a C# and Python and JavaScript developer?
How do you see the world being this polygot, living in this polygot programming world?
It's been a wild ride, actually, because, you know, the languages are so different in so many ways.
Python is a dynamic language, whereas C# is a strongly tighter language.
And now I'm playing with Go and Netsharp on approaches to solving the same problem, basically.
And that's really interesting for me because you don't always have one tool, one language, which is perfect for all kind of problems.
So it's great to actually be able to pick the right tool for the right job.
And basically what I have now is Python on the web side of things.
So my servers and websites are Python, while all my mobile applications and desktop applications are C#, for example.
And I mean, it helps a lot because you get a very different skill set.
And you can just you often find the same problem.
You can solve it.
The different languages actually have been solving it in a different manner, in different with different methods.
Sorry.
And that's really awesome.
It helps you understand and experiment with different things.
Even if you I go back to C#, I often find that I'm using techniques, which I learned while I was studying Python, for example.
And the contrary is also true.
For example, when I was looking at classes in Python, it was very easy to pick them up because, of course, I've been coding classes in C# for like, I don't know, 15, 20 years.
And so it was very, very easy.
And this is a very trivial example, but you get what I mean.
Yeah, absolutely.
And I, you know, I've lived that life as well.
I think one interesting aspect that's different is the languages are actually not super different, right?
Python is obviously dynamic and C# is static.
But in a lot of ways, like you said, with the classes and so on, they're similar.
Where they start to get different is around the tooling and around the packages and the frameworks that you can use.
Yeah.
What tools do you use for working with Python?
Do you have like an editor that you're fond of or anything like that?
Yes.
Oh, that's a good question, actually.
You know, I'm using Veeam for coding in Python.
And that's also something I never used until as long as I was working with C#.
So back in, I think, maybe 2010 or something like that, I started working with Python.
And I also picked Veeam.
And I was a Visual Studio guy.
And I've been a Visual Studio guy for a lot of time.
And so coming to Python, it also meant learning a lot of new tools.
I started using Veeam for a lot of new tools.
And I started using Veeam for installing packages and learning how Python packaging works, which is totally different from C#.
That's another very interesting aspect of using different languages.
And now what you have is that C# and .NET are, you know, in this new Microsoft era.
We are getting to the point where even Microsoft is learning from the open source experience.
And so we have, for me, it is really exciting looking at how Microsoft is approaching and evolving these last maybe couple of years.
Releasing .NET framework as open source, for example, is totally awesome.
And going cross-platform as well.
And this is all stuff that I've been seeing working on Python.
And I was always wondering, "Ah, I really would love to see this kind of approach in Microsoft Word and Windows and C#."
And now it's happening and it's really exciting.
And it also means that Microsoft is learning from, you know, let's call them mistakes maybe.
And, yeah, it's really cool.
And I'm super excited because I see the open source potential coming to the C# world.
On the other hand, I must say that the open source community in C# and in the .NET framework in general is still very, very, very in these early stages, so to speak.
So when I release an open source tool in C#, I get a fraction of the attention that the same tool will get in Python, for example.
So there is still a lot of room for improvement.
Yeah, I totally agree.
It's definitely a good sign that some of these closed source companies, especially Microsoft, since they're so widely used, is moving.
I think they're learning a lot from open source and from Python.
So it sounds like there's a lot of interesting pieces that you're bringing into EVE, like Cerebus and Flask Sentinel and things like that.
Those are separate projects, separate packages that you're just using in EVE, right?
Yeah, I'm using a lot of packages.
I am also using Redis, for example, for some features.
We have a rate limiting, which is a feature which is being bundled within EVE and it uses Redis, actually.
By the way, Redis is also by an Italian developer, so Dr. Sanfilippo, which is a friend of mine.
And yes, I'm using Cerebus, which is another open source release of mine.
It's used for data validation, basically.
And Cerebus, actually, it is being used even outside of EVE from forum by a lot of people, since it allows, basically, to do validation for Python data.
So we use it within EVE for data validation.
So that's really interesting.
I haven't used Cerebus, but basically what you can do is you can say what required fields and what required shape a Python dictionary should have.
And then you can say, validate this particular dictionary.
What kind of stuff can you validate there?
Yes, you can basically say, hey, this is, you know, the name field is a string.
It must be, must have a maximum length of 10 and, or you can, you must use this regular expression to validate it.
And this is, there are a lot of options.
Actually, you can say that a field must be unique or stuff like that.
And this is true for,
the EVE by load, of course, but also for any Python dictionary.
So people are using it everywhere.
And this is very nice.
And another tool that I ended up building for EVE, but it is also being used outside of EVE, is events,
which is basically a package which allows you to bind the callback functions to any kind of event.
And so when EVE receives an incoming request,
you can have a number of callback functions, which are being called by EVE.
And so you can do your own stuff with this payload, which is coming in and change it or store it elsewhere, or call another API and validate it against it, stuff like that.
And this is all powered by events, which is another package that you can use for your own tools for building your own tools.
So that's fantastic.
That sounds great.
So another one that I saw in there was Flask Sentinel.
What is that?
Flask Sentinel is basically an implementation of OAuth for Flask.
In particular, it is addressing the token authentication scheme.
So you can, of course, you can use it without EVE as well, or you can use it with EVE to have OAuth 2 on your API.
So yes, you can basically look it up on GitHub.
It is being used for a lot of things.
That's cool.
So if I want to have like Twitter authentication or Google or Facebook or something like that, is that kind of what you're thinking?
Almost.
I mean, right now it only addresses token authentication, basic token authentication.
So it's not really suited for that use case.
It is not yet a full OAuth 2 authentication scheme, but it is the best use case, I think, is when you use it for your own mobile application
application and you want your user to be authenticated with your REST API framework and you give him a token and then your mobile application uses this token instead of using the username and password and sending them over the wire, of course.
And so, yes, it's, you know, kind of just one of the many users of OAuth 2.
Sorry about that.
OAuth 2 for me is very easy, very difficult to pronounce that word.
And, yeah.
Okay, that's great.
Yeah, so I can see how you use that.
That's very interesting.
Now, I noticed you're also working on a project called Eve.net.
Is that like a .NET spinoff of this whole idea?
It's basically a REST client for .NET.
So, what you use it for is, for example, if you are writing a mobile application for iOS or Android and want to connect to an Eve instance, you can use Eve.net.
It deals with, since it knows very well how Eve performs, you can send, for example, a class or an object instance to Eve and it deals with serializing the object and sending it to Eve.
And it handles the responses.
And, for example, if you want to modify an object, the user just says to Eve.net, "Hey, store this update up to the server."
And the client connects to Eve, sends the update and if something goes wrong, it reports back to the client.
And since it knows very well how Eve performs, it can, you know, it hides a lot of the implementation behind the scenes.
So, you don't have to worry about E tags and conflicts and errors, validation and stuff like that.
And this is interesting because it is exactly the Polyglot approach, which we were speaking about earlier, a little bit earlier.
So, you have C# and C# client working with a Python server.
And so, it's kind of, you know, kind of fun.
Yeah, because you know both sides of that story, you can make it really easy for the C# guys.
I wonder if there's other languages out there like Swift or Java or something that might also benefit from that.
Yes, yes.
You can use it.
You can use it everywhere you use .NET.
So, it's very nice.
And actually, one of my, one of the things that I'm doing with the .NET framework, at least here in Italy, is encourage people to go out on the reconfort zone.
For example, installing Eve instead of, I don't know, embassy framework or stuff like that on the server side.
And because they also get the advantages of Eve.
Eve is totally language agnostic.
So, you can use it with whatever language you want.
Yeah, that's beautiful.
It uses the universal language of JSON.
Excellent.
So...
Right.
Yeah.
So, are there any notable uses or really popular deployments of Eve that you could talk about?
Yeah.
There is, there are two or three which I think can be interesting for your audience.
For example, we have Dailymotion, which is, I don't know if you know about it, but they are, I believe, the second streaming website in the world right below, right after YouTube.
It's a French company, which is streaming live content on the web.
And they're using Eve for some of their projects.
Actually, they are also contributing to it itself.
So, they are one of the main contributors to the project itself, which is totally cool for me.
And then there is a RedTartle, which is a company.
They are the guys behind the SQL extension, for example, speaking of the community.
As you can see, we have people who are using the tool itself and then contributing with new features.
And this is one special case because RedTartle basically took the SQL extension, which was already being developed by other guys.
And, you know, kind of completed it and they are now 100%, I believe, I suspect, I think as well, they are 100% feature complete.
And so, yeah, RedTartle.
And then we have these very famous space agency, but I didn't get any feedback from them.
I wanted to mention them, but I'm not sure I can.
Let's just say that it is a very famous space company led by a very, very well-known entrepreneur who also works on a car industry and stuff like that.
That's really fantastic.
So, Eve might be going to space and back.
That is really cool.
Yeah, that's my dream, actually.
It would be totally cool.
I think they are still experimenting with it.
They are contributors as well.
One of their engineers is the guy who worked on a version in Feetor, for example.
Yeah, they are using it internally.
I'm not sure if they are using it to send stuff in the space.
I'm not sure I want them to use it for sending stuff in the space.
It's a whole other level of responsibility.
Yes, it is.
But, yeah, it is being used by all kinds of people.
And that's what I find really interesting for me.
It's really exciting.
So many people with so many different use cases who rely on your tool is, you know, so, I don't know, totally awesome.
Yeah, that's really great.
I'm sure it's super rewarding.
And, you know, thanks from everybody in the community for putting that together.
That's cool.
So, I think that's probably a good place to wrap up the show.
So, is there anything you want to mention or give a shout out to, you know, give a little promotion to before we call it a day?
Not really.
What I really would like to see is people join the community.
And, as I said already, try the tool.
And if they have, you know, questions or contributions to add, be very happy to learn about them and see more people adopt the tool.
And the other, the satellite tool like Flash Sentinel or Cerberus and, you know, just keep sending feedback.
And so, we can keep growing with the tool and the community itself.
Yeah, that's really great.
Okay, so, you can find Eve on the web at python-eve.org.
Nicola, thank you so much for your time.
It's been a really interesting conversation.
Thank you.
It's been great.
And thank you for inviting me.
It's been awesome.
You're welcome.
Hopefully, we get to catch up on an aircraft carrier in New York City sometime soon.
Okay.
Talk to you soon.
Looking forward to that.
Indeed.
Okay.
See you later.
Thank you.
Bye.
Developers, developers, developers, developers.