Skip to content

Commit c053f8e

Browse files
authored
add docs build, simplify modules (#5)
1 parent 0d36549 commit c053f8e

23 files changed

+378
-101
lines changed

.ldrelease/build-docs.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
make docs

.ldrelease/publish-docs-dry-run.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
if [[ -d "docs/build/html" ]]; then
4+
cp -r docs/build/html/* ${LD_RELEASE_DOCS_DIR}
5+
fi

.ldrelease/publish-docs.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
if [[ -d "docs/build/html" ]]; then
4+
cp -r docs/build/html/* ${LD_RELEASE_DOCS_DIR}
5+
fi

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11

2+
PYTEST_FLAGS=-W error::SyntaxWarning
3+
4+
test:
5+
pytest $(PYTEST_FLAGS)
6+
27
lint:
38
mypy --install-types --non-interactive --config-file mypy.ini ld_eventsource testing
49

5-
.PHONY: lint
10+
docs:
11+
cd docs && make html
12+
13+
.PHONY: test lint docs
614

715
TEMP_TEST_OUTPUT=/tmp/sse-contract-test-service.log
816

contract-tests/stream_entity.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
# Import ld_eventsource from parent directory
1010
sys.path.insert(1, os.path.join(sys.path[0], '..'))
1111
from ld_eventsource import *
12+
from ld_eventsource.actions import *
13+
from ld_eventsource.config import *
1214

1315

1416
http_client = urllib3.PoolManager()

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+
.PHONY: help install html
5+
6+
SPHINXOPTS =
7+
SPHINXBUILD = sphinx-build
8+
SPHINXPROJ = launchdarkly-eventsource
9+
SOURCEDIR = .
10+
BUILDDIR = build
11+
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
install:
16+
pip3 install -r requirements.txt
17+
18+
html: install
19+
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/_static/.gitkeep

Whitespace-only changes.

docs/_templates/.gitkeep

Whitespace-only changes.

docs/conf.py

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# -*- coding: utf-8 -*-
2+
# type: ignore
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+
# sys.path.insert(0, os.path.abspath('.'))
18+
19+
import os
20+
import sys
21+
22+
sys.path.insert(0, os.path.abspath('..'))
23+
24+
from ld_eventsource.version import VERSION
25+
26+
# -- Project information -----------------------------------------------------
27+
28+
project = u'launchdarkly-eventsource'
29+
copyright = u'2022, LaunchDarkly'
30+
author = u'LaunchDarkly'
31+
32+
# The short X.Y version.
33+
version = VERSION
34+
# The full version, including alpha/beta/rc tags.
35+
release = VERSION
36+
37+
38+
# -- General configuration ---------------------------------------------------
39+
40+
# If your documentation needs a minimal Sphinx version, state it here.
41+
#
42+
# needs_sphinx = '1.0'
43+
44+
# Add any Sphinx extension module names here, as strings. They can be
45+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
46+
# ones.
47+
extensions = [
48+
'sphinx.ext.autodoc',
49+
'sphinx_autodoc_typehints',
50+
'sphinx.ext.coverage',
51+
'sphinx.ext.viewcode',
52+
]
53+
54+
# Add any paths that contain templates here, relative to this directory.
55+
templates_path = ['_templates']
56+
57+
# The suffix(es) of source filenames.
58+
# You can specify multiple suffix as a list of string:
59+
#
60+
# source_suffix = ['.rst', '.md']
61+
source_suffix = '.rst'
62+
63+
# The master toctree document.
64+
master_doc = 'index'
65+
66+
# The language for content autogenerated by Sphinx. Refer to documentation
67+
# for a list of supported languages.
68+
#
69+
# This is also used if you do content translation via gettext catalogs.
70+
# Usually you set "language" from the command line for these cases.
71+
language = 'en'
72+
73+
# List of patterns, relative to source directory, that match files and
74+
# directories to ignore when looking for source files.
75+
# This pattern also affects html_static_path and html_extra_path .
76+
exclude_patterns = ['build']
77+
78+
# The name of the Pygments (syntax highlighting) style to use.
79+
pygments_style = 'sphinx'
80+
81+
82+
# -- Options for HTML output -------------------------------------------------
83+
84+
# The theme to use for HTML and HTML Help pages. See the documentation for
85+
# a list of builtin themes.
86+
#
87+
html_theme = 'sphinx_rtd_theme'
88+
89+
# Theme options are theme-specific and customize the look and feel of a theme
90+
# further. For a list of options available for each theme, see the
91+
# documentation.
92+
#
93+
# html_theme_options = {}
94+
95+
# Add any paths that contain custom static files (such as style sheets) here,
96+
# relative to this directory. They are copied after the builtin static files,
97+
# so a file named "default.css" will overwrite the builtin "default.css".
98+
html_static_path = ['_static']
99+
100+
# Custom sidebar templates, must be a dictionary that maps document names
101+
# to template names.
102+
#
103+
# The default sidebars (for documents that don't match any pattern) are
104+
# defined by theme itself. Builtin themes are using these templates by
105+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
106+
# 'searchbox.html']``.
107+
#
108+
# html_sidebars = {}
109+
110+
111+
# -- Options for HTMLHelp output ---------------------------------------------
112+
113+
# Output file base name for HTML help builder.
114+
htmlhelp_basename = 'launchdarkly-eventsource-doc'
115+
116+
117+
# -- Options for LaTeX output ------------------------------------------------
118+
119+
latex_elements = {
120+
# The paper size ('letterpaper' or 'a4paper').
121+
#
122+
# 'papersize': 'letterpaper',
123+
124+
# The font size ('10pt', '11pt' or '12pt').
125+
#
126+
# 'pointsize': '10pt',
127+
128+
# Additional stuff for the LaTeX preamble.
129+
#
130+
# 'preamble': '',
131+
132+
# Latex figure (float) alignment
133+
#
134+
# 'figure_align': 'htbp',
135+
}
136+
137+
# Grouping the document tree into LaTeX files. List of tuples
138+
# (source start file, target name, title,
139+
# author, documentclass [howto, manual, or own class]).
140+
latex_documents = [
141+
(master_doc, 'launchdarkly-eventsource.tex', u'launchdarkly-eventsource Documentation',
142+
u'LaunchDarkly', 'manual'),
143+
]
144+
145+
146+
# -- Options for manual page output ------------------------------------------
147+
148+
# One entry per manual page. List of tuples
149+
# (source start file, name, description, authors, manual section).
150+
man_pages = [
151+
(master_doc, 'launchdarkly-eventsource', u'launchdarkly-eventsource Documentation',
152+
[author], 1)
153+
]
154+
155+
156+
# -- Options for Texinfo output ----------------------------------------------
157+
158+
# Grouping the document tree into Texinfo files. List of tuples
159+
# (source start file, target name, title, author,
160+
# dir menu entry, description, category)
161+
texinfo_documents = [
162+
(master_doc, 'launchdarkly-eventsource', u'launchdarkly-eventsource Documentation',
163+
author, 'launchdarkly-eventsource', 'One line description of project.',
164+
'Miscellaneous'),
165+
]
166+
167+
168+
# -- Extension configuration -------------------------------------------------
169+
170+
autodoc_default_options = {
171+
'undoc-members': False
172+
}

docs/index.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
LaunchDarkly Python SSE Client
2+
==============================
3+
4+
This is the API reference for the `launchdarkly-eventsource <https://github.com/launchdarkly/python-eventsource/>`_ package, a `Server-Sent Events <https://html.spec.whatwg.org/multipage/server-sent-events.html>`_ client for Python. This package is used internally by the `LaunchDarkly Python SDK <https://github.com/launchdarkly/python-server-sdk>`_, but may also be useful for other purposes.
5+
6+
7+
ld_eventsource module
8+
---------------------
9+
10+
.. automodule:: ld_eventsource
11+
:members:
12+
:imported-members:
13+
:special-members: __init__
14+
15+
16+
ld_eventsource.actions module
17+
-----------------------------
18+
19+
.. automodule:: ld_eventsource.actions
20+
:members:
21+
:imported-members:
22+
:special-members: __init__
23+
:show-inheritance:
24+
25+
26+
ld_eventsource.config module
27+
----------------------------
28+
29+
.. automodule:: ld_eventsource.config
30+
:members:
31+
:imported-members:
32+
33+
34+
ld_eventsource.errors module
35+
----------------------------
36+
37+
.. automodule:: ld_eventsource.errors
38+
:members:
39+
:imported-members:
40+
:special-members: __init__
41+
:show-inheritance:

0 commit comments

Comments
 (0)