is one of"
26 | @echo " html to make standalone HTML files"
27 | @echo " dirhtml to make HTML files named index.html in directories"
28 | @echo " singlehtml to make a single large HTML file"
29 | @echo " pickle to make pickle files"
30 | @echo " json to make JSON files"
31 | @echo " htmlhelp to make HTML files and a HTML help project"
32 | @echo " qthelp to make HTML files and a qthelp project"
33 | @echo " devhelp to make HTML files and a Devhelp project"
34 | @echo " epub to make an epub"
35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
36 | @echo " latexpdf to make LaTeX files and run them through pdflatex"
37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
38 | @echo " text to make text files"
39 | @echo " man to make manual pages"
40 | @echo " texinfo to make Texinfo files"
41 | @echo " info to make Texinfo files and run them through makeinfo"
42 | @echo " gettext to make PO message catalogs"
43 | @echo " changes to make an overview of all changed/added/deprecated items"
44 | @echo " xml to make Docutils-native XML files"
45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes"
46 | @echo " linkcheck to check all external links for integrity"
47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)"
48 |
49 | clean:
50 | rm -rf $(BUILDDIR)/*
51 |
52 | html:
53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
54 | @echo
55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
56 |
57 | dirhtml:
58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
59 | @echo
60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
61 |
62 | singlehtml:
63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
64 | @echo
65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
66 |
67 | pickle:
68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
69 | @echo
70 | @echo "Build finished; now you can process the pickle files."
71 |
72 | json:
73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
74 | @echo
75 | @echo "Build finished; now you can process the JSON files."
76 |
77 | htmlhelp:
78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
79 | @echo
80 | @echo "Build finished; now you can run HTML Help Workshop with the" \
81 | ".hhp project file in $(BUILDDIR)/htmlhelp."
82 |
83 | qthelp:
84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
85 | @echo
86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \
87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/flask-init.qhcp"
89 | @echo "To view the help file:"
90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/flask-init.qhc"
91 |
92 | devhelp:
93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
94 | @echo
95 | @echo "Build finished."
96 | @echo "To view the help file:"
97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/flask-init"
98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/flask-init"
99 | @echo "# devhelp"
100 |
101 | epub:
102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
103 | @echo
104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
105 |
106 | latex:
107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
108 | @echo
109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \
111 | "(use \`make latexpdf' here to do that automatically)."
112 |
113 | latexpdf:
114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
115 | @echo "Running LaTeX files through pdflatex..."
116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf
117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
118 |
119 | latexpdfja:
120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
121 | @echo "Running LaTeX files through platex and dvipdfmx..."
122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
124 |
125 | text:
126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
127 | @echo
128 | @echo "Build finished. The text files are in $(BUILDDIR)/text."
129 |
130 | man:
131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
132 | @echo
133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
134 |
135 | texinfo:
136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
137 | @echo
138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
139 | @echo "Run \`make' in that directory to run these through makeinfo" \
140 | "(use \`make info' here to do that automatically)."
141 |
142 | info:
143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
144 | @echo "Running Texinfo files through makeinfo..."
145 | make -C $(BUILDDIR)/texinfo info
146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
147 |
148 | gettext:
149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
150 | @echo
151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
152 |
153 | changes:
154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
155 | @echo
156 | @echo "The overview file is in $(BUILDDIR)/changes."
157 |
158 | linkcheck:
159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
160 | @echo
161 | @echo "Link check complete; look for any errors in the above output " \
162 | "or in $(BUILDDIR)/linkcheck/output.txt."
163 |
164 | doctest:
165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
166 | @echo "Testing of doctests in the sources finished, look at the " \
167 | "results in $(BUILDDIR)/doctest/output.txt."
168 |
169 | xml:
170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
171 | @echo
172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
173 |
174 | pseudoxml:
175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
176 | @echo
177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
178 |
--------------------------------------------------------------------------------
/docs/_themes/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010 by Armin Ronacher.
2 |
3 | Some rights reserved.
4 |
5 | Redistribution and use in source and binary forms of the theme, with or
6 | without modification, are permitted provided that the following conditions
7 | are met:
8 |
9 | * Redistributions of source code must retain the above copyright
10 | notice, this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above
13 | copyright notice, this list of conditions and the following
14 | disclaimer in the documentation and/or other materials provided
15 | with the distribution.
16 |
17 | * The names of the contributors may not be used to endorse or
18 | promote products derived from this software without specific
19 | prior written permission.
20 |
21 | We kindly ask you to only use these themes in an unmodified manner just
22 | for Flask and Flask-related products, not for unrelated projects. If you
23 | like the visual style and want to use it for your own projects, please
24 | consider making some larger changes to the themes (such as changing
25 | font faces, sizes, colors or margins).
26 |
27 | THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 | ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE
37 | POSSIBILITY OF SUCH DAMAGE.
38 |
--------------------------------------------------------------------------------
/docs/_themes/README:
--------------------------------------------------------------------------------
1 | Flask Sphinx Styles
2 | ===================
3 |
4 | This repository contains sphinx styles for Flask and Flask related
5 | projects. To use this style in your Sphinx documentation, follow
6 | this guide:
7 |
8 | 1. put this folder as _themes into your docs folder. Alternatively
9 | you can also use git submodules to check out the contents there.
10 | 2. add this to your conf.py:
11 |
12 | sys.path.append(os.path.abspath('_themes'))
13 | html_theme_path = ['_themes']
14 | html_theme = 'flask'
15 |
16 | The following themes exist:
17 |
18 | - 'flask' - the standard flask documentation theme for large
19 | projects
20 | - 'flask_small' - small one-page theme. Intended to be used by
21 | very small addon libraries for flask.
22 |
23 | The following options exist for the flask_small theme:
24 |
25 | [options]
26 | index_logo = '' filename of a picture in _static
27 | to be used as replacement for the
28 | h1 in the index.rst file.
29 | index_logo_height = 120px height of the index logo
30 | github_fork = '' repository name on github for the
31 | "fork me" badge
32 |
--------------------------------------------------------------------------------
/docs/_themes/flask/layout.html:
--------------------------------------------------------------------------------
1 | {%- extends "basic/layout.html" %}
2 | {%- block extrahead %}
3 | {{ super() }}
4 | {% if theme_touch_icon %}
5 |
6 | {% endif %}
7 |
8 | {% endblock %}
9 | {%- block relbar2 %}
10 |
12 | {% endblock %}
13 | {% block header %}
14 | {{ super() }}
15 | {% if pagename == 'index' %}
16 |
17 | {% endif %}
18 | {% endblock %}
19 | {%- block footer %}
20 |
24 | {% if pagename == 'index' %}
25 |
26 | {% endif %}
27 | {%- endblock %}
28 |
--------------------------------------------------------------------------------
/docs/_themes/flask/relations.html:
--------------------------------------------------------------------------------
1 | Related Topics
2 |
20 |
--------------------------------------------------------------------------------
/docs/_themes/flask/static/flasky.css_t:
--------------------------------------------------------------------------------
1 | /*
2 | * flasky.css_t
3 | * ~~~~~~~~~~~~
4 | *
5 | * :copyright: Copyright 2010 by Armin Ronacher.
6 | * :license: Flask Design License, see LICENSE for details.
7 | */
8 |
9 | {% set page_width = '940px' %}
10 | {% set sidebar_width = '220px' %}
11 |
12 | @import url("basic.css");
13 |
14 | /* -- page layout ----------------------------------------------------------- */
15 |
16 | body {
17 | font-family: 'Georgia', serif;
18 | font-size: 17px;
19 | background-color: white;
20 | color: #000;
21 | margin: 0;
22 | padding: 0;
23 | }
24 |
25 | div.document {
26 | width: {{ page_width }};
27 | margin: 30px auto 0 auto;
28 | }
29 |
30 | div.documentwrapper {
31 | float: left;
32 | width: 100%;
33 | }
34 |
35 | div.bodywrapper {
36 | margin: 0 0 0 {{ sidebar_width }};
37 | }
38 |
39 | div.sphinxsidebar {
40 | width: {{ sidebar_width }};
41 | }
42 |
43 | hr {
44 | border: 1px solid #B1B4B6;
45 | }
46 |
47 | div.body {
48 | background-color: #ffffff;
49 | color: #3E4349;
50 | padding: 0 30px 0 30px;
51 | }
52 |
53 | img.floatingflask {
54 | padding: 0 0 10px 10px;
55 | float: right;
56 | }
57 |
58 | div.footer {
59 | width: {{ page_width }};
60 | margin: 20px auto 30px auto;
61 | font-size: 14px;
62 | color: #888;
63 | text-align: right;
64 | }
65 |
66 | div.footer a {
67 | color: #888;
68 | }
69 |
70 | div.related {
71 | display: none;
72 | }
73 |
74 | div.sphinxsidebar a {
75 | color: #444;
76 | text-decoration: none;
77 | border-bottom: 1px dotted #999;
78 | }
79 |
80 | div.sphinxsidebar a:hover {
81 | border-bottom: 1px solid #999;
82 | }
83 |
84 | div.sphinxsidebar {
85 | font-size: 14px;
86 | line-height: 1.5;
87 | }
88 |
89 | div.sphinxsidebarwrapper {
90 | padding: 18px 10px;
91 | }
92 |
93 | div.sphinxsidebarwrapper p.logo {
94 | padding: 0 0 20px 0;
95 | margin: 0;
96 | text-align: center;
97 | }
98 |
99 | div.sphinxsidebar h3,
100 | div.sphinxsidebar h4 {
101 | font-family: 'Garamond', 'Georgia', serif;
102 | color: #444;
103 | font-size: 24px;
104 | font-weight: normal;
105 | margin: 0 0 5px 0;
106 | padding: 0;
107 | }
108 |
109 | div.sphinxsidebar h4 {
110 | font-size: 20px;
111 | }
112 |
113 | div.sphinxsidebar h3 a {
114 | color: #444;
115 | }
116 |
117 | div.sphinxsidebar p.logo a,
118 | div.sphinxsidebar h3 a,
119 | div.sphinxsidebar p.logo a:hover,
120 | div.sphinxsidebar h3 a:hover {
121 | border: none;
122 | }
123 |
124 | div.sphinxsidebar p {
125 | color: #555;
126 | margin: 10px 0;
127 | }
128 |
129 | div.sphinxsidebar ul {
130 | margin: 10px 0;
131 | padding: 0;
132 | color: #000;
133 | }
134 |
135 | div.sphinxsidebar input {
136 | border: 1px solid #ccc;
137 | font-family: 'Georgia', serif;
138 | font-size: 1em;
139 | }
140 |
141 | /* -- body styles ----------------------------------------------------------- */
142 |
143 | a {
144 | color: #004B6B;
145 | text-decoration: underline;
146 | }
147 |
148 | a:hover {
149 | color: #6D4100;
150 | text-decoration: underline;
151 | }
152 |
153 | div.body h1,
154 | div.body h2,
155 | div.body h3,
156 | div.body h4,
157 | div.body h5,
158 | div.body h6 {
159 | font-family: 'Garamond', 'Georgia', serif;
160 | font-weight: normal;
161 | margin: 30px 0px 10px 0px;
162 | padding: 0;
163 | }
164 |
165 | {% if theme_index_logo %}
166 | div.indexwrapper h1 {
167 | text-indent: -999999px;
168 | background: url({{ theme_index_logo }}) no-repeat center center;
169 | height: {{ theme_index_logo_height }};
170 | }
171 | {% endif %}
172 | div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
173 | div.body h2 { font-size: 180%; }
174 | div.body h3 { font-size: 150%; }
175 | div.body h4 { font-size: 130%; }
176 | div.body h5 { font-size: 100%; }
177 | div.body h6 { font-size: 100%; }
178 |
179 | a.headerlink {
180 | color: #ddd;
181 | padding: 0 4px;
182 | text-decoration: none;
183 | }
184 |
185 | a.headerlink:hover {
186 | color: #444;
187 | background: #eaeaea;
188 | }
189 |
190 | div.body p, div.body dd, div.body li {
191 | line-height: 1.4em;
192 | }
193 |
194 | div.admonition {
195 | background: #fafafa;
196 | margin: 20px -30px;
197 | padding: 10px 30px;
198 | border-top: 1px solid #ccc;
199 | border-bottom: 1px solid #ccc;
200 | }
201 |
202 | div.admonition tt.xref, div.admonition a tt {
203 | border-bottom: 1px solid #fafafa;
204 | }
205 |
206 | dd div.admonition {
207 | margin-left: -60px;
208 | padding-left: 60px;
209 | }
210 |
211 | div.admonition p.admonition-title {
212 | font-family: 'Garamond', 'Georgia', serif;
213 | font-weight: normal;
214 | font-size: 24px;
215 | margin: 0 0 10px 0;
216 | padding: 0;
217 | line-height: 1;
218 | }
219 |
220 | div.admonition p.last {
221 | margin-bottom: 0;
222 | }
223 |
224 | div.highlight {
225 | background-color: white;
226 | }
227 |
228 | dt:target, .highlight {
229 | background: #FAF3E8;
230 | }
231 |
232 | div.note {
233 | background-color: #eee;
234 | border: 1px solid #ccc;
235 | }
236 |
237 | div.seealso {
238 | background-color: #ffc;
239 | border: 1px solid #ff6;
240 | }
241 |
242 | div.topic {
243 | background-color: #eee;
244 | }
245 |
246 | p.admonition-title {
247 | display: inline;
248 | }
249 |
250 | p.admonition-title:after {
251 | content: ":";
252 | }
253 |
254 | pre, tt {
255 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
256 | font-size: 0.9em;
257 | }
258 |
259 | img.screenshot {
260 | }
261 |
262 | tt.descname, tt.descclassname {
263 | font-size: 0.95em;
264 | }
265 |
266 | tt.descname {
267 | padding-right: 0.08em;
268 | }
269 |
270 | img.screenshot {
271 | -moz-box-shadow: 2px 2px 4px #eee;
272 | -webkit-box-shadow: 2px 2px 4px #eee;
273 | box-shadow: 2px 2px 4px #eee;
274 | }
275 |
276 | table.docutils {
277 | border: 1px solid #888;
278 | -moz-box-shadow: 2px 2px 4px #eee;
279 | -webkit-box-shadow: 2px 2px 4px #eee;
280 | box-shadow: 2px 2px 4px #eee;
281 | }
282 |
283 | table.docutils td, table.docutils th {
284 | border: 1px solid #888;
285 | padding: 0.25em 0.7em;
286 | }
287 |
288 | table.field-list, table.footnote {
289 | border: none;
290 | -moz-box-shadow: none;
291 | -webkit-box-shadow: none;
292 | box-shadow: none;
293 | }
294 |
295 | table.footnote {
296 | margin: 15px 0;
297 | width: 100%;
298 | border: 1px solid #eee;
299 | background: #fdfdfd;
300 | font-size: 0.9em;
301 | }
302 |
303 | table.footnote + table.footnote {
304 | margin-top: -15px;
305 | border-top: none;
306 | }
307 |
308 | table.field-list th {
309 | padding: 0 0.8em 0 0;
310 | }
311 |
312 | table.field-list td {
313 | padding: 0;
314 | }
315 |
316 | table.footnote td.label {
317 | width: 0px;
318 | padding: 0.3em 0 0.3em 0.5em;
319 | }
320 |
321 | table.footnote td {
322 | padding: 0.3em 0.5em;
323 | }
324 |
325 | dl {
326 | margin: 0;
327 | padding: 0;
328 | }
329 |
330 | dl dd {
331 | margin-left: 30px;
332 | }
333 |
334 | blockquote {
335 | margin: 0 0 0 30px;
336 | padding: 0;
337 | }
338 |
339 | ul, ol {
340 | margin: 10px 0 10px 30px;
341 | padding: 0;
342 | }
343 |
344 | pre {
345 | background: #eee;
346 | padding: 7px 30px;
347 | margin: 15px -30px;
348 | line-height: 1.3em;
349 | }
350 |
351 | dl pre, blockquote pre, li pre {
352 | margin-left: -60px;
353 | padding-left: 60px;
354 | }
355 |
356 | dl dl pre {
357 | margin-left: -90px;
358 | padding-left: 90px;
359 | }
360 |
361 | tt {
362 | background-color: #ecf0f3;
363 | color: #222;
364 | /* padding: 1px 2px; */
365 | }
366 |
367 | tt.xref, a tt {
368 | background-color: #FBFBFB;
369 | border-bottom: 1px solid white;
370 | }
371 |
372 | a.reference {
373 | text-decoration: none;
374 | border-bottom: 1px dotted #004B6B;
375 | }
376 |
377 | a.reference:hover {
378 | border-bottom: 1px solid #6D4100;
379 | }
380 |
381 | a.footnote-reference {
382 | text-decoration: none;
383 | font-size: 0.7em;
384 | vertical-align: top;
385 | border-bottom: 1px dotted #004B6B;
386 | }
387 |
388 | a.footnote-reference:hover {
389 | border-bottom: 1px solid #6D4100;
390 | }
391 |
392 | a:hover tt {
393 | background: #EEE;
394 | }
395 |
396 |
397 | @media screen and (max-width: 870px) {
398 |
399 | div.sphinxsidebar {
400 | display: none;
401 | }
402 |
403 | div.document {
404 | width: 100%;
405 |
406 | }
407 |
408 | div.documentwrapper {
409 | margin-left: 0;
410 | margin-top: 0;
411 | margin-right: 0;
412 | margin-bottom: 0;
413 | }
414 |
415 | div.bodywrapper {
416 | margin-top: 0;
417 | margin-right: 0;
418 | margin-bottom: 0;
419 | margin-left: 0;
420 | }
421 |
422 | ul {
423 | margin-left: 0;
424 | }
425 |
426 | .document {
427 | width: auto;
428 | }
429 |
430 | .footer {
431 | width: auto;
432 | }
433 |
434 | .bodywrapper {
435 | margin: 0;
436 | }
437 |
438 | .footer {
439 | width: auto;
440 | }
441 |
442 | .github {
443 | display: none;
444 | }
445 |
446 |
447 |
448 | }
449 |
450 |
451 |
452 | @media screen and (max-width: 875px) {
453 |
454 | body {
455 | margin: 0;
456 | padding: 20px 30px;
457 | }
458 |
459 | div.documentwrapper {
460 | float: none;
461 | background: white;
462 | }
463 |
464 | div.sphinxsidebar {
465 | display: block;
466 | float: none;
467 | width: 102.5%;
468 | margin: 50px -30px -20px -30px;
469 | padding: 10px 20px;
470 | background: #333;
471 | color: white;
472 | }
473 |
474 | div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
475 | div.sphinxsidebar h3 a {
476 | color: white;
477 | }
478 |
479 | div.sphinxsidebar a {
480 | color: #aaa;
481 | }
482 |
483 | div.sphinxsidebar p.logo {
484 | display: none;
485 | }
486 |
487 | div.document {
488 | width: 100%;
489 | margin: 0;
490 | }
491 |
492 | div.related {
493 | display: block;
494 | margin: 0;
495 | padding: 10px 0 20px 0;
496 | }
497 |
498 | div.related ul,
499 | div.related ul li {
500 | margin: 0;
501 | padding: 0;
502 | }
503 |
504 | div.footer {
505 | display: none;
506 | }
507 |
508 | div.bodywrapper {
509 | margin: 0;
510 | }
511 |
512 | div.body {
513 | min-height: 0;
514 | padding: 0;
515 | }
516 |
517 | .rtd_doc_footer {
518 | display: none;
519 | }
520 |
521 | .document {
522 | width: auto;
523 | }
524 |
525 | .footer {
526 | width: auto;
527 | }
528 |
529 | .footer {
530 | width: auto;
531 | }
532 |
533 | .github {
534 | display: none;
535 | }
536 | }
537 |
538 |
539 | /* scrollbars */
540 |
541 | ::-webkit-scrollbar {
542 | width: 6px;
543 | height: 6px;
544 | }
545 |
546 | ::-webkit-scrollbar-button:start:decrement,
547 | ::-webkit-scrollbar-button:end:increment {
548 | display: block;
549 | height: 10px;
550 | }
551 |
552 | ::-webkit-scrollbar-button:vertical:increment {
553 | background-color: #fff;
554 | }
555 |
556 | ::-webkit-scrollbar-track-piece {
557 | background-color: #eee;
558 | -webkit-border-radius: 3px;
559 | }
560 |
561 | ::-webkit-scrollbar-thumb:vertical {
562 | height: 50px;
563 | background-color: #ccc;
564 | -webkit-border-radius: 3px;
565 | }
566 |
567 | ::-webkit-scrollbar-thumb:horizontal {
568 | width: 50px;
569 | background-color: #ccc;
570 | -webkit-border-radius: 3px;
571 | }
572 |
573 | /* misc. */
574 |
575 | .revsys-inline {
576 | display: none!important;
577 | }
--------------------------------------------------------------------------------
/docs/_themes/flask/theme.conf:
--------------------------------------------------------------------------------
1 | [theme]
2 | inherit = basic
3 | stylesheet = flasky.css
4 | pygments_style = flask_theme_support.FlaskyStyle
5 |
6 | [options]
7 | index_logo = ''
8 | index_logo_height = 120px
9 | touch_icon =
10 |
--------------------------------------------------------------------------------
/docs/_themes/flask_small/layout.html:
--------------------------------------------------------------------------------
1 | {% extends "basic/layout.html" %}
2 | {% block header %}
3 | {{ super() }}
4 | {% if pagename == 'index' %}
5 |
6 | {% endif %}
7 | {% endblock %}
8 | {% block footer %}
9 | {% if pagename == 'index' %}
10 |
11 | {% endif %}
12 | {% endblock %}
13 | {# do not display relbars #}
14 | {% block relbar1 %}{% endblock %}
15 | {% block relbar2 %}
16 | {% if theme_github_fork %}
17 |
19 | {% endif %}
20 | {% endblock %}
21 | {% block sidebar1 %}{% endblock %}
22 | {% block sidebar2 %}{% endblock %}
23 |
--------------------------------------------------------------------------------
/docs/_themes/flask_small/static/flasky.css_t:
--------------------------------------------------------------------------------
1 | /*
2 | * flasky.css_t
3 | * ~~~~~~~~~~~~
4 | *
5 | * Sphinx stylesheet -- flasky theme based on nature theme.
6 | *
7 | * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | @import url("basic.css");
13 |
14 | /* -- page layout ----------------------------------------------------------- */
15 |
16 | body {
17 | font-family: 'Georgia', serif;
18 | font-size: 17px;
19 | color: #000;
20 | background: white;
21 | margin: 0;
22 | padding: 0;
23 | }
24 |
25 | div.documentwrapper {
26 | float: left;
27 | width: 100%;
28 | }
29 |
30 | div.bodywrapper {
31 | margin: 40px auto 0 auto;
32 | width: 700px;
33 | }
34 |
35 | hr {
36 | border: 1px solid #B1B4B6;
37 | }
38 |
39 | div.body {
40 | background-color: #ffffff;
41 | color: #3E4349;
42 | padding: 0 30px 30px 30px;
43 | }
44 |
45 | img.floatingflask {
46 | padding: 0 0 10px 10px;
47 | float: right;
48 | }
49 |
50 | div.footer {
51 | text-align: right;
52 | color: #888;
53 | padding: 10px;
54 | font-size: 14px;
55 | width: 650px;
56 | margin: 0 auto 40px auto;
57 | }
58 |
59 | div.footer a {
60 | color: #888;
61 | text-decoration: underline;
62 | }
63 |
64 | div.related {
65 | line-height: 32px;
66 | color: #888;
67 | }
68 |
69 | div.related ul {
70 | padding: 0 0 0 10px;
71 | }
72 |
73 | div.related a {
74 | color: #444;
75 | }
76 |
77 | /* -- body styles ----------------------------------------------------------- */
78 |
79 | a {
80 | color: #004B6B;
81 | text-decoration: underline;
82 | }
83 |
84 | a:hover {
85 | color: #6D4100;
86 | text-decoration: underline;
87 | }
88 |
89 | div.body {
90 | padding-bottom: 40px; /* saved for footer */
91 | }
92 |
93 | div.body h1,
94 | div.body h2,
95 | div.body h3,
96 | div.body h4,
97 | div.body h5,
98 | div.body h6 {
99 | font-family: 'Garamond', 'Georgia', serif;
100 | font-weight: normal;
101 | margin: 30px 0px 10px 0px;
102 | padding: 0;
103 | }
104 |
105 | {% if theme_index_logo %}
106 | div.indexwrapper h1 {
107 | text-indent: -999999px;
108 | background: url({{ theme_index_logo }}) no-repeat center center;
109 | height: {{ theme_index_logo_height }};
110 | }
111 | {% endif %}
112 |
113 | div.body h2 { font-size: 180%; }
114 | div.body h3 { font-size: 150%; }
115 | div.body h4 { font-size: 130%; }
116 | div.body h5 { font-size: 100%; }
117 | div.body h6 { font-size: 100%; }
118 |
119 | a.headerlink {
120 | color: white;
121 | padding: 0 4px;
122 | text-decoration: none;
123 | }
124 |
125 | a.headerlink:hover {
126 | color: #444;
127 | background: #eaeaea;
128 | }
129 |
130 | div.body p, div.body dd, div.body li {
131 | line-height: 1.4em;
132 | }
133 |
134 | div.admonition {
135 | background: #fafafa;
136 | margin: 20px -30px;
137 | padding: 10px 30px;
138 | border-top: 1px solid #ccc;
139 | border-bottom: 1px solid #ccc;
140 | }
141 |
142 | div.admonition p.admonition-title {
143 | font-family: 'Garamond', 'Georgia', serif;
144 | font-weight: normal;
145 | font-size: 24px;
146 | margin: 0 0 10px 0;
147 | padding: 0;
148 | line-height: 1;
149 | }
150 |
151 | div.admonition p.last {
152 | margin-bottom: 0;
153 | }
154 |
155 | div.highlight{
156 | background-color: white;
157 | }
158 |
159 | dt:target, .highlight {
160 | background: #FAF3E8;
161 | }
162 |
163 | div.note {
164 | background-color: #eee;
165 | border: 1px solid #ccc;
166 | }
167 |
168 | div.seealso {
169 | background-color: #ffc;
170 | border: 1px solid #ff6;
171 | }
172 |
173 | div.topic {
174 | background-color: #eee;
175 | }
176 |
177 | div.warning {
178 | background-color: #ffe4e4;
179 | border: 1px solid #f66;
180 | }
181 |
182 | p.admonition-title {
183 | display: inline;
184 | }
185 |
186 | p.admonition-title:after {
187 | content: ":";
188 | }
189 |
190 | pre, tt {
191 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
192 | font-size: 0.85em;
193 | }
194 |
195 | img.screenshot {
196 | }
197 |
198 | tt.descname, tt.descclassname {
199 | font-size: 0.95em;
200 | }
201 |
202 | tt.descname {
203 | padding-right: 0.08em;
204 | }
205 |
206 | img.screenshot {
207 | -moz-box-shadow: 2px 2px 4px #eee;
208 | -webkit-box-shadow: 2px 2px 4px #eee;
209 | box-shadow: 2px 2px 4px #eee;
210 | }
211 |
212 | table.docutils {
213 | border: 1px solid #888;
214 | -moz-box-shadow: 2px 2px 4px #eee;
215 | -webkit-box-shadow: 2px 2px 4px #eee;
216 | box-shadow: 2px 2px 4px #eee;
217 | }
218 |
219 | table.docutils td, table.docutils th {
220 | border: 1px solid #888;
221 | padding: 0.25em 0.7em;
222 | }
223 |
224 | table.field-list, table.footnote {
225 | border: none;
226 | -moz-box-shadow: none;
227 | -webkit-box-shadow: none;
228 | box-shadow: none;
229 | }
230 |
231 | table.footnote {
232 | margin: 15px 0;
233 | width: 100%;
234 | border: 1px solid #eee;
235 | }
236 |
237 | table.field-list th {
238 | padding: 0 0.8em 0 0;
239 | }
240 |
241 | table.field-list td {
242 | padding: 0;
243 | }
244 |
245 | table.footnote td {
246 | padding: 0.5em;
247 | }
248 |
249 | dl {
250 | margin: 0;
251 | padding: 0;
252 | }
253 |
254 | dl dd {
255 | margin-left: 30px;
256 | }
257 |
258 | pre {
259 | padding: 0;
260 | margin: 15px -30px;
261 | padding: 8px;
262 | line-height: 1.3em;
263 | padding: 7px 30px;
264 | background: #eee;
265 | border-radius: 2px;
266 | -moz-border-radius: 2px;
267 | -webkit-border-radius: 2px;
268 | }
269 |
270 | dl pre {
271 | margin-left: -60px;
272 | padding-left: 60px;
273 | }
274 |
275 | tt {
276 | background-color: #ecf0f3;
277 | color: #222;
278 | /* padding: 1px 2px; */
279 | }
280 |
281 | tt.xref, a tt {
282 | background-color: #FBFBFB;
283 | }
284 |
285 | a:hover tt {
286 | background: #EEE;
287 | }
288 |
--------------------------------------------------------------------------------
/docs/_themes/flask_small/theme.conf:
--------------------------------------------------------------------------------
1 | [theme]
2 | inherit = basic
3 | stylesheet = flasky.css
4 | nosidebar = true
5 | pygments_style = flask_theme_support.FlaskyStyle
6 |
7 | [options]
8 | index_logo = ''
9 | index_logo_height = 120px
10 | github_fork = ''
11 |
--------------------------------------------------------------------------------
/docs/_themes/flask_theme_support.py:
--------------------------------------------------------------------------------
1 | # flasky extensions. flasky pygments style based on tango style
2 | from pygments.style import Style
3 | from pygments.token import Keyword, Name, Comment, String, Error, \
4 | Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
5 |
6 |
7 | class FlaskyStyle(Style):
8 | background_color = "#f8f8f8"
9 | default_style = ""
10 |
11 | styles = {
12 | # No corresponding class for the following:
13 | #Text: "", # class: ''
14 | Whitespace: "underline #f8f8f8", # class: 'w'
15 | Error: "#a40000 border:#ef2929", # class: 'err'
16 | Other: "#000000", # class 'x'
17 |
18 | Comment: "italic #8f5902", # class: 'c'
19 | Comment.Preproc: "noitalic", # class: 'cp'
20 |
21 | Keyword: "bold #004461", # class: 'k'
22 | Keyword.Constant: "bold #004461", # class: 'kc'
23 | Keyword.Declaration: "bold #004461", # class: 'kd'
24 | Keyword.Namespace: "bold #004461", # class: 'kn'
25 | Keyword.Pseudo: "bold #004461", # class: 'kp'
26 | Keyword.Reserved: "bold #004461", # class: 'kr'
27 | Keyword.Type: "bold #004461", # class: 'kt'
28 |
29 | Operator: "#582800", # class: 'o'
30 | Operator.Word: "bold #004461", # class: 'ow' - like keywords
31 |
32 | Punctuation: "bold #000000", # class: 'p'
33 |
34 | # because special names such as Name.Class, Name.Function, etc.
35 | # are not recognized as such later in the parsing, we choose them
36 | # to look the same as ordinary variables.
37 | Name: "#000000", # class: 'n'
38 | Name.Attribute: "#c4a000", # class: 'na' - to be revised
39 | Name.Builtin: "#004461", # class: 'nb'
40 | Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
41 | Name.Class: "#000000", # class: 'nc' - to be revised
42 | Name.Constant: "#000000", # class: 'no' - to be revised
43 | Name.Decorator: "#888", # class: 'nd' - to be revised
44 | Name.Entity: "#ce5c00", # class: 'ni'
45 | Name.Exception: "bold #cc0000", # class: 'ne'
46 | Name.Function: "#000000", # class: 'nf'
47 | Name.Property: "#000000", # class: 'py'
48 | Name.Label: "#f57900", # class: 'nl'
49 | Name.Namespace: "#000000", # class: 'nn' - to be revised
50 | Name.Other: "#000000", # class: 'nx'
51 | Name.Tag: "bold #004461", # class: 'nt' - like a keyword
52 | Name.Variable: "#000000", # class: 'nv' - to be revised
53 | Name.Variable.Class: "#000000", # class: 'vc' - to be revised
54 | Name.Variable.Global: "#000000", # class: 'vg' - to be revised
55 | Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
56 |
57 | Number: "#990000", # class: 'm'
58 |
59 | Literal: "#000000", # class: 'l'
60 | Literal.Date: "#000000", # class: 'ld'
61 |
62 | String: "#4e9a06", # class: 's'
63 | String.Backtick: "#4e9a06", # class: 'sb'
64 | String.Char: "#4e9a06", # class: 'sc'
65 | String.Doc: "italic #8f5902", # class: 'sd' - like a comment
66 | String.Double: "#4e9a06", # class: 's2'
67 | String.Escape: "#4e9a06", # class: 'se'
68 | String.Heredoc: "#4e9a06", # class: 'sh'
69 | String.Interpol: "#4e9a06", # class: 'si'
70 | String.Other: "#4e9a06", # class: 'sx'
71 | String.Regex: "#4e9a06", # class: 'sr'
72 | String.Single: "#4e9a06", # class: 's1'
73 | String.Symbol: "#4e9a06", # class: 'ss'
74 |
75 | Generic: "#000000", # class: 'g'
76 | Generic.Deleted: "#a40000", # class: 'gd'
77 | Generic.Emph: "italic #000000", # class: 'ge'
78 | Generic.Error: "#ef2929", # class: 'gr'
79 | Generic.Heading: "bold #000080", # class: 'gh'
80 | Generic.Inserted: "#00A000", # class: 'gi'
81 | Generic.Output: "#888", # class: 'go'
82 | Generic.Prompt: "#745334", # class: 'gp'
83 | Generic.Strong: "bold #000000", # class: 'gs'
84 | Generic.Subheading: "bold #800080", # class: 'gu'
85 | Generic.Traceback: "bold #a40000", # class: 'gt'
86 | }
87 |
--------------------------------------------------------------------------------
/docs/conf.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #
3 | # initpy documentation build configuration file, created by
4 | # sphinx-quickstart on Mon Feb 23 17:21:56 2015.
5 | #
6 | # This file is execfile()d with the current directory set to its
7 | # containing dir.
8 | #
9 | # Note that not all possible configuration values are present in this
10 | # autogenerated file.
11 | #
12 | # All configuration values have a default; values that are commented out
13 | # serve to show the default.
14 |
15 | import sys
16 | import os
17 |
18 | # If extensions (or modules to document with autodoc) are in another directory,
19 | # add these directories to sys.path here. If the directory is relative to the
20 | # documentation root, use os.path.abspath to make it absolute, like shown here.
21 | sys.path.append(os.path.abspath('_themes'))
22 |
23 |
24 | # -- General configuration ------------------------------------------------
25 |
26 | # If your documentation needs a minimal Sphinx version, state it here.
27 | #needs_sphinx = '1.0'
28 |
29 | # Add any Sphinx extension module names here, as strings. They can be
30 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
31 | # ones.
32 | extensions = []
33 |
34 | # Add any paths that contain templates here, relative to this directory.
35 | templates_path = ['_templates']
36 |
37 | # The suffix of source filenames.
38 | source_suffix = '.rst'
39 |
40 | # The encoding of source files.
41 | #source_encoding = 'utf-8-sig'
42 |
43 | # The master toctree document.
44 | master_doc = 'index'
45 |
46 | # General information about the project.
47 | project = u'initpy'
48 | copyright = u'2015, Ayun Park'
49 |
50 | # The version info for the project you're documenting, acts as replacement for
51 | # |version| and |release|, also used in various other places throughout the
52 | # built documents.
53 | #
54 | # The short X.Y version.
55 | version = '0.2.1'
56 | # The full version, including alpha/beta/rc tags.
57 | release = '0.2.1'
58 |
59 | # The language for content autogenerated by Sphinx. Refer to documentation
60 | # for a list of supported languages.
61 | #language = None
62 |
63 | # There are two options for replacing |today|: either, you set today to some
64 | # non-false value, then it is used:
65 | #today = ''
66 | # Else, today_fmt is used as the format for a strftime call.
67 | #today_fmt = '%B %d, %Y'
68 |
69 | # List of patterns, relative to source directory, that match files and
70 | # directories to ignore when looking for source files.
71 | exclude_patterns = ['_build']
72 |
73 | # The reST default role (used for this markup: `text`) to use for all
74 | # documents.
75 | #default_role = None
76 |
77 | # If true, '()' will be appended to :func: etc. cross-reference text.
78 | #add_function_parentheses = True
79 |
80 | # If true, the current module name will be prepended to all description
81 | # unit titles (such as .. function::).
82 | #add_module_names = True
83 |
84 | # If true, sectionauthor and moduleauthor directives will be shown in the
85 | # output. They are ignored by default.
86 | #show_authors = False
87 |
88 | # The name of the Pygments (syntax highlighting) style to use.
89 | pygments_style = 'sphinx'
90 |
91 | # A list of ignored prefixes for module index sorting.
92 | #modindex_common_prefix = []
93 |
94 | # If true, keep warnings as "system message" paragraphs in the built documents.
95 | #keep_warnings = False
96 |
97 |
98 | # -- Options for HTML output ----------------------------------------------
99 |
100 | # The theme to use for HTML and HTML Help pages. See the documentation for
101 | # a list of builtin themes.
102 | html_theme = 'flask'
103 |
104 | # Theme options are theme-specific and customize the look and feel of a theme
105 | # further. For a list of options available for each theme, see the
106 | # documentation.
107 | html_theme_options = {'index_logo': ''}#{'index_logo': '', 'github_fork': 'Parkayun/initpy'}
108 |
109 | # Add any paths that contain custom themes here, relative to this directory.
110 | html_theme_path = ['_themes']
111 |
112 | # The name for this set of Sphinx documents. If None, it defaults to
113 | # " v documentation".
114 | #html_title = None
115 |
116 | # A shorter title for the navigation bar. Default is the same as html_title.
117 | #html_short_title = None
118 |
119 | # The name of an image file (relative to this directory) to place at the top
120 | # of the sidebar.
121 | #html_logo = None
122 |
123 | # The name of an image file (within the static path) to use as favicon of the
124 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
125 | # pixels large.
126 | #html_favicon = None
127 |
128 | # Add any paths that contain custom static files (such as style sheets) here,
129 | # relative to this directory. They are copied after the builtin static files,
130 | # so a file named "default.css" will overwrite the builtin "default.css".
131 | html_static_path = ['_static']
132 |
133 | # Add any extra paths that contain custom files (such as robots.txt or
134 | # .htaccess) here, relative to this directory. These files are copied
135 | # directly to the root of the documentation.
136 | #html_extra_path = []
137 |
138 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
139 | # using the given strftime format.
140 | #html_last_updated_fmt = '%b %d, %Y'
141 |
142 | # If true, SmartyPants will be used to convert quotes and dashes to
143 | # typographically correct entities.
144 | #html_use_smartypants = True
145 |
146 | # Custom sidebar templates, maps document names to template names.
147 | #html_sidebars = {}
148 |
149 | # Additional templates that should be rendered to pages, maps page names to
150 | # template names.
151 | #html_additional_pages = {}
152 |
153 | # If false, no module index is generated.
154 | #html_domain_indices = True
155 |
156 | # If false, no index is generated.
157 | #html_use_index = True
158 |
159 | # If true, the index is split into individual pages for each letter.
160 | #html_split_index = False
161 |
162 | # If true, links to the reST sources are added to the pages.
163 | #html_show_sourcelink = True
164 |
165 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
166 | #html_show_sphinx = True
167 |
168 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
169 | #html_show_copyright = True
170 |
171 | # If true, an OpenSearch description file will be output, and all pages will
172 | # contain a tag referring to it. The value of this option must be the
173 | # base URL from which the finished HTML is served.
174 | #html_use_opensearch = ''
175 |
176 | # This is the file name suffix for HTML files (e.g. ".xhtml").
177 | #html_file_suffix = None
178 |
179 | # Output file base name for HTML help builder.
180 | htmlhelp_basename = 'initpydoc'
181 |
182 |
183 | # -- Options for LaTeX output ---------------------------------------------
184 |
185 | latex_elements = {
186 | # The paper size ('letterpaper' or 'a4paper').
187 | #'papersize': 'letterpaper',
188 |
189 | # The font size ('10pt', '11pt' or '12pt').
190 | #'pointsize': '10pt',
191 |
192 | # Additional stuff for the LaTeX preamble.
193 | #'preamble': '',
194 | }
195 |
196 | # Grouping the document tree into LaTeX files. List of tuples
197 | # (source start file, target name, title,
198 | # author, documentclass [howto, manual, or own class]).
199 | latex_documents = [
200 | ('index', 'initpy.tex', u'initpy Documentation',
201 | u'Ayun Park', 'manual'),
202 | ]
203 |
204 | # The name of an image file (relative to this directory) to place at the top of
205 | # the title page.
206 | #latex_logo = None
207 |
208 | # For "manual" documents, if this is true, then toplevel headings are parts,
209 | # not chapters.
210 | #latex_use_parts = False
211 |
212 | # If true, show page references after internal links.
213 | #latex_show_pagerefs = False
214 |
215 | # If true, show URL addresses after external links.
216 | #latex_show_urls = False
217 |
218 | # Documents to append as an appendix to all manuals.
219 | #latex_appendices = []
220 |
221 | # If false, no module index is generated.
222 | #latex_domain_indices = True
223 |
224 |
225 | # -- Options for manual page output ---------------------------------------
226 |
227 | # One entry per manual page. List of tuples
228 | # (source start file, name, description, authors, manual section).
229 | man_pages = [
230 | ('index', 'initpy', u'initpy Documentation',
231 | [u'Ayun Park'], 1)
232 | ]
233 |
234 | # If true, show URL addresses after external links.
235 | #man_show_urls = False
236 |
237 |
238 | # -- Options for Texinfo output -------------------------------------------
239 |
240 | # Grouping the document tree into Texinfo files. List of tuples
241 | # (source start file, target name, title, author,
242 | # dir menu entry, description, category)
243 | texinfo_documents = [
244 | ('index', 'initpy', u'initpy Documentation',
245 | u'Ayun Park', 'initpy', 'One line description of project.',
246 | 'Miscellaneous'),
247 | ]
248 |
249 | # Documents to append as an appendix to all manuals.
250 | #texinfo_appendices = []
251 |
252 | # If false, no module index is generated.
253 | #texinfo_domain_indices = True
254 |
255 | # How to display URL addresses: 'footnote', 'no', or 'inline'.
256 | #texinfo_show_urls = 'footnote'
257 |
258 | # If true, do not generate a @detailmenu in the "Top" node's menu.
259 | #texinfo_no_detailmenu = False
260 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | initpy
2 | ======
3 |
4 | .. image:: https://pypip.in/v/initpy/badge.svg?style=flat
5 | :target: https://pypi.python.org/pypi/initpy/
6 | :alt: Latest Version
7 | .. image:: https://pypip.in/download/initpy/badge.svg?period=month
8 | :target: https://pypi.python.org/pypi/initpy/
9 | :alt: Downloads
10 | .. image:: https://readthedocs.org/projects/initpy/badge/?version=latest
11 | :target: http://initpy.readthedocs.org/en/latest/
12 | :alt: Documentation Status
13 |
14 | Generate Python Project
15 |
16 |
17 | Installing
18 | ~~~~~~~~~~
19 |
20 | initpy is available in `PyPI `_.
21 |
22 | .. sourcecode:: bash
23 |
24 | ~ $ pip install initpy
25 |
26 | Install latest works from `Github `_.
27 |
28 | .. sourcecode:: bash
29 |
30 | ~ $ pip install git+git://github.com/Parkayun/initpy.git
31 |
32 |
33 | Quick Start
34 | ~~~~~~~~~~~
35 |
36 | .. sourcecode:: bash
37 |
38 | ~ $ init.py foo.py # Create single Python file.
39 | ~ $ init.py foo/ # Create Python Module.
40 | ~ $ init.py -f foo # Create Flask project.
41 | ~ $ init.py -tw foo # Create Tornado web project.
42 | ~ $ init.py -fc foo # Create Falcon project.
43 | ~ $ init.py -hd flask foo # Create project from 3rd-Party template.
44 |
45 |
46 | Options
47 | ~~~~~~~
48 |
49 | .. toctree::
50 | :maxdepth: 2
51 |
52 | options/index
53 |
54 |
55 | 3rd-Party Template
56 | ~~~~~~~~~~~~~~~~~~
57 |
58 | .. toctree::
59 | :maxdepth: 2
60 |
61 | 3rd_party/index
62 |
63 |
64 | Author and License
65 | ~~~~~~~~~~~~~~~~~~
66 |
67 | initpy is written by `Ayun Park`_ and distributed under `MIT License`_.
68 |
69 | .. _Ayun Park: http://www.parkayun.kr
70 | .. _MIT License: https://github.com/Parkayun/initpy/blob/master/LICENSE
71 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | REM Command file for Sphinx documentation
4 |
5 | if "%SPHINXBUILD%" == "" (
6 | set SPHINXBUILD=sphinx-build
7 | )
8 | set BUILDDIR=_build
9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
10 | set I18NSPHINXOPTS=%SPHINXOPTS% .
11 | if NOT "%PAPER%" == "" (
12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
14 | )
15 |
16 | if "%1" == "" goto help
17 |
18 | if "%1" == "help" (
19 | :help
20 | echo.Please use `make ^` where ^ is one of
21 | echo. html to make standalone HTML files
22 | echo. dirhtml to make HTML files named index.html in directories
23 | echo. singlehtml to make a single large HTML file
24 | echo. pickle to make pickle files
25 | echo. json to make JSON files
26 | echo. htmlhelp to make HTML files and a HTML help project
27 | echo. qthelp to make HTML files and a qthelp project
28 | echo. devhelp to make HTML files and a Devhelp project
29 | echo. epub to make an epub
30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
31 | echo. text to make text files
32 | echo. man to make manual pages
33 | echo. texinfo to make Texinfo files
34 | echo. gettext to make PO message catalogs
35 | echo. changes to make an overview over all changed/added/deprecated items
36 | echo. xml to make Docutils-native XML files
37 | echo. pseudoxml to make pseudoxml-XML files for display purposes
38 | echo. linkcheck to check all external links for integrity
39 | echo. doctest to run all doctests embedded in the documentation if enabled
40 | goto end
41 | )
42 |
43 | if "%1" == "clean" (
44 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
45 | del /q /s %BUILDDIR%\*
46 | goto end
47 | )
48 |
49 |
50 | %SPHINXBUILD% 2> nul
51 | if errorlevel 9009 (
52 | echo.
53 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
54 | echo.installed, then set the SPHINXBUILD environment variable to point
55 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
56 | echo.may add the Sphinx directory to PATH.
57 | echo.
58 | echo.If you don't have Sphinx installed, grab it from
59 | echo.http://sphinx-doc.org/
60 | exit /b 1
61 | )
62 |
63 | if "%1" == "html" (
64 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
65 | if errorlevel 1 exit /b 1
66 | echo.
67 | echo.Build finished. The HTML pages are in %BUILDDIR%/html.
68 | goto end
69 | )
70 |
71 | if "%1" == "dirhtml" (
72 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
73 | if errorlevel 1 exit /b 1
74 | echo.
75 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
76 | goto end
77 | )
78 |
79 | if "%1" == "singlehtml" (
80 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
81 | if errorlevel 1 exit /b 1
82 | echo.
83 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
84 | goto end
85 | )
86 |
87 | if "%1" == "pickle" (
88 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
89 | if errorlevel 1 exit /b 1
90 | echo.
91 | echo.Build finished; now you can process the pickle files.
92 | goto end
93 | )
94 |
95 | if "%1" == "json" (
96 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
97 | if errorlevel 1 exit /b 1
98 | echo.
99 | echo.Build finished; now you can process the JSON files.
100 | goto end
101 | )
102 |
103 | if "%1" == "htmlhelp" (
104 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
105 | if errorlevel 1 exit /b 1
106 | echo.
107 | echo.Build finished; now you can run HTML Help Workshop with the ^
108 | .hhp project file in %BUILDDIR%/htmlhelp.
109 | goto end
110 | )
111 |
112 | if "%1" == "qthelp" (
113 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
114 | if errorlevel 1 exit /b 1
115 | echo.
116 | echo.Build finished; now you can run "qcollectiongenerator" with the ^
117 | .qhcp project file in %BUILDDIR%/qthelp, like this:
118 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\flask-init.qhcp
119 | echo.To view the help file:
120 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\flask-init.ghc
121 | goto end
122 | )
123 |
124 | if "%1" == "devhelp" (
125 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
126 | if errorlevel 1 exit /b 1
127 | echo.
128 | echo.Build finished.
129 | goto end
130 | )
131 |
132 | if "%1" == "epub" (
133 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
134 | if errorlevel 1 exit /b 1
135 | echo.
136 | echo.Build finished. The epub file is in %BUILDDIR%/epub.
137 | goto end
138 | )
139 |
140 | if "%1" == "latex" (
141 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
142 | if errorlevel 1 exit /b 1
143 | echo.
144 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
145 | goto end
146 | )
147 |
148 | if "%1" == "latexpdf" (
149 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
150 | cd %BUILDDIR%/latex
151 | make all-pdf
152 | cd %BUILDDIR%/..
153 | echo.
154 | echo.Build finished; the PDF files are in %BUILDDIR%/latex.
155 | goto end
156 | )
157 |
158 | if "%1" == "latexpdfja" (
159 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
160 | cd %BUILDDIR%/latex
161 | make all-pdf-ja
162 | cd %BUILDDIR%/..
163 | echo.
164 | echo.Build finished; the PDF files are in %BUILDDIR%/latex.
165 | goto end
166 | )
167 |
168 | if "%1" == "text" (
169 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
170 | if errorlevel 1 exit /b 1
171 | echo.
172 | echo.Build finished. The text files are in %BUILDDIR%/text.
173 | goto end
174 | )
175 |
176 | if "%1" == "man" (
177 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
178 | if errorlevel 1 exit /b 1
179 | echo.
180 | echo.Build finished. The manual pages are in %BUILDDIR%/man.
181 | goto end
182 | )
183 |
184 | if "%1" == "texinfo" (
185 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
186 | if errorlevel 1 exit /b 1
187 | echo.
188 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
189 | goto end
190 | )
191 |
192 | if "%1" == "gettext" (
193 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
194 | if errorlevel 1 exit /b 1
195 | echo.
196 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
197 | goto end
198 | )
199 |
200 | if "%1" == "changes" (
201 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
202 | if errorlevel 1 exit /b 1
203 | echo.
204 | echo.The overview file is in %BUILDDIR%/changes.
205 | goto end
206 | )
207 |
208 | if "%1" == "linkcheck" (
209 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
210 | if errorlevel 1 exit /b 1
211 | echo.
212 | echo.Link check complete; look for any errors in the above output ^
213 | or in %BUILDDIR%/linkcheck/output.txt.
214 | goto end
215 | )
216 |
217 | if "%1" == "doctest" (
218 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
219 | if errorlevel 1 exit /b 1
220 | echo.
221 | echo.Testing of doctests in the sources finished, look at the ^
222 | results in %BUILDDIR%/doctest/output.txt.
223 | goto end
224 | )
225 |
226 | if "%1" == "xml" (
227 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
228 | if errorlevel 1 exit /b 1
229 | echo.
230 | echo.Build finished. The XML files are in %BUILDDIR%/xml.
231 | goto end
232 | )
233 |
234 | if "%1" == "pseudoxml" (
235 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
236 | if errorlevel 1 exit /b 1
237 | echo.
238 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
239 | goto end
240 | )
241 |
242 | :end
243 |
--------------------------------------------------------------------------------
/docs/options/index.rst:
--------------------------------------------------------------------------------
1 | Create various project
2 | ======================
3 |
4 | flask
5 | -----
6 |
7 | flask option can easily create `Flask `_ project.
8 |
9 | Can use this option with --flask or -f.
10 |
11 | .. sourcecode:: bash
12 |
13 | ~ $ init.py --flask foo
14 | Please input base module name [common]: bar
15 |
16 | Successfully created foo!
17 | You can install "pip install -r requirements/dev.txt"
18 | You can run "python manage.py run"
19 | ~ $ tree foo/
20 | foo/
21 | ├── app
22 | │ ├── __init__.py
23 | │ ├── bar
24 | │ │ ├── __init__.py
25 | │ │ ├── models.py
26 | │ │ └── views.py
27 | │ ├── static
28 | │ └── templates
29 | │ ├── bar
30 | │ │ └── index.html
31 | │ └── base.html
32 | ├── manage.py
33 | └── requirements
34 | └── dev.txt
35 |
36 | tornado web
37 | -----------
38 |
39 | tornado web option can easily create `Tornado `_ web project.
40 |
41 | Can use this option with --tornado-web or -tw.
42 |
43 | .. sourcecode:: bash
44 |
45 | ~ $ init.py --tornado-web foo
46 | Please input base module name [common]: bar
47 |
48 | Successfully created foo!
49 | You can install "pip install -r requirements/dev.txt"
50 | You can run "python app.py"
51 | ~ $ tree foo/
52 | foo/
53 | ├── app.py
54 | ├── handlers
55 | │ ├── __init__.py
56 | │ └── bar.py
57 | ├── requirements
58 | │ └── dev.txt
59 | └── urls.py
60 |
61 |
62 | falcon
63 | ------
64 |
65 | falcon option can easily create `falcon `_ project.
66 |
67 | Can use this option with --falcon or -fc.
68 |
69 | .. sourcecode:: bash
70 |
71 | ~ $ init.py --falcon foo
72 | Please input base module name [common]: bar
73 |
74 | Successfully created foo!
75 | You can install "pip install -r requirements/dev.txt"
76 | You can run "python manage.py"
77 | ~ $ tree foo/
78 | foo/
79 | ├── app
80 | │ ├── __init__.py
81 | │ ├── middleware
82 | │ │ └── __init__.py
83 | │ ├── models
84 | │ │ ├── __init__.py
85 | │ │ └── bar.py
86 | │ └── resources
87 | │ ├── __init__.py
88 | │ └── bar.py
89 | ├── manage.py
90 | └── requirements
91 | └── dev.txt
92 |
93 |
94 | hosted
95 | ------
96 |
97 | hosted option can create project from 3rd-Party template.
98 |
99 | Can use this option with --hosted or -hd.
100 |
101 | .. sourcecode:: bash
102 |
103 | ~ $ init.py --hosted flask foo
104 | Downloading flask
105 | Successfully created foo!
106 |
--------------------------------------------------------------------------------
/initpy/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
--------------------------------------------------------------------------------
/initpy/compact.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 | import sys
4 |
5 |
6 | PY_VER = sys.version_info[0]
7 |
8 | if PY_VER == 2:
9 | from StringIO import StringIO
10 | input = raw_input
11 | else:
12 | from io import StringIO
13 | input = input
14 |
--------------------------------------------------------------------------------
/initpy/creator.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 | import functools
4 | import inspect
5 | import os
6 |
7 | from initpy.templates import blank, falcon, flask, tornado_web
8 | from initpy.exceptions import RootPathDoesNotExists
9 |
10 |
11 | def name_validator(func):
12 | @functools.wraps(func)
13 | def wrapper(*args, **kwargs):
14 | func_args = inspect.getcallargs(func, *args, **kwargs)
15 |
16 | if func_args.get('validate'):
17 | _filter = "!@#$%^&*()-+=[]{}|\"'."
18 | name = func_args.get('name').replace('.py', '')\
19 | .replace('.html', '')\
20 | .replace('.txt', '')
21 |
22 | if (len(list(set(list(name)).intersection(list(_filter)))) > 0
23 | or name[0].isdigit()):
24 | title = func.__name__.split('_')[1].title()
25 | raise globals()['Invalid' + title + 'Name']
26 |
27 | return func(*args, **kwargs)
28 | return wrapper
29 |
30 |
31 | class Creator(object):
32 |
33 | errors = []
34 | root_path = None
35 |
36 | def __init__(self, root_path):
37 | if not os.path.isdir(root_path):
38 | raise RootPathDoesNotExists
39 | self.root_path = root_path
40 |
41 | @name_validator
42 | def create_file(self, _path, name, template, validate=True):
43 | file_path = os.path.join(_path, name)
44 | with open(file_path, 'w') as _file:
45 | _file.write(template)
46 |
47 | @name_validator
48 | def create_folder(self, _path, name, validate=True):
49 | try:
50 | folder_path = os.path.join(_path, name)
51 | os.mkdir(folder_path)
52 | except OSError:
53 | self.errors.append('Creating skipped: '+name+' already exists')
54 |
55 | def create_module(self, _path, name, template=blank.python):
56 | self.create_folder(_path, name)
57 |
58 | module_path = os.path.join(_path, name)
59 | self.create_file(module_path, '__init__.py', template, False)
60 |
61 |
62 | class FlaskCreator(Creator):
63 |
64 | def create_app(self, _path, module):
65 | self.create_module(_path, "app",
66 | flask.app_init.substitute(module=module))
67 | app_path = os.path.join(_path, "app")
68 |
69 | self.create_folder(app_path, "static")
70 | self.create_templates(app_path, module)
71 | self.create_app_module(app_path, module)
72 |
73 | def create_app_module(self, _path, name):
74 | self.create_folder(_path, name)
75 | module_path = os.path.join(_path, name)
76 |
77 | self.create_file(module_path, "__init__.py",
78 | flask.module_init.substitute(module=name), False)
79 | self.create_file(module_path, "views.py",
80 | flask.module_views.substitute(module=name))
81 | self.create_file(module_path, "models.py", blank.python)
82 |
83 | def create_templates(self, _path, module):
84 | self.create_folder(_path, "templates")
85 | template_path = os.path.join(_path, "templates")
86 |
87 | self.create_file(template_path, "base.html", flask.base_html)
88 | self.create_folder(template_path, module)
89 | self.create_file(os.path.join(template_path, module), "index.html",
90 | flask.module_html)
91 |
92 | def create_requirements(self, _path):
93 | self.create_folder(_path, "requirements")
94 | self.create_file(os.path.join(_path, "requirements"), "dev.txt",
95 | flask.requirements)
96 |
97 | def create_project(self, name, module):
98 | self.create_folder(self.root_path, name)
99 | project_path = os.path.join(self.root_path, name)
100 |
101 | self.create_file(project_path, "manage.py", flask.manager)
102 | self.create_app(project_path, module)
103 | self.create_requirements(project_path)
104 |
105 |
106 | class TornadoCreator(Creator):
107 |
108 | def create_handlers(self, _path, name):
109 | self.create_module(_path, "handlers")
110 | handlers_path = os.path.join(_path, "handlers")
111 | self.create_file(handlers_path, name+".py", tornado_web.tornado_handler)
112 |
113 | def create_requirements(self, _path):
114 | self.create_folder(_path, "requirements")
115 | self.create_file(os.path.join(_path, "requirements"), "dev.txt",
116 | tornado_web.requirements)
117 |
118 | def create_project(self, name, module):
119 | self.create_folder(self.root_path, name)
120 | project_path = os.path.join(self.root_path, name)
121 |
122 | self.create_file(project_path, "app.py", tornado_web.tornado_app)
123 | self.create_file(project_path, "urls.py",
124 | tornado_web.tornado_urls.substitute(module=module))
125 |
126 | self.create_handlers(project_path, module)
127 | self.create_requirements(project_path)
128 |
129 |
130 | class FalconCreator(Creator):
131 |
132 | def create_app(self, _path, module):
133 | args = dict(module=module, module_title=module.title())
134 |
135 | self.create_module(_path, "app",
136 | falcon.app_init.safe_substitute(args))
137 | app_path = os.path.join(_path, "app")
138 |
139 | self.create_middleware(app_path)
140 | self.create_models(app_path, module)
141 | self.create_app_module(app_path, module)
142 |
143 | def create_app_module(self, _path, name):
144 | args = dict(module=name, module_title=name.title())
145 |
146 | self.create_folder(_path, 'resources')
147 | module_path = os.path.join(_path, 'resources')
148 |
149 | self.create_file(module_path, "__init__.py",
150 | falcon.resource_init.safe_substitute(args), False)
151 | self.create_file(module_path, "{}.py".format(name),
152 | falcon.resource_controller.safe_substitute(args))
153 |
154 | def create_models(self, _path, name):
155 | self.create_module(_path, "models")
156 | models_path = os.path.join(_path, "models")
157 | self.create_file(models_path, "__init__.py", blank.python)
158 | self.create_file(models_path, "{}.py".format(name), blank.python)
159 |
160 | def create_middleware(self, _path):
161 | self.create_module(_path, "middleware")
162 | middleware_path = os.path.join(_path, "middleware")
163 | self.create_file(middleware_path, "__init__.py", blank.python)
164 |
165 | def create_requirements(self, _path):
166 | self.create_folder(_path, "requirements")
167 | self.create_file(os.path.join(_path, "requirements"), "dev.txt",
168 | falcon.requirements)
169 |
170 | def create_project(self, name, module):
171 | self.create_folder(self.root_path, name)
172 | project_path = os.path.join(self.root_path, name)
173 |
174 | self.create_file(project_path, "manage.py", falcon.manager)
175 | self.create_app(project_path, module)
176 | self.create_requirements(project_path)
177 |
178 |
179 | def downloader(args):
180 | url = args.download
181 | from urllib2 import urlopen, HTTPError
182 | try:
183 | res = urlopen(url)
184 | except HTTPError:
185 | from initpy.prompt import color_print
186 | color_print("Wrong downloadable url!", "red")
187 | return
188 | from initpy.compact import StringIO
189 | from zipfile import ZipFile, BadZipfile
190 | try:
191 | template_zip = ZipFile(StringIO(res.read()))
192 | except BadZipfile:
193 | from initpy.prompt import color_print
194 | color_print("initpy only support zip file!", "red")
195 | return
196 | from os import path, getcwd, mkdir
197 | proj_path = path.join(getcwd(), args.name)
198 | try:
199 | mkdir(proj_path)
200 | except OSError:
201 | # Folder Exists
202 | pass
203 | zip_root = template_zip.namelist()[0]
204 | for fn in template_zip.namelist()[1:]:
205 | file_name = fn.replace(zip_root, '')
206 | file_path = path.join(proj_path, file_name)
207 | if file_path.endswith('/'):
208 | try:
209 | mkdir(file_path)
210 | except OSError:
211 | # Folder Exists
212 | pass
213 | else:
214 | _file = open(file_path, 'w')
215 | _file.write(template_zip.read(fn))
216 | _file.close()
217 |
--------------------------------------------------------------------------------
/initpy/exceptions.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | class InvalidFileName(Exception):
5 | """Base class for Invalid File name"""
6 |
7 |
8 | class InvalidFolderName(Exception):
9 | """Base class for Invalid Folder name"""
10 |
11 |
12 | class RootPathDoesNotExists(Exception):
13 | """Base class for Root Path Does Not Exists"""
14 |
--------------------------------------------------------------------------------
/initpy/prompt.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 | from __future__ import absolute_import, print_function
4 |
5 | from initpy.compact import input
6 |
7 |
8 | COLORS = {
9 | 'reset': '\033[0m',
10 | 'red': '\033[31m',
11 | 'yellow': '\033[33m',
12 | 'blue': '\033[34m',
13 | 'magenta': '\033[35m'
14 | }
15 |
16 |
17 | def get_color_text(color, text):
18 | return "".join((color, text, COLORS['reset']))
19 |
20 |
21 | def color_input(text, color):
22 | return input(get_color_text(COLORS[color], text))
23 |
24 |
25 | def color_print(text, color):
26 | print(get_color_text(COLORS[color], text))
27 |
--------------------------------------------------------------------------------
/initpy/run.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 | from __future__ import absolute_import
4 |
5 | from os import getcwd
6 | import argparse
7 |
8 | from initpy.prompt import color_print
9 |
10 |
11 | def main():
12 | parser = argparse.ArgumentParser()
13 | parser.add_argument('--flask', '-f', action='store_true')
14 | parser.add_argument('--tornado-web', '-tw', action='store_true')
15 | parser.add_argument('--falcon', '-fc', action='store_true')
16 | parser.add_argument('--hosted', '-hd', type=str)
17 | parser.add_argument('--download', '-d', type=str)
18 | parser.add_argument('name', metavar='name', type=str)
19 | args = parser.parse_args()
20 |
21 | if args.name != '':
22 | if args.flask and args.tornado_web and args.falcon and args.download \
23 | and args.hosted:
24 | color_print('Please use one option', 'red')
25 | parser.print_help()
26 | return
27 |
28 | if args.flask or args.tornado_web or args.falcon:
29 | end_message = "You can install \"pip install -r requirements/dev.txt\""
30 |
31 | if args.flask:
32 | end_message += "\nYou can run \"python manage.py run\""
33 | from initpy.creator import FlaskCreator
34 | creator = FlaskCreator(getcwd())
35 | elif args.tornado_web:
36 | end_message += "\nYou can run \"python app.py\""
37 | from initpy.creator import TornadoCreator
38 | creator = TornadoCreator(getcwd())
39 | elif args.falcon:
40 | end_message += "\nYou can run \"python manage.py\""
41 | from initpy.creator import FalconCreator
42 | creator = FalconCreator(getcwd())
43 |
44 | from initpy.prompt import color_input
45 | module = color_input('Please input base module name [common]: ',
46 | 'yellow') or "common"
47 | creator.create_project(args.name, module)
48 |
49 | color_print("\n".join(creator.errors), "red")
50 | color_print("Successfully created "+args.name+"!", "blue")
51 | color_print(end_message, "magenta")
52 |
53 | elif args.download:
54 | from initpy.creator import downloader
55 | downloader(args)
56 |
57 | elif args.hosted:
58 | url = 'https://raw.githubusercontent.com/Parkayun/initpy-index/'
59 | url += 'master/%s/deatil.json' % args.hosted
60 | from urllib2 import urlopen, HTTPError
61 | try:
62 | res = urlopen(url).read()
63 | from json import loads
64 | detail = loads(res.replace('\n', ''))
65 | except HTTPError:
66 | color_print("Template not found!", "red")
67 | return
68 | except ValueError:
69 | color_print("This template have a error!", "red")
70 | return
71 |
72 | args.download = detail['zip']
73 | color_print("Downloading "+detail['name'], "yellow")
74 | from initpy.creator import downloader
75 | downloader(args)
76 | color_print("Successfully created "+args.name+"!", "blue")
77 |
78 | else:
79 | from initpy.creator import Creator
80 | creator = Creator(getcwd())
81 | if args.name.endswith('/'):
82 | try:
83 | creator.create_module(creator.root_path, args.name[:-1])
84 | color_print("Successfully created "+args.name+"!", "blue")
85 | except IOError:
86 | # file exists what contain same name
87 | pass
88 | else:
89 | extension = ''
90 | tmpl = ''
91 | try:
92 | extension = args.name.split('.')[-1]
93 | except IndexError:
94 | pass
95 | if extension == 'py':
96 | from initpy.templates.blank import python
97 | tmpl = python
98 | creator.create_file(creator.root_path, args.name, tmpl)
99 | color_print("Successfully created "+args.name+"!", "blue")
100 |
101 |
102 | if __name__ == '__main__':
103 | main()
104 |
--------------------------------------------------------------------------------
/initpy/templates/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
--------------------------------------------------------------------------------
/initpy/templates/blank.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 |
4 |
5 | python = """
6 | #!/usr/bin/env python
7 | # -*- coding:utf-8 -*-
8 | """.strip()
--------------------------------------------------------------------------------
/initpy/templates/falcon.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 | from string import Template
4 |
5 |
6 | app_init = Template("""
7 | #!/usr/bin/env python
8 | # -*- coding:utf-8 -*-
9 | import falcon
10 |
11 | # from .middleware import *
12 | from .resources import ${module_title}Resource
13 |
14 | ${module}Resource = ${module_title}Resource()
15 |
16 |
17 | def create_app():
18 | app = falcon.API(middleware=[])
19 |
20 | app.add_route('/', ${module}Resource)
21 |
22 | return app
23 | """.strip())
24 |
25 |
26 | manager = """
27 | #!/usr/bin/env python
28 | # -*- coding: utf-8 -*-
29 | from wsgiref import simple_server
30 |
31 | from app import create_app
32 |
33 |
34 | # Set up falcon api
35 | app = application = create_app()
36 |
37 |
38 | if __name__ == '__main__':
39 | httpd = simple_server.make_server('127.0.0.1', 5000, app)
40 | httpd.serve_forever()
41 | """.strip()
42 |
43 |
44 | resource_init = Template("""
45 | #!/usr/bin/env python
46 | # -*- coding:utf-8 -*-
47 | from .${module} import ${module_title}Resource
48 | """.strip())
49 |
50 |
51 | resource_controller = Template("""
52 | #!/usr/bin/env python
53 | # -*- coding:utf-8 -*-
54 | import falcon
55 |
56 |
57 | class ${module_title}Resource(object):
58 | def __init__(self):
59 | pass
60 |
61 | def on_get(self, req, resp):
62 | resp.status = falcon.HTTP_200
63 | resp.body = 'Hello World'
64 |
65 | def on_post(self, req, resp):
66 | resp.status = falcon.HTTP_200
67 | resp.body = 'Hello World'
68 | """.strip())
69 |
70 |
71 | requirements = """
72 | falcon
73 | """.strip()
74 |
--------------------------------------------------------------------------------
/initpy/templates/flask.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 | from string import Template
4 |
5 |
6 | app_init = Template("""
7 | #!/usr/bin/env python
8 | # -*- coding:utf-8 -*-
9 | from flask import Flask
10 |
11 | app = Flask(__name__)
12 |
13 |
14 | def create_app():
15 | from ${module} import ${module}_blueprint
16 | app.register_blueprint(${module}_blueprint)
17 | return app
18 | """.strip())
19 |
20 |
21 | manager = """
22 | #!/usr/bin/env python
23 | # -*- coding: utf-8 -*-
24 | from flask.ext.script import Manager
25 |
26 | # from werkzeug.contrib.fixers import ProxyFix
27 |
28 | from app import create_app
29 |
30 |
31 | app = create_app()
32 | # app.wsgi_app = ProxyFix(app.wsgi_app)
33 | manager = Manager(app)
34 |
35 | @manager.command
36 | def run():
37 | app.run()
38 |
39 | if __name__ == "__main__":
40 | manager.run()
41 | """.strip()
42 |
43 |
44 | module_init = Template("""
45 | #!/usr/bin/env python
46 | # -*- coding:utf-8 -*-
47 | from flask import Blueprint
48 |
49 | ${module}_blueprint = Blueprint('${module}', __name__)
50 |
51 | from . import views
52 | """.strip())
53 |
54 |
55 | module_views = Template("""
56 | #!/usr/bin/env python
57 | # -*- coding:utf-8 -*-
58 | from flask import render_template
59 |
60 | from . import ${module}_blueprint
61 |
62 |
63 | @${module}_blueprint.route('/')
64 | def index():
65 | return render_template('${module}/index.html')
66 | """.strip())
67 |
68 |
69 | module_html = """
70 | {% extends "base.html" %}
71 |
72 | {% block title %}flask-init{% endblock %}
73 |
74 | {% block body %}
75 | Hello Word
76 | {% endblock %}
77 | """.strip()
78 |
79 | base_html = """
80 |
81 |
82 |
83 | {% block head %}{% endblock %}
84 |
85 |
86 | {% block body %}
87 | {% endblock %}
88 |
89 |