Console 56

FastAPI, TiddlyWiki, and unfork

Sponsorships

Getro: The best way to give and get introductions

Getro is a B2B SaaS platform that helps independent professional networks — including venture capital funds, accelerators, membership communities, associations, governments, and universities make better introductions for their members, measure the outcomes of their intros, and in some cases, make money doing it! 

Getro is looking for a Lead Backend Engineer, Full Stack Engineers, and a Product Manager to join their team. 

👩‍💻 Remote first company - we’re all remote, since before COVID: high level of flexibility, high level of ownership

❤️ Culture is extremely important - we're driven by our values of compassionate candor, curiosity, committed ownership, inclusivity, openness, and gratitude

🌱 Seed stage company with $1.7M ARR, 17 employees across 7 countries. We are a good fit if you want to influence the direction of the product / company in a very direct way

⏰ Working day is based on EST-CET timezone

🗣️ Working language is English


FastAPI

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

language: Python, stars: 31774, watchers: 505, forks: 2224, issues: 891

last commit: May 26, 2021, first commit: December 05, 2018

https://twitter.com/tiangolo

TiddlyWiki5

TiddlyWiki is a non-linear personal web notebook that anyone can use and keep forever, independently of any corporation.

language: JavaScript, stars: 6029, watchers: 250, forks: 984, issues: 1006

last commit: June 04, 2021, first commit: November 22, 2011

https://twitter.com/Jermolene

unfork

unfork(2) is the inverse of fork(2). sort of.

language: C++, stars: 1290, watchers: 22, forks: 35, issues: 0

last commit: May 31, 2021, first commit: October 29, 2019

https://twitter.com/whitequark


An Interview With Sebastián Ramírez of FastAPI

Hey Sebastian! Thanks for joining us! Let’s start with your background. Where have you worked in the past, where are you from, how did you learn how to program, what languages or frameworks do you like, etc?

I'm from Colombia. 🇨🇴 I was homeschooled all my life, so I don't have any official degree. I started with sloppy HTML, CSS, and some JavaScript when I was around 15. I kept studying online, reading documentation sites and standards. At some point I took many online courses. That's how I got into Python.

I started working in a startup in Colombia, from there I ended up in the Middle East, and then I joined a spin-off company there in Dubai. After that I moved to Berlin, Germany, to join Explosion, and I worked there until very recently. Now, I quit to dedicate a high percentage of my time to FastAPI, Typer, and my other open source projects while doing some consulting.

I like modern Python for most of the things and TypeScript for some others. I'm a fan of Docker and containers. I've had the chance to try and use many databases and similar tools, and I like to understand how they work and what to use for each use case.

Any favorite databases in particular?

I like them for different things. PostgreSQL for simple systems that benefit from relations. SQLite for small local things. MongoDB has great docs and a nice query language for documents. ElasticSearch has very good performance and features for text and analytics. Redis works great for simple things that fit in memory and/or require raw performance, for example, job queues. And so on with a bunch of others with different use cases... 😅

What was it like quitting a stable job to work on open-source full-time?  How did you know it was the right decision at the time?

I had no idea if it would work or not, but I realized I was not having enough time for all the work needed in open-source, and I would have to change my work structure to be able to handle that.

At the same time, there have been several organizations interested in FastAPI and me in different ways, which gave me a hint that maybe I could make it work. And if it didn't work, in the worst case where I couldn't put as much time into open-source as I want to, I could accept a job offer.

I also have a huge advantage in that my wife has a stable job, and we don't have children.

So in general, the risk was not really that bad.

Who or what are your biggest influences as a developer?

A lot of people and things, I'm sure I'm gonna miss many so I'll just mention a couple that come to mind quickly:

  • Andrew Ng, who "taught" me Machine Learning on the first versions of Coursera and encouraged me to build things to help others

  • Tom Christie, taught me by example how to handle a big and healthy open source community, and to go ahead and solve and build what is needed

What's an opinion you have that most people don't agree with?

Some people agree with this, but governments (issuing visas) and big corporations still don't seem to agree that much.

I think that years of work experience or university degrees are not what define skill set levels.

What’s your most controversial programming opinion?

Not necessarily controversial, but I feel very strongly in favor of a list of features in programming languages, libraries, and tools:

  • Autocompletion

  • Type checks, the squiggly red lines

  • Simplicity

  • Deduplication, the less times writing the same thing in several places, the better, hopefully only once

...and a couple of others.

But in some cases, some people, tools, and technologies have other priorities on top and are okay with sacrificing these for theirs. But it's not really that controversial.

What is one app on your phone that you can’t live without that you think others should know about?

KeePassXC, an open-source password manager for desktop, and KeePass2Android, the mobile version.

If you could dictate that everyone in the world should read one book, what would it be?

It's not necessarily a book, but I would encourage everyone to learn at least the basics of computers and programming.

If you could teach every 12 year old in the world one thing, what would it be and why?

