Skip to main content

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

Metadata

Release files for star-openapi 0.9.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for star-openapi 0.9.7
File Size Uploaded
star_openapi-0.9.7.tar.gz 564.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for star-openapi 0.9.7
File Interpreter ABI Platform
star_openapi-0.9.7-py3-none-any.whl Python 3 none any Details

Total release size: 606.2 kB

Release files / star_openapi-0.9.7.tar.gz

Download URL star_openapi-0.9.7.tar.gz
Size 564.2 kB
Tags Source
SHA-256 checksum
How to use checksums
605c4c162dbac23415d1067c813897a441357d5718e82e2d3d1be57b2874d616
BLAKE2b-256 checksum
How to use checksums
db8645a2e15ef0d4ae3213ebddae9a9ee48733ca0c8b3988469774b68d9fbae8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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}

Release files / star_openapi-0.9.7-py3-none-any.whl

Download URL star_openapi-0.9.7-py3-none-any.whl
Size 42.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74a31332d9ed2dd216a8eb94a78c2284e895df84a989406f63064d0a0c99111c
BLAKE2b-256 checksum
How to use checksums
44f56f4c150a7fe47e0501f35ca8f6fd0b58b689accd077efdb0a59732c4cb2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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}

Release history Release notifications | RSS feed

This release

0.9.7 This release

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page