Fork me on GitHub
Read the Docs

Latest:

Falcon is a very fast, very minimal Python web framework for building microservices, app backends, and higher-level frameworks. It is used by a growing number of organizations around the world, including Cronitor, EMC, Hurricane Electric, OpenStack, Opera Software, Wargaming, and Rackspace.

The Falcon web framework encourages the REST architectural style, meaning (among other things) that you think in terms of resources and state transitions, which map to HTTP methods.

A number of Falcon add-ons, templates, and complimentary packages are available for use in your projects. We've listed several of these on the Falcon wiki as a starting point, but you may also wish to search PyPI for additional resources.

Falcon can be deployed in a variety of ways, depending on your needs. The framework speaks WSGI, and works great with CPython 2.6, 2.7, and 3.3+. PyPy and Jython are also supported out of the box.

You can find more information in the GitHub repo or in the official documentation.

Falcon is an Apache-licensed community project, built and maintained by a group of stylish volunteers from around the world. Extra special thanks to Rackspace for sponsoring a large portion of the work that has gone into Falcon!

It's easy to get started with the Falcon web framework.

$ pip install falcon

Instances of falcon.API are WSGI applications and can run on any WSGI server, such as Gunicorn:

$ gunicorn sample:api

Design

Falcon is a *truly* fast, light Python WSGI framework.
Perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away.
- Antoine de Saint-Exupéry

Light. Falcon follows the minimalist philosophy. Only the essentials are included, with six and mimeparse the only dependencies beyond the standard library. We work to keep the code lean, making Falcon easier to test, optimize, and deploy.

Fast. Cloud APIs need to turn around requests quickly, and make efficient use of hardware. Falcon processes requests several times faster than other popular web frameworks.

Explicit. Falcon eschews magic. The last thing you want is your framework doing sneaky things behind your back. It's obvious which inputs lead to which outputs, and where variables originate. All this makes it easier to extend the framework, reason about the code, and debug edge cases in large-scale deployments of your application.


Benefits

Performance. Unlike other Python web frameworks, Falcon won't bottleneck your API's performance under highly concurrent workloads. Many frameworks max out at serving simple "hello world" requests at a few thousand req/sec, while Falcon can easily serve many more on the same hardware.

Freedom. Falcon isn't very opinionated. In other words, the framework leaves a lot of decisions and implementation details to you, the API developer. This gives you a lot of freedom to customize and tune your implementation in order to create a solution that stands out from the crowd. Due to Falcon's minimalist design, Python community members are free to independently innovate on Falcon add-ons and complimentary packages. You can take advantage of these projects, as well as extend the framework yourself in a variety of ways to create a best-fit solution for your web application.

Reliability. Falcon doesn't include a lot of cruft that is simply unnecessary when building web services. Less code and fewer dependencies means a smaller attack surface, lower memory usage, and fewer places for bugs to hide. Our build fails at anything less than 100% code coverage. We use Travis and Codecov to keep ourselves honest.


Benchmarks

Scenario. The benchmark acts as a WSGI server and performs a GET request directly on each framework's app. Each app parses a route template with a single embedded parameter, reads a query parameter and a header from the request data, sets an x-header on the response, and finally returns a 10 KiB plain-text body, randomly generated.

Method. 20,000 iterations were executed per trial, and the best time was recorded for each framework over 20 trials. The order in which the frameworks were tested was randomized for each trial. Also, garbage collection was enabled as it would be in a production environment, and a full collection was forcefully triggered before each trial. Finally, results were calculated using the Decimal class, and rounded to the nearest whole number.

Platform. Benchmarks were executed on a DigitalOcean 1GB VM, running Ubuntu 16.04.2 with all system packages updated to their latest versions as of May 2017. The frameworks were tested on several different versions of Python. Note that in these tests the Falcon modules were not cythonized; generally speaking, the reader may expect a ~10% boost in performance when Falcon is installed with Cython.

CPython 2.7.13

Frameworkreq/secμs/reqPerformance
Falcon (1.2.0)37,27726.8310x
Bottle (0.12.13)19,63350.945x
Werkzeug (0.12.1)7,088141.082x
Flask (0.12.2)3,986250.861x
Pecan (1.2.1)3,659273.331x

CPython 3.6.1

Frameworkreq/secμs/reqPerformance
Falcon (1.2.0)30,47932.8128x
Bottle (0.12.13)16,36661.1015x
Werkzeug (0.12.1)7,575132.027x
Flask (0.12.2)4,262234.644x
Pecan (1.2.1)1,082924.481x

PyPy2 5.7.1

Frameworkreq/secμs/reqPerformance
Falcon (1.2.0)345,7282.8934x
Bottle (0.12.13)234,3044.2723x
Werkzeug (0.12.1)65,31315.316x
Flask (0.12.2)15,08866.281x
Pecan (1.2.1)10,22797.781x

PyPy3 5.7.1-beta0

Frameworkreq/secμs/reqPerformance
Falcon (1.2.0)113,6668.80126x
Bottle (0.12.13)87,19711.4797x
Werkzeug (0.12.1)15,09566.2517x
Flask (0.12.2)12,72378.6014x
Pecan (1.2.1)9011109.671x

 

Extended Test. Falcon was also benchmarked under CPython 2.7.13 with a more realistic scenario, in which the routing table had multiple entries, the query string contained percent-encoded characters, and several complex response headers were set in the response. Note that even when Falcon is doing more work, it still is able to outperform other frameworks, such as Bottle, which are only doing the bare minimum to construct a response.

FrameworkTestreq/secμs/reqPerformance
Falcon (1.2.0)Extended23,50042.556x
Bottle (0.12.13)Simple19,63350.945x
Flask (0.12.2)Simple3,986250.861x