Skip to content

Commit

Permalink
Add docs generation capability
Browse files Browse the repository at this point in the history
  • Loading branch information
qartik committed Oct 6, 2023
1 parent 80fc126 commit a77f979
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 44 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: tests lint clean build install dev
.PHONY: tests lint clean build install dev docs

tests:
pytest -s -x -vv tests/test*.py
Expand All @@ -7,7 +7,7 @@ lint:
pre-commit run --all-files

clean:
rm -rf *.egg-info dist build
rm -rf *.egg-info dist build docs/build

build: clean
python -m build --sdist -n
Expand All @@ -17,3 +17,7 @@ install:

dev:
pip install -e .

docs:
# sphinx-apidoc -f -o docs/source/ pytket
sphinx-build -M html docs/source/ docs/build/
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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)
1 change: 0 additions & 1 deletion docs/conf.py

This file was deleted.

41 changes: 0 additions & 41 deletions docs/index.rst

This file was deleted.

38 changes: 38 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here.
import pathlib
import sys

sys.path.insert(0, pathlib.Path("../../pytket").resolve().as_posix())
# print(sys.path)

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "pytket.phir"
project_copyright = "2023, Quantinuum"
author = "Quantinuum"
release = "0.0.1"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.doctest",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
]

exclude_patterns = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
19 changes: 19 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pytket-phir
===========

.. toctree::
:maxdepth: 2
:caption: Contents:

modules

PHIR stands for `PECOS <https://github.com/PECOS-packages/PECOS>`__
*High-level Intermediate Representation*. See `PHIR
specification <https://github.com/CQCL/phir/blob/main/phir_spec_qasm.md>`__
for more.

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
7 changes: 7 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pytket
======

.. toctree::
:maxdepth: 4

phir
21 changes: 21 additions & 0 deletions docs/source/phir.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
phir package
============

Subpackages
-----------

.. toctree::
:maxdepth: 4

phir.sharding

Submodules
----------

phir.main module
----------------

.. automodule:: phir.main
:members:
:undoc-members:
:show-inheritance:
21 changes: 21 additions & 0 deletions docs/source/phir.sharding.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
phir.sharding package
=====================

Submodules
----------

phir.sharding.shard module
--------------------------

.. automodule:: phir.sharding.shard
:members:
:undoc-members:
:show-inheritance:

phir.sharding.sharder module
----------------------------

.. automodule:: phir.sharding.sharder
:members:
:undoc-members:
:show-inheritance:
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ dependencies = ["pytket"]
[project.optional-dependencies]
tests = ["pytest"]

docs = ["sphinx", "sphinx-rtd-theme"]

[project.urls]
Repository = "https://github.com/CQCL/pytket-phir.git"

Expand Down

0 comments on commit a77f979

Please sign in to comment.