To study on their own. To be curious and follow the path of whatever seems would solve the problems they care about and that would help their communities and society. I think that could help a lot with the world's problems, and it worked more or less for me. And that depends a lot less on where you are born, who your parents are, how much money they (or you) have, where (and if) did you go to University, etc.

If I gave you $10 million to invest in one thing right now, where would you put it?

Into building ways to teach programming and technology to kids around the world, for free or with very low cost. Encouraging them to solve their local problems, help their communities, and society. I'm not sure about the "business model", but I think that could work in some way.

Are you familiar with freeCodeCamp?  Any opinion on them?

I think it's great, but I haven't taken courses there myself (yet), I wish it existed when I was starting. That and other platforms like Khan Academy solve a big part of the problem. The missing piece is probably making these platforms more mainstream. Maybe figuring out ways to make the whole path until people build a real-life product simpler.

What are you currently learning?

Many things!

Recently, several internal parts of how Python works underneath around the type annotations.

Anything in particular?

Particularly PEP 563: https://www.python.org/dev/peps/pep-0563/

What it implies, and how it would have affected some tools if it hadn't been rolled back.

All the context is not really explained anywhere yet, I should probably write a blog post about it.

There's some more information here: https://github.com/samuelcolvin/pydantic/issues/2678 and in a couple of discussions in the Python mailing lists.

I made a simple short summary of what would have been affected here: https://twitter.com/tiangolo/status/1384512019756376064

In short, everything turned out well, even though it involved some painful extra effort from the Python Steering Council.

But coming back to the question, I ended up learning a lot about how Python internally treats these type annotations that I love and use so much. 🤓

What resources do you use to stay up to date on software engineering?

I follow some people on Twitter, and I'm subscribed to several newsletters about technology, Python, and others.

What have you been listening to lately?

A weird combination of music, metal and rock on one side, and electronic music on the other, dubstep, liquid drum and bass, etc.

How do you separate good project ideas from bad ones?

I avoid building new things and new projects a lot. I avoided building FastAPI, Typer, and other tools for quite a while.

First I try to (almost) exhaustively search for a tool that already does what I want, and that solves the problem I care about.

When I don't find something, and no one builds it, I end up building it.

I also try to avoid creating packages that abstract too much, when it would have been equivalently easy to implement directly. As then developers would have to learn the new package instead of learning how things actually work underneath.

Why was FastAPI started?

To solve several problems, or features I wanted to have that benefited my work and the work of the developers I was leading.

It was the best combination I could come up, from a lot of ideas from previous frameworks and tools.

There's a lot more details in the docs about Alternatives, Inspiration and Comparisons: https://fastapi.tiangolo.com/alternatives/

Who, or what was the biggest inspiration for FastAPI?

Several tools inspired several features, I think I couldn't attribute it to a single inspiration.

But if there's one single thing, it would be modern type annotations (also called type hints) in Python. That's what allows autocompletion and type checks in editors. And FastAPI uses them for everything, to do data validation, serialization, documentation, etc. It's all built around these type annotations.

Are there any overarching goals of FastAPI that drive design or implementation?

On the specifics of the design itself, I think that list above of the features I care about are very important.

And on the philosophical side, one of my main personal objectives is to help others be more efficient, build things, and solve problems they care about and that help their communities and society.

If so, what trade-offs have been made in FastAPI  as a consequence of these goals?

I have traded a lot of extra effort on the maintenance side (more of my effort) in exchange for better developer experience. For example, I avoid using **kwargs as much as possible, so people can get autocompletion and type checks, and be more efficient, instead of having to go to the docs all the time.

What is the most challenging problem that’s been solved in FastAPI, so far?

Pydantic itself exchanges ease of use for final developers with internal complexity. So, it's very easy to use, but its internals are more difficult to understand. Adding features to it and learning how it worked, and how to re-use its internals for FastAPI was particularly challenging.

The other thing is the dependency injection system in FastAPI, supporting dependencies with yield. It's designed to be very easy to use for developers, but the internals to achieve that, while supporting async and normal def functions combined in arbitrary "trees" of dependencies was a bit mind-bending when building it. Fortunately the results were great and it was totally worth it.

Do you have any links to code involving the support for yield?

Here are the docs for the dependencies with yield: https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield/

The technical details (unnecessary for almost everyone) are that it detects if a function is normal or async and then makes it a context manager or an async context manager. Then it uses an AsyncExitStack from the standard library to evaluate those dependencies and run their teardown after sending a response, and after handling any necessary background tasks.

Are there any competitors or projects similar to FastAPI? If so, what were they lacking that made you consider building something new?

I prefer to call them inspirations, because I took ideas from most of them and combined them together. There's a lot more details on Alternatives, Inspiration and Comparisons: https://fastapi.tiangolo.com/alternatives/

What was the most surprising thing you learned while working on FastAPI?

