Skip to content

Commit b80be60

Browse files
authored
build docs (#157)
1 parent 88bfd6e commit b80be60

File tree

9 files changed

+198
-24
lines changed

9 files changed

+198
-24
lines changed

.readthedocs.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Build documentation in the docs/ directory with Sphinx
9+
sphinx:
10+
configuration: docs/conf.py
11+
12+
# Optionally build your docs in additional formats such as PDF and ePub
13+
formats: all
14+
15+
build:
16+
os: ubuntu-22.04
17+
tools:
18+
python: "3.11"
19+
20+
python:
21+
install:
22+
- requirements: docs/requirements.txt
23+
- method: pip
24+
path: .

Makefile

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ PACKAGE=cwltest
2626
# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2727
# `[[` conditional expressions.
2828
PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
29-
DEVPKGS=diff_cover black pylint pep257 pydocstyle flake8 tox tox-pyenv \
30-
isort wheel autoflake flake8-bugbear pyupgrade bandit \
31-
-rtest-requirements.txt -rmypy-requirements.txt
29+
DEVPKGS=-rdev-requirements.txt -rtest-requirements.txt -rmypy-requirements.txt
3230
DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \
3331
python-flake8 python-mock shellcheck
3432
VERSION=2.2.$(shell TZ=UTC git log --first-parent --max-count=1 \
3533
--format=format:%cd --date=format-local:%Y%m%d%H%M%S)
3634

37-
## all : default task
35+
## all : default task (install in dev mode)
3836
all: dev
3937

4038
## help : print this help message and exit
@@ -61,13 +59,18 @@ install: FORCE
6159

6260
## dev : install the cwltest package in dev mode
6361
dev: install-dep
62+
pip install -U pip setuptools wheel
6463
pip install -e .
6564

6665
## dist : create a module package for distribution
6766
dist: dist/${MODULE}-$(VERSION).tar.gz
6867

6968
dist/${MODULE}-$(VERSION).tar.gz: $(SOURCES)
70-
python setup.py sdist bdist_wheel
69+
python -m build
70+
71+
## docs : make the docs
72+
docs: FORCE
73+
cd docs && $(MAKE) html
7174

7275
## clean : clean up all temporary / machine-generated files
7376
clean: FORCE
@@ -141,8 +144,8 @@ diff-cover.html: coverage.xml
141144
diff-cover --compare-branch=main $^ --html-report $@
142145

143146
## test : run the cwltest test suite
144-
test: $(PYSOURCES) all
145-
python setup.py test ${PYTEST_EXTRA}
147+
test: $(PYSOURCES)
148+
python -m pytest -rs ${PYTEST_EXTRA}
146149

147150
## testcov : run the cwltest test suite and collect coverage
148151
testcov: $(PYSOURCES)
@@ -161,21 +164,9 @@ list-author-emails:
161164

162165
mypy3: mypy
163166
mypy: $(filter-out setup.py gittagger.py,$(PYSOURCES))
164-
if ! test -f $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
165-
then \
166-
rm -Rf mypy-stubs/ruamel/yaml ; \
167-
ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
168-
mypy-stubs/ruamel/ ; \
169-
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
170167
MYPYPATH=$$MYPYPATH:mypy-stubs mypy $^
171168

172169
mypy_3.6: $(filter-out setup.py gittagger.py,$(PYSOURCES))
173-
if ! test -f $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
174-
then \
175-
rm -Rf mypy-stubs/ruamel/yaml ; \
176-
ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
177-
mypy-stubs/ruamel/ ; \
178-
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
179170
MYPYPATH=$$MYPYPATH:mypy-stubs mypy --python-version 3.6 $^
180171

181172
pyupgrade: $(filter-out schema_salad/metaschema.py,$(PYSOURCES))
@@ -187,8 +178,8 @@ release-test: FORCE
187178

188179
release: release-test
189180
. testenv2/bin/activate && \
190-
python testenv2/src/${PACKAGE}/setup.py sdist bdist_wheel
191-
. testenv2/bin/activate && \
181+
pip install build && \
182+
python -m build testenv2/src/${PACKAGE} && \
192183
pip install twine && \
193184
twine upload testenv2/src/${PACKAGE}/dist/* && \
194185
git tag ${VERSION} && git push --tags

dev-requirements.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff_cover
2+
black
3+
pylint
4+
pep257
5+
pydocstyle
6+
flake8
7+
tox < 4
8+
tox-pyenv
9+
isort
10+
wheel
11+
autoflake
12+
flake8-bugbear
13+
pyupgrade
14+
bandit

docs/Makefile

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

docs/_static/favicon.ico

14.7 KB
Binary file not shown.

docs/conf.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
import time
16+
from datetime import datetime
17+
18+
sys.path.insert(0, os.path.abspath(".."))
19+
20+
21+
# -- Project information -----------------------------------------------------
22+
23+
build_date = datetime.utcfromtimestamp(
24+
int(os.environ.get("SOURCE_DATE_EPOCH", time.time()))
25+
)
26+
# -- Project information -----------------------------------------------------
27+
28+
project = "cwltest"
29+
copyright = (
30+
f"2016 - {build_date.year}, Common Workflow Language project and contributors"
31+
)
32+
author = "Common Workflow Language project and contributors"
33+
34+
35+
# -- General configuration ---------------------------------------------------
36+
37+
# Add any Sphinx extension module names here, as strings. They can be
38+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
39+
# ones.
40+
extensions = [
41+
"sphinx.ext.autodoc",
42+
"sphinx.ext.autosummary",
43+
"sphinx.ext.intersphinx",
44+
"sphinx.ext.inheritance_diagram",
45+
"autoapi.extension",
46+
"sphinx_autodoc_typehints",
47+
"sphinx_rtd_theme",
48+
"sphinxcontrib.autoprogram",
49+
]
50+
51+
intersphinx_mapping = {
52+
"python": ("https://docs.python.org/3", None),
53+
"schema_salad": ("https://schema-salad.readthedocs.io/en/stable/", None),
54+
"rdflib": ("https://rdflib.readthedocs.io/en/6.2.0/", None),
55+
#"ruamel.yaml": ("https://yaml.readthedocs.io/en/stable/", None),
56+
}
57+
58+
59+
# Add any paths that contain templates here, relative to this directory.
60+
templates_path = ["_templates"]
61+
62+
# List of patterns, relative to source directory, that match files and
63+
# directories to ignore when looking for source files.
64+
# This pattern also affects html_static_path and html_extra_path.
65+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
66+
67+
68+
# -- Options for HTML output -------------------------------------------------
69+
70+
# The theme to use for HTML and HTML Help pages. See the documentation for
71+
# a list of builtin themes.
72+
#
73+
html_theme = "sphinx_rtd_theme"
74+
75+
# Add any paths that contain custom static files (such as style sheets) here,
76+
# relative to this directory. They are copied after the builtin static files,
77+
# so a file named "default.css" will overwrite the builtin "default.css".
78+
html_static_path = ["_static"]
79+
80+
81+
from pkg_resources import get_distribution
82+
83+
release = get_distribution("cwltest").version
84+
version = ".".join(release.split(".")[:2])
85+
86+
autoapi_dirs = ["../cwltest"]
87+
autodoc_typehints = "description"
88+
autoapi_keep_files = True
89+
autoapi_ignore = ["*.pyi"]
90+
autoapi_options = [
91+
"members",
92+
"undoc-members",
93+
"show-inheritance",
94+
"show-inheritance-diagram",
95+
"show-module-summary",
96+
"imported-members",
97+
"special-members",
98+
]
99+
# sphinx-autodoc-typehints
100+
always_document_param_types = True
101+
# If False, do not add type info for undocumented parameters.
102+
# If True, add stub documentation for undocumented parameters to be able to add type info.

docs/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. include:: ../README.rst
2+
3+
.. toctree::
4+
:maxdepth: 2
5+
6+
Command Line Options
7+
====================
8+
9+
.. autoprogram:: cwltest.argparser:arg_parser()
10+
:prog: cwltest
11+
12+
Indices and tables
13+
==================
14+
15+
* :ref:`genindex`
16+
* :ref:`modindex`
17+
* :ref:`search`

docs/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sphinx >= 2.2
2+
sphinx-rtd-theme==1.1.1
3+
sphinx-autoapi
4+
sphinx-autodoc-typehints
5+
typed_ast;python_version<'3.8'
6+
sphinxcontrib-autoprogram

release-test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ else
1919
fi
2020
run_tests="bin/py.test --pyargs ${module}"
2121
pipver=20.3.3 # minimum required version of pip for Python 3.10
22-
setuptoolsver=50.0.0 # required for Python 3.10
22+
setuptoolsver=50.0.1 # required for Python 3.10
2323
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
2424

2525
rm -Rf testenv? || /bin/true
@@ -63,7 +63,7 @@ rm -f lib/python-wheels/setuptools* \
6363
# The following can fail if you haven't pushed your commits to ${repo}
6464
pip install -e "git+${repo}@${HEAD}#egg=${package}${extras}"
6565
pushd src/${package}
66-
pip install -rtest-requirements.txt
66+
pip install -rtest-requirements.txt build
6767
make dist
6868
make test
6969
cp dist/${package}*tar.gz ../../../testenv3/
@@ -84,7 +84,7 @@ rm -f lib/python-wheels/setuptools* \
8484
&& pip install --force-reinstall -U pip==${pipver} \
8585
&& pip install setuptools==${setuptoolsver} wheel
8686
package_tar=$(find . -name "${package}*tar.gz")
87-
pip install "-r${DIR}/test-requirements.txt"
87+
pip install "-r${DIR}/test-requirements.txt" build
8888
pip install "${package_tar}${extras}"
8989
mkdir out
9090
tar --extract --directory=out -z -f ${package}*.tar.gz

0 commit comments

Comments
 (0)