• Stars
    star
    2,730
  • Rank 16,260 (Top 0.4 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created about 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A High-Performance, Community-Driven, and Innovator Friendly Web Framework with a Rust runtime.

Robyn Logo

Robyn

Twitter Downloads GitHub tag License Python

view - Documentation Discord

Robyn is a High-Performance, Community-Driven, and Innovator Friendly Web Framework with a Rust runtime. You can learn more by checking our community resources!

📦 Installation

You can simply use Pip for installation.

pip install robyn

Or, with conda-forge

conda install -c conda-forge robyn

🤔 Usage

🚀 Define your API

To define your API, you can add the following code in an app.py file.

from robyn import Robyn

app = Robyn(__file__)

@app.get("/")
async def h(request):
    return "Hello, world!"

app.start(port=8080)

🏃 Run your code

Simply run the app.py file you created. You will then have access to a server on the localhost:8080, that you can request from an other program. Robyn provides several options to customize your web server.

$ python3 app.py

To see the usage

usage: app.py [-h] [--processes PROCESSES] [--workers WORKERS] [--dev] [--log-level LOG_LEVEL]

Robyn, a fast async web framework with a rust runtime.

options:
  -h, --help                show this help message and exit
  --processes PROCESSES     Choose the number of processes. [Default: 1]
  --workers WORKERS         Choose the number of workers. [Default: 1]
  --dev                     Development mode. It restarts the server based on file changes.
  --log-level LOG_LEVEL     Set the log level name
  --create                  Create a new project template.
  --docs                    Open the Robyn documentation.
  --open-browser            Open the browser on successful start.

Log level can be DEBUG, INFO, WARNING, or ERROR.

When running the app using --open-browser a new browser window will open at the app location, e.g:

$ python3 app.py --open-browser

💻 Add more routes

You can add more routes to your API. Check out the routes in this file as examples.

🐍 Python Version Support

Robyn is compatible with the following Python versions:

Python >= 3.7

It is recommended to use the latest version of Python for the best performances.

Please make sure you have the correct version of Python installed before starting to use this project. You can check your Python version by running the following command in your terminal:

python --version

💡 Features

  • Under active development!
  • Written in Rust, btw xD
  • A multithreaded Runtime
  • Extensible
  • A simple API
  • Sync and Async Function Support
  • Dynamic URL Routing
  • Multi Core Scaling
  • WebSockets!
  • Middlewares
  • Hot Reloading
  • Community First and truly FOSS!

🗒️ How to contribute

🏁 Get started

Please read the code of conduct and go through CONTRIBUTING.md before contributing to Robyn. Feel free to open an issue for any clarifications or suggestions.

If you're feeling curious. You can take a look at a more detailed architecture here.

If you still need help to get started, feel free to reach out on our community discord.

⚙️ To Develop Locally

  1. Install the development dependencies (preferably inside a virtual environment): pip install -r dev-requirements.txt

  2. Install the pre-commit git hooks: pre-commit install

  3. Run maturin develop or maturin develop --cargo-extra-args="--features=io-uring" for using the experimental version of actix-web. This command will build the Robyn Rust package and install it in your virtual environment.

  4. Run python3 integration_tests/base_routes.py. This file contains several examples of routes we use for testing purposes. You can modify or add some to your likings.

You can then request the server you ran from an other terminal. Here is a GET request done using curl for example:

curl http://localhost:8080/sync/str

Special thanks

Contributors/Supporters

Thanks to all the contributors of the project. Robyn will not be what it is without all your support ❤️.

Special thanks to the PyO3 community and Andrew from PyO3-asyncio for their amazing libraries and their support for my queries. 💖

Sponsors

These sponsors help us make the magic happen!

DigitalOcean Referral Badge Appwrite Logo

Star History

Star History Chart

More Repositories

1

starfyre

A Python Framework for writing Reactive Front-End Applications
Python
269
star
2

kasper_music_player

An All In One app that would allow "music.youtube.com" to work in restricted countries. This app aims to bypass all the premium models and create FFA experience
HTML
32
star
3

macsimus

A custom editor based on NeoVim and inspired from Vim and Emacs to maximise productivity.
Vim Script
22
star
4

creative-components

This repo aims to create innovative react components used in awwwards like websites.
JavaScript
17
star
5

vim-python-virtualenv

A vim plugin which automatically manages the python virtual envs for you
Vim Script
16
star
6

xcode-Night-Owl

XCode port of the Night Owl Theme
15
star
7

nestd

A package to extract your nested functions.
Python
13
star
8

first-starfyre-app

https://first-starfyre-app.netlify.app/
10
star
9

git-add-co-author

Easily Credit Contributors in Git Commits
Python
9
star
10

leetcode-company-by-company

All leetcode company wise questions with link to Leetcode/ LintCode(if premium)
8
star
11

create-starfyre-app

Python
8
star
12

algorithm-ds

C++
8
star
13

personal_nas

A script and frontend that will convert an old machine running linux into a personal nas server
JavaScript
7
star
14

robyn-starter

A starter template for robyn repos
Python
6
star
15

cringify

A cli tool to annoy your friends on the internet
Rust
3
star
16

starfyre-rust-test

Python
3
star
17

better-cut-copy-paste.vim

This is vim plugin allows better cut copy paste.
Vim Script
3
star
18

workshop_dummy_repo

3
star
19

corona-ml-corona

https://days-till-mill.netlify.com/
Python
3
star
20

rusty-sql

Rust
3
star
21

Personal-Password-Manager

A custom password manager for the FOSS community
Python
2
star
22

ds_algo-practice

This is a repo containing all solutions to the problems that I have attempted.
C++
1
star
23

my-dotfiles

Vim Script
1
star
24

swos

Split wise but open source
1
star
25

kasper_linux

Python
1
star
26

WoodsDom

WoodsDom is a PWA designed to bridge the gap between the local citizens of the forest areas and the forest authorities to devise a more intelligent development plan for the concerned area.
HTML
1
star
27

Newgittut

1
star
28

europython-workshop

Python
1
star
29

productivity_chrome_extension

An extension that will block a list of websites to boost your productivity during crucial times.
HTML
1
star
30

ultimate-docker-nginx-conf

Dockerfile
1
star