1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
%global _empty_manifest_terminate_build 0
Name: python-Flask-Autodoc
Version: 0.1.2
Release: 1
Summary: Documentation generator for flask
License: MIT
URL: http://github.com/acoomans/flask-autodoc
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ec/fd/cba920b70474b236e6033adcd979d04db221b7278cb7c442a867b669596d/Flask-Autodoc-0.1.2.tar.gz
BuildArch: noarch
%description
Flask-Autodoc is a Flask extension that automatically creates documentation for your endpoints based on the routes, function arguments and docstrings.
[](https://travis-ci.org/acoomans/flask-autodoc)
[](https://pypi.python.org/pypi/Flask-Autodoc)
[](https://pypi.python.org/pypi/Flask-Autodoc)


## Requirements
Flask-Autodoc is compatible with Python versions 2 and 3; and it depends only on Flask.
## Install
To install Flask-Autodoc, run pip:
pip install flask-autodoc
or clone this directory and run setup:
python setup.py install
## Usage
Start using Flask-Autodoc by importing it and initializing it:
from flask import Flask
from flask.ext.autodoc import Autodoc
app = Flask(__name__)
auto = Autodoc(app)
by default, Flask-Autodoc will only document the routes explicitly decorated with _doc_:
@app.route('/user/<int:id>')
@auto.doc()
def show_user(id):
return user_from_database(id)
to generate the documentation, use the _html()_ method:
@app.route('/documentation')
def documentation():
return auto.html()
## Custom documentation
To access the documentation without rendering html:
@app.route('/documentation')
def documentation():
return auto.generate()
the documentation will be returned as a list of rules, where each rule is a dictionary containing:
- methods: the set of allowed methods (ie ['GET', 'POST'])
- rule: relative url (ie '/user/<int:id>')
- endpoint: function name (ie 'show_user')
- doc: docstring of the function
- args: function arguments
- defaults: defaults values for the arguments
## Custom template
To use a custom template for your documentation, give a _template_ argument to the _html_ method. This will use a template from the flask _templates_ directory.
Additionnal arguments (other than _group_, _groups_, and _template_) will be passed down to the template:
auto.html(
template='custom_documentation.html'
title='My Documentation',
author='John Doe',
)
_title_ and _author_ will be available in the template:
<!-- templates/custom_documentation.html -->
{% if title is defined %}
{{title}}
{% endif %}
## Documentation sets
Endpoints can be grouped together in different documentation sets. It is possible for instance to show some endpoints to third party developers and have full documentation for primary developers.
To assign an endpoint to a group, pass the name of the group as argument of the _doc_ decorator:
@app.route('/user/<int:id>')
@auto.doc('public')
def show_user(id):
to assign an endpoint to multiple groups, pass a list of group names as the _groups_ argument to _doc_:
@app.route('/user/<int:id>')
@auto.doc(groups=['public','private'])
def show_user(id):
to generate the documentation for a specific group, pass the name of the group to the _html_ or _generate_ methods:
auto.html('public')
auto.html(groups=['public','private'])
auto.generate('public')
## Examples
Apps in the _examples_ directory are an api for a blog:
- _simple_ is a simple app
- _factory_ uses blueprints
Run with
python simple/blog.py
and connect to [/doc/public](http://127.0.0.1:5000/doc/public) and [/doc/private](http://127.0.0.1:5000/doc/private) to see public and private documentations.
## Screenshots


%package -n python3-Flask-Autodoc
Summary: Documentation generator for flask
Provides: python-Flask-Autodoc
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-Flask-Autodoc
Flask-Autodoc is a Flask extension that automatically creates documentation for your endpoints based on the routes, function arguments and docstrings.
[](https://travis-ci.org/acoomans/flask-autodoc)
[](https://pypi.python.org/pypi/Flask-Autodoc)
[](https://pypi.python.org/pypi/Flask-Autodoc)


## Requirements
Flask-Autodoc is compatible with Python versions 2 and 3; and it depends only on Flask.
## Install
To install Flask-Autodoc, run pip:
pip install flask-autodoc
or clone this directory and run setup:
python setup.py install
## Usage
Start using Flask-Autodoc by importing it and initializing it:
from flask import Flask
from flask.ext.autodoc import Autodoc
app = Flask(__name__)
auto = Autodoc(app)
by default, Flask-Autodoc will only document the routes explicitly decorated with _doc_:
@app.route('/user/<int:id>')
@auto.doc()
def show_user(id):
return user_from_database(id)
to generate the documentation, use the _html()_ method:
@app.route('/documentation')
def documentation():
return auto.html()
## Custom documentation
To access the documentation without rendering html:
@app.route('/documentation')
def documentation():
return auto.generate()
the documentation will be returned as a list of rules, where each rule is a dictionary containing:
- methods: the set of allowed methods (ie ['GET', 'POST'])
- rule: relative url (ie '/user/<int:id>')
- endpoint: function name (ie 'show_user')
- doc: docstring of the function
- args: function arguments
- defaults: defaults values for the arguments
## Custom template
To use a custom template for your documentation, give a _template_ argument to the _html_ method. This will use a template from the flask _templates_ directory.
Additionnal arguments (other than _group_, _groups_, and _template_) will be passed down to the template:
auto.html(
template='custom_documentation.html'
title='My Documentation',
author='John Doe',
)
_title_ and _author_ will be available in the template:
<!-- templates/custom_documentation.html -->
{% if title is defined %}
{{title}}
{% endif %}
## Documentation sets
Endpoints can be grouped together in different documentation sets. It is possible for instance to show some endpoints to third party developers and have full documentation for primary developers.
To assign an endpoint to a group, pass the name of the group as argument of the _doc_ decorator:
@app.route('/user/<int:id>')
@auto.doc('public')
def show_user(id):
to assign an endpoint to multiple groups, pass a list of group names as the _groups_ argument to _doc_:
@app.route('/user/<int:id>')
@auto.doc(groups=['public','private'])
def show_user(id):
to generate the documentation for a specific group, pass the name of the group to the _html_ or _generate_ methods:
auto.html('public')
auto.html(groups=['public','private'])
auto.generate('public')
## Examples
Apps in the _examples_ directory are an api for a blog:
- _simple_ is a simple app
- _factory_ uses blueprints
Run with
python simple/blog.py
and connect to [/doc/public](http://127.0.0.1:5000/doc/public) and [/doc/private](http://127.0.0.1:5000/doc/private) to see public and private documentations.
## Screenshots


%package help
Summary: Development documents and examples for Flask-Autodoc
Provides: python3-Flask-Autodoc-doc
%description help
Flask-Autodoc is a Flask extension that automatically creates documentation for your endpoints based on the routes, function arguments and docstrings.
[](https://travis-ci.org/acoomans/flask-autodoc)
[](https://pypi.python.org/pypi/Flask-Autodoc)
[](https://pypi.python.org/pypi/Flask-Autodoc)


## Requirements
Flask-Autodoc is compatible with Python versions 2 and 3; and it depends only on Flask.
## Install
To install Flask-Autodoc, run pip:
pip install flask-autodoc
or clone this directory and run setup:
python setup.py install
## Usage
Start using Flask-Autodoc by importing it and initializing it:
from flask import Flask
from flask.ext.autodoc import Autodoc
app = Flask(__name__)
auto = Autodoc(app)
by default, Flask-Autodoc will only document the routes explicitly decorated with _doc_:
@app.route('/user/<int:id>')
@auto.doc()
def show_user(id):
return user_from_database(id)
to generate the documentation, use the _html()_ method:
@app.route('/documentation')
def documentation():
return auto.html()
## Custom documentation
To access the documentation without rendering html:
@app.route('/documentation')
def documentation():
return auto.generate()
the documentation will be returned as a list of rules, where each rule is a dictionary containing:
- methods: the set of allowed methods (ie ['GET', 'POST'])
- rule: relative url (ie '/user/<int:id>')
- endpoint: function name (ie 'show_user')
- doc: docstring of the function
- args: function arguments
- defaults: defaults values for the arguments
## Custom template
To use a custom template for your documentation, give a _template_ argument to the _html_ method. This will use a template from the flask _templates_ directory.
Additionnal arguments (other than _group_, _groups_, and _template_) will be passed down to the template:
auto.html(
template='custom_documentation.html'
title='My Documentation',
author='John Doe',
)
_title_ and _author_ will be available in the template:
<!-- templates/custom_documentation.html -->
{% if title is defined %}
{{title}}
{% endif %}
## Documentation sets
Endpoints can be grouped together in different documentation sets. It is possible for instance to show some endpoints to third party developers and have full documentation for primary developers.
To assign an endpoint to a group, pass the name of the group as argument of the _doc_ decorator:
@app.route('/user/<int:id>')
@auto.doc('public')
def show_user(id):
to assign an endpoint to multiple groups, pass a list of group names as the _groups_ argument to _doc_:
@app.route('/user/<int:id>')
@auto.doc(groups=['public','private'])
def show_user(id):
to generate the documentation for a specific group, pass the name of the group to the _html_ or _generate_ methods:
auto.html('public')
auto.html(groups=['public','private'])
auto.generate('public')
## Examples
Apps in the _examples_ directory are an api for a blog:
- _simple_ is a simple app
- _factory_ uses blueprints
Run with
python simple/blog.py
and connect to [/doc/public](http://127.0.0.1:5000/doc/public) and [/doc/private](http://127.0.0.1:5000/doc/private) to see public and private documentations.
## Screenshots


%prep
%autosetup -n Flask-Autodoc-0.1.2
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-Flask-Autodoc -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.2-1
- Package Spec generated
|