Giter Club home page Giter Club logo

robyn's Introduction

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.8

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: poetry install --with dev --with test

  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 poetry run test_server. This will run a server containing several examples of routes we use for testing purposes. You can see them at integration_tests/base_routes.py. 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

robyn's People

Contributors

sansyrox avatar antoinerr avatar pre-commit-ci[bot] avatar jackthomson2 avatar idokendo avatar kludex avatar carlosm27 avatar urjitbhatia avatar mirecl avatar cclauss avatar oluwaseun241 avatar shending-help avatar suhailmalik07 avatar shivaylamba avatar mr-sunglasses avatar noborita9 avatar yednapg avatar guilefoylegaurav avatar hougesen avatar mikaeelghr avatar orvil1026 avatar parths007 avatar patrick91 avatar rachfop avatar markaeus avatar polokghosh53 avatar ruslan-korneev avatar sanchithhegde avatar r3b-fish avatar tkanhe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.