diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 713ccca50..897abc814 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -109,7 +109,7 @@ Let's walk through the steps to create an issue: **4.** Select one of the Issue Templates to get started.


-**4.** Fill in the appropriate `Title` and `Issue description` and click on `Submit new issue`. +**5.** Fill in the appropriate `Title` and `Issue description` and click on `Submit new issue`.


### Tutorials that may help you: diff --git a/Cargo.toml b/Cargo.toml index 807cbc1ed..370fa3208 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" description = "A web server that is fast!" license = "BSD License (BSD)" homepage = "https://github.com/sansyrox/robyn" -readme = "README.md" +readme = "docs/README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/README.md b/README.md deleted file mode 100644 index 119343915..000000000 --- a/README.md +++ /dev/null @@ -1,136 +0,0 @@ -Robyn Logo - -# Robyn - -[![Twitter](https://badgen.net/badge/icon/twitter?icon=twitter&label)](https://twitter.com/robyn_oss) -[![Gitter](https://badges.gitter.im/robyn_/community.svg)](https://gitter.im/robyn_/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -[![Downloads](https://static.pepy.tech/personalized-badge/robyn?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/robyn) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -[![GitHub tag](https://img.shields.io/github/tag/sansyrox/robyn?include_prereleases=&sort=semver&color=black)](https://github.com/sansyrox/robyn/releases/) -[![License](https://img.shields.io/badge/License-BSD_2.0-black)](#license) -![Python](https://img.shields.io/badge/Support-Version%20%E2%89%A5%203.7-brightgreen) -[![Discord](https://img.shields.io/discord/999782964143603713?label=discord&logo=discord&logoColor=white&style=for-the-badge&color=blue)](https://discord.gg/rkERZ5eNU8) - -[![view - Documentation](https://img.shields.io/badge/view-Documentation-blue?style=for-the-badge)](https://sansyrox.github.io/robyn/#/) - -Robyn is a fast async Python web server with a runtime written in Rust. - -Check out the talk at **PyCon Sweden 2021** about [Robyn: An async python web framework with a Rust runtime](https://www.youtube.com/watch?v=DK9teAs72Do) - -## 📦 Installation - -You can simply use Pip for installation. - -``` -pip install robyn -``` - -Or, with [conda-forge](https://conda-forge.org/) - -``` -conda install -c conda-forge robyn -``` - -## 🤔 Usage - -```python -from robyn import Robyn - -app = Robyn(__file__) - -@app.get("/") -async def h(request): - return "Hello, world!" - -app.start(port=8080) - -``` - -## 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 performance -and compatibility - -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! - -## 🗒️ Contributor Guidelines - -Feel free to open an issue for any clarification or for any suggestions. - -If you're feeling curious. You can take a look at a more detailed architecture [here](https://github.com/sansyrox/robyn/blob/main/docs/architecture.md). - -## ⚙️ To Develop Locally - -1. Install the development dependencies: `pip install -r dev-requirements.txt` - -1. Install the pre-commit git hooks: `pre-commit install` - -1. Add more routes in the `integration_tests/base_routes.py` file (if you like). - -1. Run `maturin develop` or `maturin develop --cargo-extra-args="--features=io-uring"` (if you want to run the experimental version). - -1. Run `python3 integration_tests/base_routes.py` - -## 🏃 To Run - -``` -python3 app.py -h - -usage: app.py [-h] [--processes PROCESSES] [--workers WORKERS] [--dev DEV] - -Robyn, a fast async web framework with a rust runtime. - -optional arguments: - -h, --help show this help message and exit - --processes PROCESSES : allows you to choose the number of parallel processes - --workers WORKERS : allows you to choose the number of workers - --dev DEV : this flag gives the option to enable hot reloading or not and also sets the default log level to debug - --log-level LEVEL : this flag allows you to set the log level -``` - -## ✨ Contributors/Supporters - -To contribute to Robyn, make sure to first go through the [CONTRIBUTING.md](./CONTRIBUTING.md). - -Thanks to all the contributors of the project. Robyn will not be what it is without all your support :heart:. - - - - - -Special thanks to the [PyO3](https://pyo3.rs/v0.13.2/) community and [Andrew from PyO3-asyncio](https://github.com/awestlake87/pyo3-asyncio) for their amazing libraries and their support for my queries. 💖 - -## ✨ Sponsors - -These sponsors help us make the magic happen! - -[![DigitalOcean Referral Badge](https://web-platforms.sfo2.cdn.digitaloceanspaces.com/WWW/Badge%201.svg)](https://www.digitalocean.com/?refcode=3f2b9fd4968d&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge) -[![Appwrite Logo](https://avatars.githubusercontent.com/u/25003669?s=105&v=1)](https://github.com/appwrite) - -- [Shivay Lamba](https://github.com/shivaylamba) diff --git a/docs/README.md b/docs/README.md index 158578f55..c4df23d25 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,16 +3,17 @@ # Robyn [![Twitter](https://badgen.net/badge/icon/twitter?icon=twitter&label)](https://twitter.com/robyn_oss) -[![Gitter](https://badges.gitter.im/robyn_/community.svg)](https://gitter.im/robyn_/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Downloads](https://static.pepy.tech/personalized-badge/robyn?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/robyn) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![GitHub tag](https://img.shields.io/github/tag/sansyrox/robyn?include_prereleases=&sort=semver&color=black)](https://github.com/sansyrox/robyn/releases/) [![License](https://img.shields.io/badge/License-BSD_2.0-black)](#license) -[![Discord](https://img.shields.io/discord/999782964143603713?label=discord&logo=discord&logoColor=white&style=for-the-badge&color=blue)](https://discord.gg/qKF5sSnC) +![Python](https://img.shields.io/badge/Support-Version%20%E2%89%A5%203.7-brightgreen) [![view - Documentation](https://img.shields.io/badge/view-Documentation-blue?style=for-the-badge)](https://sansyrox.github.io/robyn/#/) +[![Discord](https://img.shields.io/discord/999782964143603713?label=discord&logo=discord&logoColor=white&style=for-the-badge&color=blue)](https://discord.gg/rkERZ5eNU8) -Robyn is an async Python backend server with a runtime written in Rust, btw. +Robyn is a fast async Python web framework coupled with a web server written in Rust. + +Check out the talk at **PyCon Sweden 2021** about [Robyn: An async python web framework with a Rust runtime](https://www.youtube.com/watch?v=DK9teAs72Do) ## 📦 Installation @@ -30,12 +31,15 @@ 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. + ```python from robyn import Robyn app = Robyn(__file__) - @app.get("/") async def h(request): return "Hello, world!" @@ -43,6 +47,48 @@ async def h(request): 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 -h + +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 +``` + +Log level can be `DEBUG`, `INFO`, `WARNING`, or `ERROR`. + +### 💻 Add more routes + +You can add more routes to your API. Check out the routes in [this file](https://github.com/sansyrox/robyn/blob/main/integration_tests/base_routes.py) 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! @@ -58,44 +104,35 @@ app.start(port=8080) - Hot Reloading - Community First and truly FOSS! -## 🗒️ Contributor Guidelines +## 🗒️ How to contribute -Feel free to open an issue for any clarification or for any suggestions. +### 🏁 Get started -If you're feeling curious. You can take a look at a more detailed architecture [here](https://github.com/sansyrox/robyn/blob/main/docs/architecture.md). +Please read the [code of conduct](https://github.com/sansyrox/robyn/blob/main/CODE_OF_CONDUCT.md) and go through [CONTRIBUTING.md](https://github.com/sansyrox/robyn/blob/main/CONTRIBUTING.md) before contributing to Robyn. +Feel free to open an issue for any clarifications or suggestions. -## ⚙️ To Develop Locally +If you're feeling curious. You can take a look at a more detailed architecture [here](https://sansyrox.github.io/robyn/#/architecture). -1. Install the development dependencies: `pip install -r dev-requirements.txt` +If you still need help to get started, feel free to reach out on our [community discord](https://discord.gg/rkERZ5eNU8). -1. Install the pre-commit git hooks: `pre-commit install` +### ⚙️ To Develop Locally -1. Add more routes in the `integration_tests/base_routes.py` file(if you like). +1. Install the development dependencies (preferably inside a virtual environment): `pip install -r dev-requirements.txt` -1. Run `maturin develop` or `maturin develop --cargo-extra-args="--features=io-uring"` (if you want to run the experimental version). +2. Install the pre-commit git hooks: `pre-commit install` -1. Run `python3 integration_tests/base_routes.py` +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. -## 🏃 To Run +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](https://curl.se/) for example: ``` -python3 app.py -h - -usage: app.py [-h] [--processes PROCESSES] [--workers WORKERS] [--dev DEV] - -Robyn, a fast async web framework with a rust runtime. - -optional arguments: - -h, --help show this help message and exit - --processes PROCESSES : allows you to choose the number of parallel processes - --workers WORKERS : allows you to choose the number of workers - --dev DEV : this flag gives the option to enable hot reloading or not and also sets the default log level to debug - --log-level LEVEL : this flag allows you to set the log level +curl http://localhost:8080/sync/str ``` -## ✨ Contributors/Supporters +## ✨ Special thanks -To contribute to Robyn, make sure to first go through the [CONTRIBUTING.md](https://github.com/sansyrox/robyn/blob/main/CONTRIBUTING.md). +### ✨ Contributors/Supporters Thanks to all the contributors of the project. Robyn will not be what it is without all your support :heart:. @@ -105,7 +142,7 @@ Thanks to all the contributors of the project. Robyn will not be what it is with Special thanks to the [PyO3](https://pyo3.rs/v0.13.2/) community and [Andrew from PyO3-asyncio](https://github.com/awestlake87/pyo3-asyncio) for their amazing libraries and their support for my queries. 💖 -## ✨ Sponsors +### ✨ Sponsors These sponsors help us make the magic happen!