Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve readme #418

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Let's walk through the steps to create an issue:
**4.** Select one of the Issue Templates to get started.
<br><br><img src="https://i.imgur.com/xz2KAwU.png" width="750" /><br>

**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`.
<br><br><img src="https://i.imgur.com/XwjtGG1.png" width="750" /><br>

### Tutorials that may help you:
Expand Down
82 changes: 48 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
# 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/#/)
[![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 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)
Robyn is a fast async Python web framework coupled with a web server written in Rust. You can learn more by checking our [community resources](https://sansyrox.github.io/robyn/#/community-resources)!

## 📦 Installation

Expand All @@ -33,6 +29,10 @@ 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

Expand All @@ -43,17 +43,40 @@ 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 -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
```

## Python Version Support
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 performance
and compatibility
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
Expand All @@ -79,44 +102,35 @@ python --version
- 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](./CONTRIBUTING.md).
### ✨ Contributors/Supporters

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

Expand All @@ -126,7 +140,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!

Expand Down
95 changes: 65 additions & 30 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
# 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. You can learn more by checking our [community resources](https://sansyrox.github.io/robyn/#/community-resources)!

## 📦 Installation

Expand All @@ -30,19 +29,64 @@ 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!"

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!
Expand All @@ -58,44 +102,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:.

Expand All @@ -105,7 +140,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!

Expand Down
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0"
/>
<link rel="icon" href="https://user-images.githubusercontent.com/29942790/140995889-5d91dcff-3aa7-4cfb-8a90-2cddf1337dca.png" />
AntoineRR marked this conversation as resolved.
Show resolved Hide resolved
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/style.min.css"
Expand Down