I would recommend you Sphinx, you add your documentation as __doc__ and the autodoc module of Sphinx will generate the docs for you (docs.python.org also uses Sphinx). The markup is reStructuredText, similiar to Markdown (if you prefer Markdown, you can use pdoc).
e.g.:
@app.route('/download/<int:id>')
def download_id(id):
'''This downloads a certain image specified by *id*'''
return ...
Answer from dav1d on Stack OverflowI would recommend you Sphinx, you add your documentation as __doc__ and the autodoc module of Sphinx will generate the docs for you (docs.python.org also uses Sphinx). The markup is reStructuredText, similiar to Markdown (if you prefer Markdown, you can use pdoc).
e.g.:
@app.route('/download/<int:id>')
def download_id(id):
'''This downloads a certain image specified by *id*'''
return ...
I really like Swagger because it allows to generate an API documentation by just adding a few decorators and comments into your code. There is a Flask Swagger available.
from flask import Flask
from flask.ext.restful import Api
from flask_restful_swagger import swagger
app = Flask(__name__)
api = swagger.docs(Api(app), apiVersion='1', api_spec_url="/api/v1/spec")
class Unicorn(Resource):
"Describing unicorns"
@swagger.operation(
notes='some really good notes'
)
def get(self, todo_id):
...
Then you can see your methods and notes in an html interface just by visiting /api/v1/spec (it serves needed static automatically). You can also just get all your API description in JSON and parse it otherwise.
Hey,
I've been lately writing Declarai, an open-source llm-related library.
The need for a clear API reference documentation came fast and I started looking for good auto-generate documentation tools.
Up until now, I found mkdocstrings the best choice as im using mkdocs anyhow.
Do you guys aware of any other great tools for api documentation auto-generation ?