FastAPI Tag
Documented & Enhance the Metadata of your API ✨
A simple Package could be added to your FastAPI Project to enhance the metadata of your Project and documenting your API with more information.
Source Code: https://github.com/yezz123/fastapi-tag
Install the project: pip install fastapi-tag
Features 🎉
- Add a tag to your API, which can be used to filter the API documentation.
- Add a description to your API, which can be used to describe the API.
- Add a version to your API, which can be used to describe the version of the API and app.
- Provide some others features like:
API_id: A unique identifier for the API.Audience: The audience of the API (e.g.public,internal,external).
- Tested in python 3.8 and up.
- Last Version of FastAPI 🚀
Usage 📚
- To Identify the Metadata of your API:
from fastapi import FastAPI
from fastapi_tag.model import Contact, Metadata, Version
from fastapi_tag.application import Application
app = FastAPI()
def metadata(app):
return Metadata(
title="Hello World",
version=Version(app="v0.1.1", api="v0.1.0"),
description="A simple example of a FastAPI application.",
contact=Contact(
name="name",
url="http://test.com",
email=None
),
api_id="49786b4b-1889-46ec-bd72-27f332436e6f",
audience="company-internal",
)
def app(metadata):
return Application("", metadata)
-
We have also
Problemclass thats depends on:title: The title of the problem.status: The status code of the problem.detail: A human-readable explanation specific to this occurrence of the problem.instance: A URI reference that identifies the specific occurrence of the problem.type: A URI reference that identifies the problem type.
-
NameSpaceis a is a decorator that adds a route generator to the namespace object.
for example:
from fastapi_tag.routers import Namespace
route = Namespace([])
Development
Setup environment
You should create a virtual environment and activate it:
Notes: You need to have
python3.9or higher installed.
I Use uv to manage virtual environments, you can install it with:
# Install uv
pip install uv
# Create a virtual environment
uv venv
# Activate the virtual environment
source .venv/bin/activate
And then install the development dependencies:
# Install dependencies
uv pip install -e .[test,lint]
Run tests 🌝
You can run all the tests with:
bash scripts/tests.sh
Format the code 🍂
Execute the following command to apply pre-commit formatting:
bash scripts/format.sh
License 🍻
This project is licensed under the terms of the MIT license.
Release files for fastapi-tag 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_tag-1.0.0.tar.gz | 43.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_tag-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.4 kB
Release files / fastapi_tag-1.0.0.tar.gz
| Download URL | fastapi_tag-1.0.0.tar.gz |
|---|---|
| Size | 43.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9355980e0e983eebeeb7037b85647a0c3ba5b5afe2b99b1234aca09c4f23ae7c
|
|
BLAKE2b-256 checksum How to use checksums |
648fca5575b5ad8afb7f1932c27540eb3dc12356ef467514e281ca3574722997
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / fastapi_tag-1.0.0-py3-none-any.whl
| Download URL | fastapi_tag-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
868058694c96772ffb4aacd881bac225eb1802ef753d362b6574bac3add43d73
|
|
BLAKE2b-256 checksum How to use checksums |
1f4f00e6872a043bd4c4e62de63afdf945ea3175c4cf871bb6f0c6143dab078c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|