Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scalabli/yadig
`π²ππππ` is a python based, ultrafast web framework focusing on composing Web APIs all the more rapidly and with needless baggage
https://github.com/scalabli/yadig
asyncio citus openapi3 python3
Last synced: about 1 month ago
JSON representation
`π²ππππ` is a python based, ultrafast web framework focusing on composing Web APIs all the more rapidly and with needless baggage
- Host: GitHub
- URL: https://github.com/scalabli/yadig
- Owner: scalabli
- License: mit
- Created: 2022-01-05T17:08:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-29T19:43:26.000Z (almost 3 years ago)
- Last Synced: 2024-11-09T21:47:54.365Z (about 2 months ago)
- Topics: asyncio, citus, openapi3, python3
- Language: Python
- Homepage: https://citus.rtfd.io
- Size: 8.31 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
[![Downloads](https://pepy.tech/badge/citus)](https://pepy.tech/project/citus)
[![PyPI version](https://badge.fury.io/py/citus.svg)](https://badge.fury.io/py/citus)
[![Wheel](https://img.shields.io/pypi/wheel/citus.svg)](https://pypi.com/project/citus)
[![Windows Build Status](https://img.shields.io/appveyor/build/gerrishons/citus/main?logo=appveyor&cacheSeconds=600)](https://ci.appveyor.com/project/gerrishons/citus)
[![pyimp](https://img.shields.io/pypi/implementation/citus.svg)](https://pypi.com/project/citus)
[![RTD](https://readthedocs.org/projects/citus/badge/)](https://citus.readthedocs.io)
[![licence](https://img.shields.io/pypi/l/citus.svg)](https://opensource.org/licenses/MIT)
[![Twitter Follow](https://img.shields.io/twitter/follow/gerrishon_s.svg?style=social)](https://twitter.com/gerrishon_s)[![Logo](https://raw.githubusercontent.com/secretum-inc/citus/main/docs/images/citus.png)](https://github.com/secretum-inc/citus)
`Forever Scalable`
**π²ππππ** is a python based, ultrafast web framework focusing on composing Web APIs all the more rapidly and with needless baggage.
Citus requires Python `3.8` or later.
## Features
The key features are:- [x] **Fast**: Very high performance, on par with **NodeJS** and **Go** (thanks to Starlette and Pydantic). [One of the fastest Python frameworks available](#performance).
- [x] **Fast to code**: Increase the speed to develop features by about 200% to 300%. *
- [x] **Fewer bugs**: Reduce about 40% of human (developer) induced errors. *
- [x] **Intuitive**: Great editor support. Completion everywhere. Less time debugging.
- [x] **Easy**: Designed to be easy to use and learn. Less time reading docs.
- [x] **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.
- [x] **Robust**: Get production-ready code. With automatic interactive documentation.
- [x] **Standards-based**: Based on (and fully compatible with) the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema.* estimation based on tests on an internal development team, building production applications.
- [x] Support for Ansi, RGB and HTML color models
- [x] Support for tabular presentation of data
- [x] Interactive progressbars
- [x] Code completions
- [x] Nesting of commands
- [x] Automatic help page generation
- [x] Syntax highlighting
- [x] Autosuggestions
- [x] Key Binders## Getting Started
### Installation
You can install citus via the Python Package Index (PyPI)```
pip install -U citus
```## Example
### Create it
* Create a file `main.py` with:
```Python
from typing import Optionalimport citus
app = citus.App()
@app.GET("/")
def read_root():
return "Hello World"@app.GET("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
```Or use
async def
...If your code uses `async` / `await`, use `async def`:
```Python hl_lines="9 14"
from typing import Optional
import quoapp = citus.App()
@app.GET("/")
async def read_root():
return "Hello World"@app.GET("/items/{item_id}")
async def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
```**Note**:
If you don't know, check the _"In a hurry?"_ section about `async` and `await` in the docs.
### Run it
Run the server with:
```console
$ citus main:app --reloadINFO: Citus running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [28720]
INFO: Started server process [28722]
INFO: Waiting for application startup.
INFO: Application startup complete.
```About the command
uvicorn main:app --reload
...The command `citus main:app` refers to:
* `main`: the file `main.py` (the Python "module").
* `app`: the object created inside of `main.py` with the line `app = citus.App()`.
* `--reload` or `-r`: make the server restart after code changes. Only do this for development.## Example upgrade
Now modify the file `main.py` to receive a body from a `PUT` request.
Declare the body using standard Python types, thanks to Pydantic.
```Python hl_lines="4 9-12 25-27"
from typing import Optionalimport citus
app = citus.App()
class Item(citus.Base):
name: str
price: float
is_offer: Optional[bool] = None@app.GET("/")
def read_root():
return "Hello World"@app.GET("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}@app.GET("/items/{item_id}")
def update_item(item_id: int, item: Item):
return {"item_name": item.name, "item_id": item_id}
```The server should reload automatically (because you added `--reload` to the command above).
### Check it
Open your browser at http://127.0.0.1:8000/items/33?q=checkuser.
You will see the JSON response as:
```JSON
{"item_id": 33, "q": "checkuser"}
```You already created an API that:
* Receives HTTP requests in the _paths_ `/` and `/items/{item_id}`.
* Both _paths_ take `GET` operations (also known as HTTP _methods_).
* The _path_ `/items/{item_id}` has a _path parameter_ `item_id` that should be an `int`.
* The _path_ `/items/{item_id}` has an optional `str` _que## Getting Help
### Community
For discussions about the usage, development, and the future of quo, please join our Google community
* [Communityπ¨βπ©βπ¦βπ¦](https://groups.google.com/forum/#!forum/secretum)
## Resources
### Bug tracker
If you have any suggestions, bug reports, or annoyances please report them
to our issue tracker at
[Bug tracker](https://github.com/secretum-inc/citus/issues/) or send an email to:π₯ [email protected]
## Licenseπ
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
This software is licensed under the `MIT License`. See the [License](https://github.com/secretum-inc/citus/blob/main/LICENSE) file in the top distribution directory for the full license text.## Code of Conduct
Code of Conduct is adapted from the Contributor Covenant,
version 1.2.0 available at
[Code of Conduct](http://contributor-covenant.org/version/1/2/0/)