Skip to content

Commit 8a8ec14

Browse files
committed
Improve docs build process
Remove Python 2 stuff as well as unused or commented out configuration values. Also add sphinx to the dependencies Signed-off-by: Stephen Finucane <[email protected]>
1 parent d5ead18 commit 8a8ec14

File tree

5 files changed

+33
-60
lines changed

5 files changed

+33
-60
lines changed

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ help:
1919
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
2020
html:
2121
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
22-
@echo "\nDocs rendered successfully, open _/build/html/index.html to view"
22+
@echo "Docs rendered successfully, open _/build/html/index.html to view"

doc/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ $ pip install -r ../test-requirements.txt
88
```
99

1010
Use `make html` to build the docs in html format.
11-

doc/requirements-docs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
sphinx
12
recommonmark
23
sphinx_markdown_tables

doc/source/conf.py

Lines changed: 31 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Licensed under the Apache License, Version 2.0 (the "License");
32
# you may not use this file except in compliance with the License.
43
# You may obtain a copy of the License at
@@ -18,29 +17,7 @@
1817

1918
from recommonmark.transform import AutoStructify
2019

21-
# --
22-
# Copy README.md, CONTRIBUTING.md to source/ directory and replace
23-
# all paths to point github files.
24-
def _copy_with_converting_link_to_repo(filename, new_filename):
25-
base_url = 'https://github.com/kubernetes-client/python/blob/master/'
26-
27-
def subf(subs):
28-
label, url = subs.groups()
29-
if not url.startswith('http://') and not url.startswith('https://'):
30-
url = base_url + url
31-
return label + '(' + url + ')'
3220

33-
with open(filename, "r") as r:
34-
data = re.sub("(\[[^\]]+\])\(([^\)]+)\)", subf, r.read())
35-
36-
with open(new_filename, "w") as w:
37-
w.write(data)
38-
39-
_copy_with_converting_link_to_repo("../../README.md", "README.md")
40-
_copy_with_converting_link_to_repo("../../CONTRIBUTING.md", "CONTRIBUTING.md")
41-
# --
42-
43-
sys.path.insert(0, os.path.abspath('../..'))
4421
# -- General configuration ----------------------------------------------------
4522

4623
source_suffix = ['.rst', '.md']
@@ -50,23 +27,17 @@ def subf(subs):
5027
extensions = [
5128
'sphinx_markdown_tables',
5229
'recommonmark',
53-
'sphinx.ext.autodoc',
54-
#'sphinx.ext.intersphinx',
5530
]
5631

57-
# autodoc generation is a bit aggressive and a nuisance when doing heavy
58-
# text edit cycles.
59-
# execute "export SPHINX_DEBUG=1" in your terminal to disable
60-
6132
# The suffix of source filenames.
62-
source_suffix = '.rst'
33+
source_suffix = ['.rst', '.md']
6334

6435
# The master toctree document.
6536
master_doc = 'index'
6637

6738
# General information about the project.
68-
project = u'kubernetes-python-client'
69-
copyright = u'2017, Kubernetes'
39+
project = 'kubernetes-python-client'
40+
copyright = '2017-present, Kubernetes'
7041

7142
# If true, '()' will be appended to :func: etc. cross-reference text.
7243
add_function_parentheses = True
@@ -78,33 +49,36 @@ def subf(subs):
7849
# The name of the Pygments (syntax highlighting) style to use.
7950
pygments_style = 'sphinx'
8051

81-
# -- Options for HTML output --------------------------------------------------
82-
83-
# The theme to use for HTML and HTML Help pages. Major themes that come with
84-
# Sphinx are currently 'default' and 'sphinxdoc'.
85-
# html_theme_path = ["."]
86-
# html_theme = '_theme'
87-
# html_static_path = ['static']
88-
89-
# Output file base name for HTML help builder.
90-
htmlhelp_basename = '%sdoc' % project
91-
92-
# Grouping the document tree into LaTeX files. List of tuples
93-
# (source start file, target name, title, author, documentclass
94-
# [howto/manual]).
95-
latex_documents = [
96-
('index',
97-
'%s.tex' % project,
98-
u'%s Documentation' % project,
99-
u'Kubernetes', 'manual'),
100-
]
10152

102-
# Example configuration for intersphinx: refer to the Python standard library.
103-
#intersphinx_mapping = {'http://docs.python.org/': None}
53+
# Copy README.md, CONTRIBUTING.md to source/ directory and replace
54+
# all paths to point github files.
55+
def _copy_with_converting_link_to_repo(filename, new_filename):
56+
base_url = 'https://github.com/kubernetes-client/python/blob/master/'
57+
58+
def subf(subs):
59+
label, url = subs.groups()
60+
if not url.startswith('http://') and not url.startswith('https://'):
61+
url = base_url + url
62+
return label + '(' + url + ')'
63+
64+
with open(filename, "r") as r:
65+
data = re.sub("(\[[^\]]+\])\(([^\)]+)\)", subf, r.read())
66+
67+
with open(new_filename, "w") as w:
68+
w.write(data)
69+
70+
71+
_copy_with_converting_link_to_repo("../../README.md", "README.md")
72+
_copy_with_converting_link_to_repo("../../CONTRIBUTING.md", "CONTRIBUTING.md")
73+
74+
10475
def setup(app):
105-
app.add_config_value('recommonmark_config', {
76+
app.add_config_value(
77+
'recommonmark_config',
78+
{
10679
'auto_toc_tree_section': 'Contents',
10780
'enable_eval_rst': True,
108-
}, True)
81+
},
82+
True,
83+
)
10984
app.add_transform(AutoStructify)
110-

test-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pytest
44
pytest-cov
55
pluggy>=0.3.1
66
randomize>=0.13
7-
sphinx>=1.4 # BSD
87
recommonmark
98
sphinx_markdown_tables
109
pycodestyle

0 commit comments

Comments
 (0)