Overview
FastAPI is awesome, but the documentation pages (Swagger or Redoc) all depend on external CDNs, which is problematic if you want to run on disconnected networks.
This package includes the required files from the CDN and serves them locally. It also provides a super-simple way to get a FastAPI instance configured to use those files.
Under the hood, this simply automates the process described in the official documentation here.
Installation
You can install this package from PyPi:
pip install fastapi-offline
Example
Given the example from the FastAPI tutorial:
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
Simply create a fastapi_offline.FastAPIOffline object instead:
from fastapi_offline import FastAPIOffline
app = FastAPIOffline()
@app.get("/")
async def root():
return {"message": "Hello World"}
Any options passed to FastAPIOffline() except docs_url, redoc_url, favicon_url, and static_url are passed through to FastAPI(). docs_url and redoc_url are handled by fastapi-offline, and use the same syntax as normal fastapi library.
static_url can be used to set the path for the static js/css files, e.g. static_url=/static-files (default: /static-offline-docs).
Using a custom shortcut icon
By default, the FastAPI favicon.png is included and used as the shortcut icon on the docs pages. If you want to use a different one, you can specify it with the favicon_url argument:
app = FastAPIOffline(
favicon_url="http://my.cool.site/favicon.png"
)
Licensing
- This code is released under the MIT license.
- Parts of Swagger are included in this package. The original license (Apache 2.0) and copyright apply to those files.
- Parts of Redoc are included in this package. The original license (MIT) and copyright apply to those files.
- The FastAPI
favicon.pngfile is included in this package. The original license (MIT) and copyright apply to that file.
Metadata
Release files for fastapi-offline 1.7.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastapi_offline-1.7.7.tar.gz | 777.7 kB | Without provenance | Details for fastapi_offline-1.7.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastapi_offline-1.7.7-py3-none-any.whl | Python 3 | none | any | Details for fastapi_offline-1.7.7-py3-none-any.whl |
Total release size: 1.6 MB
Release files / fastapi_offline-1.7.7.tar.gz
| Download URL | fastapi_offline-1.7.7.tar.gz |
|---|---|
| Size | 777.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aeeabe67dd40f867ab0fe64dd8de742949e36ba5f3ac6aeb055baef274ed91d0
|
|
BLAKE2b-256 checksum How to use checksums |
15a5f650b565354d38f98211683a7b5c3578d450848421444799cb51da8e562f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / fastapi_offline-1.7.7-py3-none-any.whl
| Download URL | fastapi_offline-1.7.7-py3-none-any.whl |
|---|---|
| Size | 777.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60c8399fd7d3e3b01510e14468709e3dea1a0e773ef920372d057392d736a1f9
|
|
BLAKE2b-256 checksum How to use checksums |
8dde808ff88dac73c97ad32c653f92f6751ea5a0a211ae1dffd471125e63a31e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for fastapi-offline 1.7.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.