Skip to content

Commit

Permalink
Add small documentation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Jan 13, 2025
1 parent ae8253f commit 54bfa15
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
40 changes: 26 additions & 14 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<style>
.md-typeset h1,
.md-content__button {
display: none;
}
</style>

<p align="center">
<img width="320" height="320" src="../../uvicorn.png" alt='uvicorn'>
</p>
Expand All @@ -20,9 +27,13 @@

---

# Introduction
**Documentation**: [https://www.uvicorn.org](https://www.uvicorn.org)

**Source Code**: [https://www.github.com/encode/uvicorn](https://www.github.com/encode/uvicorn)

Uvicorn is an ASGI web server implementation for Python.
---

**Uvicorn** is an ASGI web server implementation for Python.

Until recently Python has lacked a minimal low-level server/application interface for
async frameworks. The [ASGI specification][asgi] fills this gap, and means we're now able to
Expand All @@ -35,13 +46,13 @@ Uvicorn currently supports **HTTP/1.1** and **WebSockets**.
Install using `pip`:

```shell
$ pip install uvicorn
pip install uvicorn
```

This will install uvicorn with minimal (pure Python) dependencies.

```shell
$ pip install 'uvicorn[standard]'
pip install 'uvicorn[standard]'
```

This will install uvicorn with "Cython-based" dependencies (where possible) and other "optional extras".
Expand All @@ -58,7 +69,7 @@ Moreover, "optional extras" means that:

- the websocket protocol will be handled by `websockets` (should you want to use `wsproto` you'd need to install it manually) if possible.
- the `--reload` flag in development mode will use `watchfiles`.
- windows users will have `colorama` installed for the colored logs.
- Windows users will have `colorama` installed for the colored logs.
- `python-dotenv` will be installed should you want to use the `--env-file` option.
- `PyYAML` will be installed to allow you to provide a `.yaml` file to `--log-config`, if desired.

Expand All @@ -72,7 +83,8 @@ async def app(scope, receive, send):
'type': 'http.response.start',
'status': 200,
'headers': [
[b'content-type', b'text/plain'],
(b'content-type', b'text/plain'),
(b'content-length', b'13'),
],
})
await send({
Expand All @@ -84,7 +96,7 @@ async def app(scope, receive, send):
Run the server:

```shell
$ uvicorn main:app
uvicorn main:app
```

---
Expand Down Expand Up @@ -194,7 +206,7 @@ def create_app():
```

```shell
$ uvicorn --factory main:create_app
uvicorn --factory main:create_app
```

## The ASGI interface
Expand Down Expand Up @@ -400,9 +412,9 @@ It is run widely in production, and supports HTTP/1.1, HTTP/2, and WebSockets.

Any of the example applications given here can equally well be run using `daphne` instead.

```
$ pip install daphne
$ daphne app:App
```shell
pip install daphne
daphne app:App
```

### Hypercorn
Expand All @@ -412,9 +424,9 @@ being separated out into a standalone ASGI server.

Hypercorn supports HTTP/1.1, HTTP/2, HTTP/3 and WebSockets.

```
$ pip install hypercorn
$ hypercorn app:App
```shell
pip install hypercorn
hypercorn app:App
```

---
Expand Down
12 changes: 12 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
site_name: Uvicorn
site_description: The lightning-fast ASGI server.
site_url: https://www.uvicorn.org
strict: true

theme:
name: material
Expand All @@ -21,6 +22,7 @@ theme:
name: "Switch to light mode"
features:
- content.code.copy # https://squidfunk.github.io/mkdocs-material/upgrade/?h=content+copy#contentcodecopy
- navigation.sections # https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation
- navigation.top # https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#back-to-top-button
- navigation.footer # https://squidfunk.github.io/mkdocs-material/upgrade/?h=content+copy#navigationfooter
- toc.follow # https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#anchor-following
Expand All @@ -29,6 +31,12 @@ repo_name: encode/uvicorn
repo_url: https://github.com/encode/uvicorn
edit_uri: edit/master/docs/

# https://www.mkdocs.org/user-guide/configuration/#validation
validation:
omitted_files: warn
absolute_links: warn
unrecognized_links: warn

nav:
- Introduction: index.md
- Settings: settings.md
Expand All @@ -38,6 +46,7 @@ nav:
- Contributing: contributing.md

markdown_extensions:
- attr_list
- admonition
- codehilite:
css_class: highlight
Expand All @@ -46,6 +55,9 @@ markdown_extensions:
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg

hooks:
- docs/plugins/main.py

0 comments on commit 54bfa15

Please sign in to comment.