Merge pull request 'Add documentation by Sphinx' (#1) from docs into main
Reviewed-on: #1
This commit is contained in:
commit
b0e0fe94ee
9 changed files with 157 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -18,3 +18,6 @@ __pycache__
|
||||||
# Virtual environments
|
# Virtual environments
|
||||||
/venv/
|
/venv/
|
||||||
/.venv/
|
/.venv/
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
/docs/build
|
||||||
|
|
|
||||||
20
docs/Makefile
Normal file
20
docs/Makefile
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Minimal makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
# You can set these variables from the command line, and also
|
||||||
|
# from the environment for the first two.
|
||||||
|
SPHINXOPTS ?=
|
||||||
|
SPHINXBUILD ?= sphinx-build
|
||||||
|
SOURCEDIR = source
|
||||||
|
BUILDDIR = build
|
||||||
|
|
||||||
|
# Put it first so that "make" without argument is like "make help".
|
||||||
|
help:
|
||||||
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
|
.PHONY: help Makefile
|
||||||
|
|
||||||
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
|
%: Makefile
|
||||||
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
71
docs/source/conf.py
Normal file
71
docs/source/conf.py
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
"""
|
||||||
|
Configuration file for the Sphinx documentation builder.
|
||||||
|
For the full list of built-in configuration values, see the
|
||||||
|
[documentation](https://www.sphinx-doc.org/en/master/usage/configuration.html).
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import sphinx_rtd_theme
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
project_root = Path(__file__).resolve().parent.parent
|
||||||
|
source_root = project_root / 'setclass'
|
||||||
|
doc_root = project_root / 'docs' / 'source'
|
||||||
|
sys.path.insert(0, source_root)
|
||||||
|
|
||||||
|
|
||||||
|
# -- Project information -----------------------------------------------------
|
||||||
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
||||||
|
|
||||||
|
project = 'Setclass'
|
||||||
|
copyright = '2024, Jonathan Harker'
|
||||||
|
author = 'Jonathan Harker'
|
||||||
|
release = '0.1'
|
||||||
|
|
||||||
|
|
||||||
|
# -- General configuration ---------------------------------------------------
|
||||||
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
||||||
|
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
|
'sphinx.ext.todo',
|
||||||
|
'sphinx.ext.viewcode',
|
||||||
|
'sphinx.ext.intersphinx',
|
||||||
|
'sphinx.ext.mathjax',
|
||||||
|
'sphinx_rtd_theme',
|
||||||
|
'myst_parser',
|
||||||
|
]
|
||||||
|
|
||||||
|
intersphinx_mapping = {
|
||||||
|
'python': ('https://docs.python.org/3.12', None),
|
||||||
|
}
|
||||||
|
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
exclude_patterns = [
|
||||||
|
'_build',
|
||||||
|
'.DS_Store',
|
||||||
|
'.pytest_cache',
|
||||||
|
'.tox',
|
||||||
|
'.venv',
|
||||||
|
]
|
||||||
|
|
||||||
|
source_suffix = {
|
||||||
|
'.rst': 'restructuredtext',
|
||||||
|
'.md': 'markdown',
|
||||||
|
'.txt': 'markdown',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output -------------------------------------------------
|
||||||
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||||
|
html_theme = 'sphinx_rtd_theme'
|
||||||
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||||
|
html_theme_options = {
|
||||||
|
'display_version': False,
|
||||||
|
'navigation_depth': 2,
|
||||||
|
'prev_next_buttons_location': 'None'
|
||||||
|
}
|
||||||
|
|
||||||
|
html_static_path = ['_static']
|
||||||
27
docs/source/index.rst
Normal file
27
docs/source/index.rst
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
.. Setclass documentation master file, created by
|
||||||
|
sphinx-quickstart on Sat Sep 21 12:30:24 2024.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
Setclass documentation
|
||||||
|
======================
|
||||||
|
|
||||||
|
.. include:: readme.md
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:depth: 2
|
||||||
|
:local:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
:includehidden:
|
||||||
|
|
||||||
|
modules.rst
|
||||||
|
setclass.rst
|
||||||
|
|
||||||
|
Indices and tables
|
||||||
|
==================
|
||||||
|
|
||||||
|
* :ref:`genindex`
|
||||||
|
* :ref:`modindex`
|
||||||
|
* :ref:`search`
|
||||||
7
docs/source/modules.rst
Normal file
7
docs/source/modules.rst
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
setclass
|
||||||
|
========
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
setclass
|
||||||
4
docs/source/readme.md
Normal file
4
docs/source/readme.md
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
README:
|
||||||
|
|
||||||
|
```{include} ../../README.md
|
||||||
|
```
|
||||||
18
docs/source/setclass.rst
Normal file
18
docs/source/setclass.rst
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
setclass package
|
||||||
|
================
|
||||||
|
|
||||||
|
setclass module
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. automodule:: setclass.setclass
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
Module contents
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. automodule:: setclass
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
@ -11,3 +11,8 @@ pre-commit
|
||||||
pytest
|
pytest
|
||||||
pytest-cov
|
pytest-cov
|
||||||
tox
|
tox
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
sphinx
|
||||||
|
sphinx_rtd_theme
|
||||||
|
myst-parser
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ class cache_property:
|
||||||
def __init__(self, function):
|
def __init__(self, function):
|
||||||
self.function = function
|
self.function = function
|
||||||
self.name = function.__name__
|
self.name = function.__name__
|
||||||
|
self.__doc__ = function.__doc__
|
||||||
|
|
||||||
def __get__(self, obj, type=None) -> object:
|
def __get__(self, obj, type=None) -> object:
|
||||||
obj.__dict__[self.name] = self.function(obj)
|
obj.__dict__[self.name] = self.function(obj)
|
||||||
|
|
@ -98,7 +99,7 @@ class SetClass(list):
|
||||||
@cache_property
|
@cache_property
|
||||||
def z_relations(self) -> list:
|
def z_relations(self) -> list:
|
||||||
"""
|
"""
|
||||||
Return all distinct set classes with the same interval vector (Allan Forte: "Z-related").
|
Return all distinct set classes with the same interval vector (Allen Forte: "Z-related").
|
||||||
For example, Forte 4-Z15 {0,1,4,6} and Forte 4-Z29 {0,1,3,7} both have iv⟨1,1,1,1,1,1⟩ but
|
For example, Forte 4-Z15 {0,1,4,6} and Forte 4-Z29 {0,1,3,7} both have iv⟨1,1,1,1,1,1⟩ but
|
||||||
are not inversions, complements, or transpositions (rotations) of each other.
|
are not inversions, complements, or transpositions (rotations) of each other.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue