Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into fix/json_decode
Browse files Browse the repository at this point in the history
# Conflicts:
#	integration_tests/base_routes.py
  • Loading branch information
asamaayako committed Aug 29, 2024
2 parents f80e01d + 12d8c0b commit 1f5465e
Show file tree
Hide file tree
Showing 33 changed files with 1,524 additions and 244 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "robyn"
version = "0.58.2"
version = "0.61.1"
authors = ["Sanskar Jethi <[email protected]>"]
edition = "2021"
description = "A web server that is fast!"
Expand Down
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,23 @@ usage: app.py [-h] [--processes PROCESSES] [--workers WORKERS] [--dev] [--log-le
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.
-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.
--version Show the Robyn version.
--compile-rust-path COMPILE_RUST_PATH
Compile rust files in the given path.
--create-rust-file CREATE_RUST_FILE
Create a rust file with the given name.
--disable-openapi Disable the OpenAPI documentation.
--fast Enable the fast mode.
```

Log level can be `DEBUG`, `INFO`, `WARNING`, or `ERROR`.
Expand Down
6 changes: 6 additions & 0 deletions docs_src/src/components/documentation/ApiDocs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ const guides = [
name: 'GraphQL Support',
description: 'Learn about GraphQL Support in Robyn.',
},
{
href: '/documentation/api_reference/openapi',
name: 'OpenAPI Documentation',
description:
'Learn how to generate OpenAPI docs for your applications.',
},
{
href: '/documentation/api_reference/dependency_injection',
name: 'Dependency Injection',
Expand Down
6 changes: 6 additions & 0 deletions docs_src/src/components/documentation/Guides.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const guides = [
description:
'Learn how to deploy your app to production and manage your deployments.',
},
{
href: '/documentation/example_app/openapi',
name: 'OpenAPI Documentation',
description:
'Learn how OpenAPI docs are generate for your applications.',
},
]

export function Guides() {
Expand Down
8 changes: 8 additions & 0 deletions docs_src/src/components/documentation/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ export const navigation = [
href: '/documentation/example_app/monitoring_and_logging',
},
{ title: 'Deployment', href: '/documentation/example_app/deployment' },
{
title: 'OpenAPI Documentation',
href: '/documentation/example_app/openapi',
},
{ title: 'Templates', href: '/documentation/example_app/templates' },
{
title: 'SubRouters and Views',
Expand Down Expand Up @@ -293,6 +297,10 @@ export const navigation = [
href: '/documentation/api_reference/advanced_features',
title: 'Advanced Features',
},
{
title: 'OpenAPI Documentation',
href: '/documentation/api_reference/openapi',
},
{
href: '/documentation/api_reference/multiprocess_execution',
title: 'Multiprocess Execution',
Expand Down
3 changes: 0 additions & 3 deletions docs_src/src/pages/_app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ import 'focus-visible'
import { Router, useRouter } from 'next/router'

import { MDXProvider } from '@mdx-js/react'
import Link from 'next/link'

import { Layout } from '@/components/documentation/Layout'
import { Container } from '@/components/Container'
import { Layout as ReleaseLayout } from '@/components/releases/Layout'
import * as mdxComponents from '@/components/documentation/mdx'
import * as releaseMdxComponents from '@/components/releases/mdx'
import { useMobileNavigationStore } from '@/components/documentation/MobileNavigation'

import { Analytics } from '@vercel/analytics/react'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ Batman scaled his application across multiple cores for better performance. He u
async def h(request):
return f"hello to you, {request.ip_addr}"

```
```python {{ title: 'typed' }}
from robyn import Robyn, Request

app = Robyn(__file__)

@app.get("/")
async def h(request: Request):
return f"hello to you, {request.ip_addr}"

```

</CodeGroup>
Expand All @@ -34,11 +44,11 @@ Batman scaled his application across multiple cores for better performance. He u
## What's next?


Batman wondered about whether Robyn handlers can be dispatched to multiple processes.
Batman wondered about how to help users explore the endpoints in his application.

Robyn showed him the way!
Robyn showed him the OpenAPI Documentation!

[Multitiprocess Execution](/documentation/api_reference/multiprocess_execution)
[OpenAPI Documentation](/documentation/api_reference/openapi)



Expand Down
50 changes: 48 additions & 2 deletions docs_src/src/pages/documentation/api_reference/file-uploads.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Speaking of HTML files, Batman wanted to serve simple HTML strings. He was sugge

<Row>
<Col>
Batman scaled his application across multiple cores for better performance. He used the following command:
Now, that Batman was able to serve HTML files, he wanted to serve other files like CSS, JS, and images. He was suggested to use the following code:
</Col>
<Col sticky>

Expand Down Expand Up @@ -214,11 +214,57 @@ Batman scaled his application across multiple cores for better performance. He u
</Row>


### Serving Directories

<Row>
<Col>
After serving other files, Batman wanted to serve directories, e.g. to serve a React build directory or just a simple HTML/CSS/JS directory. He was suggested to use the following code:
</Col>
<Col sticky>

<CodeGroup title="Request" tag="GET" label="/hello_world">

```python {{ title: 'untyped' }}
from robyn import Robyn, serve_file

app = Robyn(__file__)


app.serve_directory(
route="/test_dir",
directory_path=os.path.join(current_file_path, "build"),
index_file="index.html",
)

app.start(port=8080)

```

```python {{ title: 'typed' }}
from robyn import Robyn, serve_file, Request

app = Robyn(__file__)


app.serve_directory(
route="/test_dir",
directory_path=os.path.join(current_file_path, "build"),
index_file="index.html",
)

app.start(port=8080)

```

</CodeGroup>
</Col>
</Row>


## What's next?

Now, Batman was ready to learn about the advanced features of Robyn. He wanted to find a way to handle form data

- [Form Data](/documentation/api_reference/form_data)



Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export const description =


- Add performance optimizations
- OpenAPI Integration
- Pydantic Integration
- Implement Auto Const Requests
- Add ORM support, especially Prisma integration
Expand Down
25 changes: 16 additions & 9 deletions docs_src/src/pages/documentation/api_reference/getting_started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,19 @@ Batman was curious about how to run the application. Robyn explained that he cou
--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
--open-browser Open the browser on successful start.

Module flags
--create Create a new project template.
--docs Open the Robyn documentation.
--open-browser Open the browser on successful start.
--version Show the Robyn version.
--dev Development mode. It restarts the server based on file changes.

--compile-rust-path COMPILE_RUST_PATH
Compile rust files in the given path.
--create-rust-file CREATE_RUST_FILE
Create a rust file with the given name.
--disable-openapi Disable the OpenAPI documentation.
--fast Fast mode. It sets the optimal values for processes, workers and log level. However, you can override them.
```
</CodeGroup>
</Col>
Expand All @@ -130,15 +133,19 @@ Batman was curious about how to run the application. Robyn explained that he cou
--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
--open-browser Open the browser on successful start.

Module flags
--create Create a new project template.
--docs Open the Robyn documentation.
--open-browser Open the browser on successful start.
--version Show the Robyn version.
--dev Development mode. It restarts the server based on file changes.
--compile-rust-path COMPILE_RUST_PATH
Compile rust files in the given path.
--create-rust-file CREATE_RUST_FILE
Create a rust file with the given name.
--disable-openapi Disable the OpenAPI documentation.
--fast Fast mode. It sets the optimal values for processes, workers and log level. However, you can override them.
```
</CodeGroup>
</Col>
Expand Down
Loading

0 comments on commit 1f5465e

Please sign in to comment.