diff --git a/Makefile b/Makefile index c84991f6757fafa0ef6198205bcf92d886a0e060..4b3bed8f0d7d4fd0ba7c0387eb701323d746a3b5 100644 --- a/Makefile +++ b/Makefile @@ -67,14 +67,7 @@ coverage: ## check code coverage quickly with the default Python $(BROWSER) htmlcov/index.html docs: ## generate Sphinx HTML documentation, including API docs - rm -f docs/flatland*.rst - rm -f docs/modules.rst - sphinx-apidoc --force -a -e -o docs/ flatland -H "Flatland Reference" - $(MAKE) -C docs clean - cp *.md docs - $(MAKE) -C docs html - pydeps --no-config --noshow flatland -o docs/_build/html/flatland.svg - $(BROWSER) docs/_build/html/index.html + python make_docs.py servedocs: docs ## compile the docs watching for changes watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . diff --git a/docs/conf.py b/docs/conf.py index b0366ddb9abee1f32c9e8b17d7e5e78e2c2ad2c6..9cfc10f9343087b7c4f304e71097ee6d65c9e64a 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,7 +33,7 @@ sys.path.insert(0, os.path.abspath('..')) # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['recommonmark', 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx'] +extensions = ['recommonmark', 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx', 'numpydoc'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] diff --git a/make_docs.py b/make_docs.py index be36a7bb7caed714445399b73f958ab42172242c..47588be7a7dd4134fd55deda46fae410454a5282 100644 --- a/make_docs.py +++ b/make_docs.py @@ -1,10 +1,11 @@ #!/usr/bin/env python - +import glob import os +import shutil import subprocess import webbrowser from urllib.request import pathname2url - +from shutil import copyfile def browser(pathname): webbrowser.open("file:" + pathname2url(os.path.abspath(pathname))) @@ -18,10 +19,14 @@ def remove_exists(filename): # clean docs config and html files, and rebuild everything -remove_exists('docs/flatland.rst') +remove_exists('docs/flatland*.rst') remove_exists('docs/modules.rst') -subprocess.call(['sphinx-apidoc', '-o', 'docs/', 'flatland']) +subprocess.call(['sphinx-apidoc', '--force', '-a', '-e', '-o', 'docs/', 'flatland', '-H', '"Flatland Reference"']) + +for file in glob.glob(r'./*.md'): + print(file) + shutil.copy(file, 'docs/') os.environ["SPHINXPROJ"] = "flatland" os.chdir('docs') diff --git a/requirements_continuous_integration.txt b/requirements_continuous_integration.txt index db4885e736a6225c46624f3b20266c403d935626..9a523cc136f3857fd6f8359ea6f278f581c3dacb 100644 --- a/requirements_continuous_integration.txt +++ b/requirements_continuous_integration.txt @@ -6,6 +6,7 @@ benchmarker>=4.0.1 coverage>=4.5.1 Sphinx>=1.8.1 sphinx-rtd-theme>=0.4.3 +numpydoc docutils>=0.15.2 flake8>=3.7.7 flake8-eradicate>=0.2.0