Give it an OpenAPI document, a path and a method, and get a working Panel form: a widget per parameter, a real HTTP request on submit, and the response rendered.
There is no form to write, no request to assemble, and nothing to keep in sync when the API changes. The schema already says what the inputs are.
- No form code — every path, query, header and body field becomes a widget,
chosen from its schema: enums become radio buttons or selects, bounded numbers
become sliders,
format: datebecomes a date picker. - Any spec source — a URL, a plain dict, or a FastAPI app's
api.openapi(). OpenAPI 3.0 and 3.1 both work. - Real requests — submit issues the call with
httpxand renders the status and body. Required fields are enforced from the document. - Reactive targeting —
path,methodandbase_urlare parameters, so one form can serve any operation in the document. - Record editing —
OpenAPIRecordEditorloads a record from aGETand sends the edits to the matchingPATCH/PUT/POST. APATCHsends only the fields that changed,readOnlyfields are never sent, and an optional dialog shows the diff before anything leaves the browser. - Yours to rearrange —
formandresponseare plain Panel containers, and the introspection helpers (load_openapi,collect_fields,schema_to_widget) are public if you would rather build the form yourself.
📖 Documentation — quickstart, how-to guides and API reference.
This project is in its early stages, so if you find a version that suits your needs, it’s recommended to pin your version, as updates may introduce changes.
Install it via pip:
pip install panel-openapiPoint a form at one operation of a document:
import panel as pn
from panel_openapi import OpenAPIForm
pn.extension()
form = OpenAPIForm(
"https://petstore3.swagger.io/api/v3/openapi.json",
base_url="https://petstore3.swagger.io/api/v3",
path="/pet/{petId}",
method="get",
)
form.servable()panel serve app.py --showOr load a record and edit it, sending only what changed:
from panel_openapi import OpenAPIRecordEditor
editor = OpenAPIRecordEditor(
spec,
base_url="https://api.example.com",
path="/articles/{article_id}", # GET to read, PATCH found automatically
confirm=True, # show the diff before saving
)
editor.servable()See examples/ for runnable scripts against real APIs, and the
documentation for how-to
guides.
git clone https://github.com/panel-extensions/panel-openapi
cd panel-openapiFor a simple setup use uv:
uv venv
source .venv/bin/activate # on linux. Similar commands for windows and osx
uv pip install -e .[dev]
pre-commit run install
pytest testsFor the full Github Actions setup use pixi:
pixi run pre-commit-install
pixi run postinstall
pixi run testThis repository is based on copier-template-panel-extension (you can create your own Panel extension with it)!
To update to the latest template version run:
pixi exec --spec copier --spec ruamel.yaml -- copier update --defaults --trustNote: copier will show Conflict for files with manual changes during an update. This is normal. As long as there are no merge conflict markers, all patches applied cleanly.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/YourFeature. - Make your changes and commit them:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature/YourFeature. - Open a pull request.
Please ensure your code adheres to the project's coding standards and passes all tests.
