Skip to content

Commit 1be09b0

Browse files
authored
Merge pull request #4 from TTWShell/docs
docs
2 parents 402abdd + e449721 commit 1be09b0

File tree

12 files changed

+504
-3
lines changed

12 files changed

+504
-3
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ __pycache__/*
88
.pytest_cache/*
99
.tox/*
1010

11+
docs/_build/*
12+
docs/_static/*
13+
docs/_templates/*
14+
1115
hobbit_core.egg-info/*
1216
dist/*
1317
build/*

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
11
# Hobbit-core
22

3-
A flask project generator.
3+
一个生成 flask 项目的工具,包含基础工具集。
4+
5+
# Tree
6+
7+
.
8+
├── demo
9+
│   ├── __init__.py
10+
│   ├── config.py
11+
│   ├── exts.py
12+
│   ├── models
13+
│   │   ├── __init__.py
14+
│   │   └── example.py
15+
│   ├── run.py
16+
│   ├── schemas
17+
│   │   ├── __init__.py
18+
│   │   └── example.py
19+
│   ├── utils.py
20+
│   └── views
21+
│   ├── __init__.py
22+
│   └── example.py
23+
├── docs
24+
├── requirements.txt
25+
└── tests
26+
├── __init__.py
27+
├── conftest.py
28+
└── test_example.py
29+
30+
#

docs/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SOURCEDIR = .
8+
BUILDDIR = _build
9+
10+
# Put it first so that "make" without argument is like "make help".
11+
help:
12+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13+
14+
.PHONY: help Makefile
15+
16+
# Catch-all target: route all unknown targets to Sphinx using the new
17+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18+
%: Makefile
19+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/master/config
8+
9+
# -- Path setup --------------------------------------------------------------
10+
11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
15+
import os
16+
import sys
17+
18+
ROOT_PATH = os.path.split(os.path.abspath('.'))[0]
19+
sys.path.insert(0, os.path.join(ROOT_PATH, 'hobbit_core'))
20+
21+
22+
# -- Project information -----------------------------------------------------
23+
24+
project = 'hobbit-core'
25+
copyright = '2018, Legolas Bloom'
26+
author = 'Legolas Bloom'
27+
28+
# The short X.Y version
29+
version = ''
30+
# The full version, including alpha/beta/rc tags
31+
release = ''
32+
33+
34+
# -- General configuration ---------------------------------------------------
35+
36+
# If your documentation needs a minimal Sphinx version, state it here.
37+
#
38+
# needs_sphinx = '1.0'
39+
40+
# Add any Sphinx extension module names here, as strings. They can be
41+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
42+
# ones.
43+
extensions = [
44+
'sphinx.ext.autodoc',
45+
'sphinx.ext.doctest',
46+
'sphinx.ext.intersphinx',
47+
'sphinx.ext.todo',
48+
'sphinx.ext.coverage',
49+
'sphinx.ext.mathjax',
50+
'sphinx.ext.ifconfig',
51+
'sphinx.ext.viewcode',
52+
'sphinx.ext.githubpages',
53+
'sphinx.ext.napoleon',
54+
]
55+
56+
# Add any paths that contain templates here, relative to this directory.
57+
templates_path = ['_templates']
58+
59+
# The suffix(es) of source filenames.
60+
# You can specify multiple suffix as a list of string:
61+
#
62+
# source_suffix = ['.rst', '.md']
63+
source_suffix = '.rst'
64+
65+
# The master toctree document.
66+
master_doc = 'index'
67+
68+
# The language for content autogenerated by Sphinx. Refer to documentation
69+
# for a list of supported languages.
70+
#
71+
# This is also used if you do content translation via gettext catalogs.
72+
# Usually you set "language" from the command line for these cases.
73+
language = 'python'
74+
75+
# List of patterns, relative to source directory, that match files and
76+
# directories to ignore when looking for source files.
77+
# This pattern also affects html_static_path and html_extra_path.
78+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
79+
80+
# The name of the Pygments (syntax highlighting) style to use.
81+
pygments_style = None
82+
83+
84+
# -- Options for HTML output -------------------------------------------------
85+
86+
# The theme to use for HTML and HTML Help pages. See the documentation for
87+
# a list of builtin themes.
88+
#
89+
# https://pypi.org/project/Flask-Sphinx-Themes/
90+
html_theme = 'flask'
91+
92+
# Theme options are theme-specific and customize the look and feel of a theme
93+
# further. For a list of options available for each theme, see the
94+
# documentation.
95+
96+
html_theme_options = {
97+
'github_fork': 'TTWShell/hobbit-core',
98+
}
99+
100+
# Add any paths that contain custom static files (such as style sheets) here,
101+
# relative to this directory. They are copied after the builtin static files,
102+
# so a file named "default.css" will overwrite the builtin "default.css".
103+
html_static_path = ['_static']
104+
105+
# Custom sidebar templates, must be a dictionary that maps document names
106+
# to template names.
107+
#
108+
# The default sidebars (for documents that don't match any pattern) are
109+
# defined by theme itself. Builtin themes are using these templates by
110+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
111+
# 'searchbox.html']``.
112+
#
113+
# html_sidebars = {}
114+
115+
116+
# -- Options for HTMLHelp output ---------------------------------------------
117+
118+
# Output file base name for HTML help builder.
119+
htmlhelp_basename = 'hobbit-coredoc'
120+
121+
122+
# -- Options for LaTeX output ------------------------------------------------
123+
124+
latex_elements = {
125+
# The paper size ('letterpaper' or 'a4paper').
126+
#
127+
# 'papersize': 'letterpaper',
128+
129+
# The font size ('10pt', '11pt' or '12pt').
130+
#
131+
# 'pointsize': '10pt',
132+
133+
# Additional stuff for the LaTeX preamble.
134+
#
135+
# 'preamble': '',
136+
137+
# Latex figure (float) alignment
138+
#
139+
# 'figure_align': 'htbp',
140+
}
141+
142+
# Grouping the document tree into LaTeX files. List of tuples
143+
# (source start file, target name, title,
144+
# author, documentclass [howto, manual, or own class]).
145+
latex_documents = [
146+
(master_doc, 'hobbit-core.tex', 'hobbit-core Documentation',
147+
'Legolas Bloom', 'manual'),
148+
]
149+
150+
151+
# -- Options for manual page output ------------------------------------------
152+
153+
# One entry per manual page. List of tuples
154+
# (source start file, name, description, authors, manual section).
155+
man_pages = [
156+
(master_doc, 'hobbit-core', 'hobbit-core Documentation',
157+
[author], 1)
158+
]
159+
160+
161+
# -- Options for Texinfo output ----------------------------------------------
162+
163+
# Grouping the document tree into Texinfo files. List of tuples
164+
# (source start file, target name, title, author,
165+
# dir menu entry, description, category)
166+
texinfo_documents = [
167+
(master_doc, 'hobbit-core', 'hobbit-core Documentation',
168+
author, 'hobbit-core', 'One line description of project.',
169+
'Miscellaneous'),
170+
]
171+
172+
173+
# -- Options for Epub output -------------------------------------------------
174+
175+
# Bibliographic Dublin Core info.
176+
epub_title = project
177+
178+
# The unique identifier of the text. This can be a ISBN number
179+
# or the project homepage.
180+
#
181+
# epub_identifier = ''
182+
183+
# A unique identification for the text.
184+
#
185+
# epub_uid = ''
186+
187+
# A list of files that should not be packed into the epub file.
188+
epub_exclude_files = ['search.html']
189+
190+
191+
# -- Extension configuration -------------------------------------------------
192+
193+
# -- Options for intersphinx extension ---------------------------------------
194+
195+
# Example configuration for intersphinx: refer to the Python standard library.
196+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
197+
198+
# -- Options for todo extension ----------------------------------------------
199+
200+
# If true, `todo` and `todoList` produce output, else they produce nothing.
201+
todo_include_todos = True
202+
203+
autodoc_member_order = 'bysource'

docs/index.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.. hobbit-core documentation master file, created by
2+
sphinx-quickstart on Tue Sep 25 15:33:01 2018.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to hobbit-core's documentation!
7+
=======================================
8+
9+
hobbit_core.hobbit
10+
==================
11+
12+
hobbit - A flask project generator.
13+
14+
.. autofunction:: hobbit_core.hobbit.bootstrap.startproject
15+
16+
hobbit_core.flask_hobbit
17+
========================
18+
19+
A flask extension that take care of base utils.
20+
21+
.. automodule:: hobbit_core.flask_hobbit
22+
:members:
23+
:undoc-members:
24+
25+
flask_hobbit.db
26+
---------------
27+
28+
.. automodule:: hobbit_core.flask_hobbit.db
29+
:members:
30+
:undoc-members:
31+
:exclude-members: SurrogatePK
32+
33+
.. autoclass:: SurrogatePK
34+
:members: __repr__
35+
36+
flask_hobbit.pagination
37+
-----------------------
38+
39+
.. automodule:: hobbit_core.flask_hobbit.pagination
40+
:members:
41+
:undoc-members:
42+
43+
flask_hobbit.schemas
44+
--------------------
45+
46+
.. automodule:: hobbit_core.flask_hobbit.schemas
47+
:members:
48+
:undoc-members:
49+
:exclude-members: PagedSchema
50+
51+
.. autoclass:: PagedSchema
52+
:members:
53+
54+
flask_hobbit.response
55+
---------------------
56+
57+
.. automodule:: hobbit_core.flask_hobbit.response
58+
:members:
59+
:undoc-members:
60+
61+
Indices and tables
62+
==================
63+
64+
* :ref:`search`

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
33+
34+
:end
35+
popd

hobbit_core/flask_hobbit/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010

1111
class HobbitManager:
12+
"""Customizable utils management.
13+
"""
1214

1315
def __init__(self, app=None, **kwargs):
1416
"""
@@ -19,6 +21,9 @@ def __init__(self, app=None, **kwargs):
1921
self.init_app(app, **kwargs)
2022

2123
def init_app(self, app, **kwargs):
24+
"""
25+
app: The Flask application instance.
26+
"""
2227
if not isinstance(app, Flask):
2328
raise TypeError(
2429
'flask_hobbit.HobbitManager.init_app(): '

0 commit comments

Comments
 (0)