Skip to content

Commit aae1968

Browse files
authored
Merge pull request #35 from henryborchers/sphinx-docs
Support creation of Sphinx documentation
2 parents 94d88a3 + 1739307 commit aae1968

File tree

7 files changed

+138
-0
lines changed

7 files changed

+138
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ If you intend to develop the code for your proposes or contribute to the open so
3232
* Run tests
3333
`python -m pytest`
3434

35+
### Building the documentation
36+
* Activate virtual env (see Install from source)
37+
* Install sphinx and myst-parser
38+
`pip install sphinx myst-parser`
39+
* Run sphinx-build command
40+
`sphinx-build ./docs ./dist/docs`
41+
3542

3643
### Commands:
3744

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/conf.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = 'qct-parse'
10+
copyright = '2024, AMIA Open-Source'
11+
author = 'AMIA Open-Source'
12+
13+
# -- General configuration ---------------------------------------------------
14+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
15+
16+
extensions = ['myst_parser']
17+
18+
templates_path = ['_templates']
19+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
20+
21+
source_suffix = {
22+
'.rst': 'restructuredtext',
23+
'.txt': 'markdown',
24+
'.md': 'markdown',
25+
}
26+
27+
# -- Options for HTML output -------------------------------------------------
28+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
29+
30+
html_theme = 'alabaster'
31+
html_static_path = ['_static']

docs/development.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Development Information
2+
3+
## Configure Development Environment
4+
5+
* Create a new Python Virtual Environment for qct_parse
6+
* Unix based (Mac or Linux):
7+
`python3 -m venv name_of_env`
8+
* Windows:
9+
`py -m venv name_of_env`
10+
(where 'name_of_env' is replaced with the name of your virtual environment)
11+
* Activate virtual env
12+
* Unix based (Mac or Linux):
13+
`source ./name_of_env/bin/activate`
14+
* Windows:
15+
`name_of_env\scripts\activate`
16+
* Install Package as editable package
17+
* Navigate to the repo root directory `path/to/qct-parse/`
18+
* Run the command:
19+
`python -m pip install -e .`
20+
21+
## Run Tests
22+
23+
If you intend to develop the code for your proposes or contribute to the open source project, a test directory is provided in the repo.
24+
* Activate virtual env (see Configure Development Environment)
25+
* Install pytest
26+
`pip install pytest`
27+
* Run tests
28+
`python -m pytest`
29+

docs/index.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. qct-parse documentation master file, created by
2+
sphinx-quickstart on Tue Dec 3 20:53:22 2024.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
qct-parse documentation
7+
=======================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
readme
14+
development

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/readme.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.. include:: ../README.md
2+
:parser: myst_parser.sphinx_

0 commit comments

Comments
 (0)