11# -*- coding: utf-8 -*-
2- #
3- # PyJWT documentation build configuration file, created by
4- # sphinx-quickstart on Thu Oct 22 18:11:10 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-
2+ import codecs
153import os
164import re
17- import shlex
18- import sys
195
20- # The theme to use for HTML and HTML Help pages. See the documentation for
21- # a list of builtin themes.
226import sphinx_rtd_theme
237
248
25- # If extensions (or modules to document with autodoc) are in another directory,
26- # add these directories to sys.path here. If the directory is relative to the
27- # documentation root, use os.path.abspath to make it absolute, like shown here.
28- # sys.path.insert(0, os.path.abspath('.'))
9+ def read (* parts ):
10+ """
11+ Build an absolute path from *parts* and and return the contents of the
12+ resulting file. Assume UTF-8 encoding.
13+ """
14+ here = os .path .abspath (os .path .dirname (__file__ ))
15+ with codecs .open (os .path .join (here , * parts ), "rb" , "utf-8" ) as f :
16+ return f .read ()
2917
30- # -- General configuration ------------------------------------------------
3118
32- # If your documentation needs a minimal Sphinx version, state it here.
33- # needs_sphinx = '1.0'
19+ def find_version (* file_paths ):
20+ """
21+ Build a path from *file_paths* and search for a ``__version__``
22+ string inside.
23+ """
24+ version_file = read (* file_paths )
25+ version_match = re .search (
26+ r"^__version__ = ['\"]([^'\"]*)['\"]" , version_file , re .M
27+ )
28+ if version_match :
29+ return version_match .group (1 )
30+ raise RuntimeError ("Unable to find version string." )
31+
32+
33+ # -- General configuration ------------------------------------------------
3434
3535# Add any Sphinx extension module names here, as strings. They can be
3636# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3737# ones.
38- extensions = []
38+ extensions = [
39+ "sphinx.ext.autodoc" ,
40+ "sphinx.ext.doctest" ,
41+ "sphinx.ext.intersphinx" ,
42+ "sphinx.ext.todo" ,
43+ ]
3944
4045# Add any paths that contain templates here, relative to this directory.
4146templates_path = ["_templates" ]
4550# source_suffix = ['.rst', '.md']
4651source_suffix = ".rst"
4752
48- # The encoding of source files.
49- # source_encoding = 'utf-8-sig'
50-
5153# The master toctree document.
5254master_doc = "index"
5355
6062# |version| and |release|, also used in various other places throughout the
6163# built documents.
6264#
63- # The short X.Y version.
64- def get_version (package ):
65- """
66- Return package version as listed in `__version__` in `init.py`.
67- """
68- with open (os .path .join (".." , package , "__init__.py" ), "rb" ) as init_py :
69- src = init_py .read ().decode ("utf-8" )
70- return re .search ("__version__ = ['\" ]([^'\" ]+)['\" ]" , src ).group (1 )
71-
72-
73- version = get_version ("jwt" )
7465# The full version, including alpha/beta/rc tags.
75- release = version
66+ release = find_version ("../src/jwt/__init__.py" )
67+
68+ # The short X.Y version.
69+ version = release .rsplit (u"." , 1 )[0 ]
7670
7771# The language for content autogenerated by Sphinx. Refer to documentation
7872# for a list of supported languages.
@@ -81,40 +75,13 @@ def get_version(package):
8175# Usually you set "language" from the command line for these cases.
8276language = None
8377
84- # There are two options for replacing |today|: either, you set today to some
85- # non-false value, then it is used:
86- # today = ''
87- # Else, today_fmt is used as the format for a strftime call.
88- # today_fmt = '%B %d, %Y'
89-
9078# List of patterns, relative to source directory, that match files and
9179# directories to ignore when looking for source files.
9280exclude_patterns = ["_build" ]
9381
94- # The reST default role (used for this markup: `text`) to use for all
95- # documents.
96- # default_role = None
97-
98- # If true, '()' will be appended to :func: etc. cross-reference text.
99- # add_function_parentheses = True
100-
101- # If true, the current module name will be prepended to all description
102- # unit titles (such as .. function::).
103- # add_module_names = True
104-
105- # If true, sectionauthor and moduleauthor directives will be shown in the
106- # output. They are ignored by default.
107- # show_authors = False
108-
10982# The name of the Pygments (syntax highlighting) style to use.
11083pygments_style = "sphinx"
11184
112- # A list of ignored prefixes for module index sorting.
113- # modindex_common_prefix = []
114-
115- # If true, keep warnings as "system message" paragraphs in the built documents.
116- # keep_warnings = False
117-
11885# If true, `todo` and `todoList` produce output, else they produce nothing.
11986todo_include_todos = False
12087
@@ -126,30 +93,6 @@ def get_version(package):
12693
12794html_theme_path = [sphinx_rtd_theme .get_html_theme_path ()]
12895
129- # Theme options are theme-specific and customize the look and feel of a theme
130- # further. For a list of options available for each theme, see the
131- # documentation.
132- # html_theme_options = {}
133-
134- # Add any paths that contain custom themes here, relative to this directory.
135- # html_theme_path = []
136-
137- # The name for this set of Sphinx documents. If None, it defaults to
138- # "<project> v<release> documentation".
139- # html_title = None
140-
141- # A shorter title for the navigation bar. Default is the same as html_title.
142- # html_short_title = None
143-
144- # The name of an image file (relative to this directory) to place at the top
145- # of the sidebar.
146- # html_logo = None
147-
148- # The name of an image file (within the static path) to use as favicon of the
149- # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
150- # pixels large.
151- # html_favicon = None
152-
15396# Add any paths that contain custom static files (such as style sheets) here,
15497# relative to this directory. They are copied after the builtin static files,
15598# so a file named "default.css" will overwrite the builtin "default.css".
@@ -162,125 +105,16 @@ def get_version(package):
162105 ]
163106}
164107
165- # Add any extra paths that contain custom files (such as robots.txt or
166- # .htaccess) here, relative to this directory. These files are copied
167- # directly to the root of the documentation.
168- # html_extra_path = []
169-
170- # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
171- # using the given strftime format.
172- # html_last_updated_fmt = '%b %d, %Y'
173-
174- # If true, SmartyPants will be used to convert quotes and dashes to
175- # typographically correct entities.
176- # html_use_smartypants = True
177-
178- # Custom sidebar templates, maps document names to template names.
179- # html_sidebars = {}
180-
181- # Additional templates that should be rendered to pages, maps page names to
182- # template names.
183- # html_additional_pages = {}
184-
185- # If false, no module index is generated.
186- # html_domain_indices = True
187-
188- # If false, no index is generated.
189- # html_use_index = True
190-
191- # If true, the index is split into individual pages for each letter.
192- # html_split_index = False
193-
194- # If true, links to the reST sources are added to the pages.
195- # html_show_sourcelink = True
196-
197- # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
198- # html_show_sphinx = True
199-
200- # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
201- # html_show_copyright = True
202-
203- # If true, an OpenSearch description file will be output, and all pages will
204- # contain a <link> tag referring to it. The value of this option must be the
205- # base URL from which the finished HTML is served.
206- # html_use_opensearch = ''
207-
208- # This is the file name suffix for HTML files (e.g. ".xhtml").
209- # html_file_suffix = None
210-
211- # Language to be used for generating the HTML full-text search index.
212- # Sphinx supports the following languages:
213- # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
214- # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
215- # html_search_language = 'en'
216-
217- # A dictionary with options for the search language support, empty by default.
218- # Now only 'ja' uses this config value
219- # html_search_options = {'type': 'default'}
220-
221- # The name of a javascript file (relative to the configuration directory) that
222- # implements a search results scorer. If empty, the default will be used.
223- # html_search_scorer = 'scorer.js'
224-
225108# Output file base name for HTML help builder.
226109htmlhelp_basename = "PyJWTdoc"
227110
228- # -- Options for LaTeX output ---------------------------------------------
229-
230- latex_elements = {
231- # The paper size ('letterpaper' or 'a4paper').
232- #'papersize': 'letterpaper',
233- # The font size ('10pt', '11pt' or '12pt').
234- #'pointsize': '10pt',
235- # Additional stuff for the LaTeX preamble.
236- #'preamble': '',
237- # Latex figure (float) alignment
238- #'figure_align': 'htbp',
239- }
240-
241- # Grouping the document tree into LaTeX files. List of tuples
242- # (source start file, target name, title,
243- # author, documentclass [howto, manual, or own class]).
244- latex_documents = [
245- (
246- master_doc ,
247- "PyJWT.tex" ,
248- u"PyJWT Documentation" ,
249- u"José Padilla" ,
250- "manual" ,
251- )
252- ]
253-
254- # The name of an image file (relative to this directory) to place at the top of
255- # the title page.
256- # latex_logo = None
257-
258- # For "manual" documents, if this is true, then toplevel headings are parts,
259- # not chapters.
260- # latex_use_parts = False
261-
262- # If true, show page references after internal links.
263- # latex_show_pagerefs = False
264-
265- # If true, show URL addresses after external links.
266- # latex_show_urls = False
267-
268- # Documents to append as an appendix to all manuals.
269- # latex_appendices = []
270-
271- # If false, no module index is generated.
272- # latex_domain_indices = True
273-
274111
275112# -- Options for manual page output ---------------------------------------
276113
277114# One entry per manual page. List of tuples
278115# (source start file, name, description, authors, manual section).
279116man_pages = [(master_doc , "pyjwt" , u"PyJWT Documentation" , [author ], 1 )]
280117
281- # If true, show URL addresses after external links.
282- # man_show_urls = False
283-
284118
285119# -- Options for Texinfo output -------------------------------------------
286120
@@ -298,15 +132,3 @@ def get_version(package):
298132 "Miscellaneous" ,
299133 )
300134]
301-
302- # Documents to append as an appendix to all manuals.
303- # texinfo_appendices = []
304-
305- # If false, no module index is generated.
306- # texinfo_domain_indices = True
307-
308- # How to display URL addresses: 'footnote', 'no', or 'inline'.
309- # texinfo_show_urls = 'footnote'
310-
311- # If true, do not generate a @detailmenu in the "Top" node's menu.
312- # texinfo_no_detailmenu = False
0 commit comments