That it wasn't crazy, my ideas were indeed useful, and it was worth building it. I didn't expect that.

What is your typical approach to debugging issues filed in the FastAPI repo?

Most of the issues are questions. Or bugs in the developer's code. Very few are actual issues in FastAPI.

But that takes a lot of time and effort. Fortunately, the awesome FastAPI Experts help a lot with that: https://fastapi.tiangolo.com/fastapi-people/#most-active-users-last-month

What is the release process like for FastAPI?

I tend to release often, when there are new features or changes. I prefer to release several times a day if the features or changes are sufficiently large. That way, if for some reason, in a strange case the last changes broke something for a particular use case (which is not common, but could happen), people could still benefit from the other recent features, fixes, etc.

Is FastAPI intended to eventually be monetized if it isn’t monetized already?

I want to keep FastAPI fully open source and free, with the best documentation and features possible, and helping as many people as I can.

I recently quit my job to dedicate a high percentage of my time to FastAPI, Typer, and the other open source projects, as I wasn't having enough time for them.

I'm currently structuring things to make it sustainable.

For now I'm not building a company, but I'll do some limited consulting for some teams, while dedicating a big chunk of my time to open source.

What is your main source of revenue?

For now it will be these consultancy projects and sponsors. At some point, I would like to figure out a product or service that would be useful for corporates and companies with budget or investments, complementing FastAPI. While keeping FastAPI itself fully free and open source, as that's my main objective.

How do you balance your work on open-source with your day job and other responsibilities?

Up until recently, I quit my job, but for the past 9 months or so, it was mainly my free time and weekends, so that wasn't sustainable.

But now that my focus is on these open source projects it will be easier to handle. And for example, the arrangement with one of the main organizations I'm now working with (I'll announce it soon) involves a high percentage of my working time dedicated to open source.

Do you think any of your projects do more harm than good?

I hope not. My objective is to help people help others.

What is the best way for a new developer to contribute to FastAPI?

It's actually to help others with their issues, which makes them official FastAPI Experts. But there are many other ways to help too: https://fastapi.tiangolo.com/help-fastapi/

If you plan to continue developing FastAPI, where do you see the project heading next?

I have lots of plans for FastAPI, Typer, and others. And even for new projects that will complement them. There's a long list of things I want to work on.

What motivates you to continue contributing to FastAPI?

When I see that I'm helping people build high quality products faster, more efficiently, and solve problems, that motivates me a lot. Especially when I see small teams, solo developers, or teams in developing countries like mine building things quickly and provide value to their communities, that's very exciting for me.

Where do you see software development in-general heading next?

I'm not very good at predicting things except from what I could make happen. So I can imagine software development getting more and more convenient and enjoyable, with more and more people being able to use it to solve all types of problems.

Where do you see open-source heading next?

I think open source is in a strange position in that it results in very high quality products, it's used and depended on a lot, and provides a lot of value. But it's generally not very sustainable. It's not easy to find wealthy open source projects.

That's something we have to work on with companies. Everyone would win, companies would save many expensive developer hours implementing workarounds for open source projects if the original project already supported those features or had those bugs fixed. It would be much faster and efficient to have the maintainer do that than internal developer employees work around that.

I think there's a disconnect between the person that controls and approves the budget in organizations and the open source maintainers. There's something we are failing to understand what to offer that would make it simpler for them.

Maybe it's a support license, meaning that the project will keep maintained just as it is, but with paid certainty for the company.

That is an interesting insight.  I would say there is even a disconnect between the person that controls the budget and developers using the code, not just the maintainers.  Most developers understand how valuable the code is that they're using, but the CFO for example, might not if they’re not technical.

Exactly, I think developers are not against sponsoring open-source in some way, in most cases, they are the ones that make it happen. But only a few realize they could do that. And the CFO probably has a hard time understanding how is it that something that is already "working" and already "free" would need to be maintained and/or paid for in some way.

I guess software looks like a static thing that can be bought and used, like a car or a laptop, but it tends to be an ongoing evolving thing, that has new errors, has to solve errors generated by dependencies, has new features, can have better docs, etc. And that, and the fact that this evolving nature is beneficial for the companies and products, is probably not obvious or intuitive for people in charge of budgets.

That's probably what we, developers, have to help shape by talking to them and making it easier to understand. Or by talking to maintainers and helping them present their request for resources in a way that is acceptable for managers.

Do you have any suggestions for someone trying to make their first contribution to an open-source project?

Start learning a project you like, read the docs. You will find typos, it's almost certain. That's the first and easiest contribution to make. I wrote a bit about it here: https://dev.to/tiangolo/how-to-start-contributing-to-open-source-1jmg


Not subscribed to Console? Subscribe now to get a list of new open-source projects curated by an Amazon engineer in your email every week.

Already subscribed? Refer 10 friends to Console and we’ll donate $100 to an open-source project of your choice!

Loading more posts…