Skip to main content

A simple async API framework based on Starlette.

Project description

A simple async API framework based on Starlette.

test pypi pypistats pypi versions

Star OpenAPI is a web API framework based on Starlette. It uses Pydantic to verify data and automatic generation of interaction documentation.

The key features are:

Requirements

Python 3.11+

star-openapi is dependent on the following libraries:

Installation

pip install -U star-openapi[swagger]
Optional dependencies
  • httpx - Required if you want to use the TestClient.
  • python-multipart - Required if you want to support form parsing, with request.form().
  • itsdangerous - Required for SessionMiddleware support.
  • pyyaml - Required for SchemaGenerator support.

You can install all of these with pip install star-openapi[full].

You can install all of these with pip install star-openapi[swagger,redoc,rapidoc,rapipdf,scalar,elements].

A Simple Example

Here's a simple example, further go to the Example.

import uvicorn
from pydantic import BaseModel
from starlette.responses import JSONResponse

from star_openapi import OpenAPI

info = {"title": "Star API", "version": "1.0.0"}
app = OpenAPI(info=info)

book_tag = {"name": "book", "description": "book tag"}


class BookModel(BaseModel):
    name: str
    age: int


@app.post("/book", summary="get books", tags=[book_tag])
async def create_user(body: BookModel):
    """
    get all books
    """
    print(body.model_dump_json())
    return JSONResponse({"message": "Hello World"})


if __name__ == "__main__":
    print(app.routes)
    uvicorn.run(app)

API Document

Run the simple example, and go to http://127.0.0.1:8000/openapi.

OpenAPI UI plugins are optional dependencies that require manual installation.

pip install -U star-openapi[swagger,redoc,rapidoc,rapipdf,scalar,elements]

More optional ui templates goto the document about UI_Templates.

openapi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

star_openapi-0.9.2.tar.gz (570.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

star_openapi-0.9.2-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file star_openapi-0.9.2.tar.gz.

File metadata

  • Download URL: star_openapi-0.9.2.tar.gz
  • Upload date:
  • Size: 570.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for star_openapi-0.9.2.tar.gz
Algorithm Hash digest
SHA256 1c1dcbca990e44464510f74b855d3ad1e30218ba420f4a240c596b2e8c01cb78
MD5 b331ab11bed1bb87af52b23d311cba39
BLAKE2b-256 28e0e82a92b19593803196cb4c81daa08f379e3a5b406261d11354a1a94c0abb

See more details on using hashes here.

File details

Details for the file star_openapi-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: star_openapi-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for star_openapi-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 49321bcef537a784d0b7c4d3db2091940a2f7c0ddb5be21bdfdb12c0ffee21e4
MD5 ecc7a6867cc656d03cfbf28a983bbf9d
BLAKE2b-256 54d6a3202c94c9f6e3e9ba995675c7bd11d2f5a693e71bb75237de95c6585096

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page