Skip to content

Commit

Permalink
add document (#34)
Browse files Browse the repository at this point in the history
* delete main.tex

* fix rebase conflict

* add dependencies for doc in pyproject.toml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add .readthedocs.yaml

* update doc

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update title

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Yi-FanLi and pre-commit-ci[bot] authored Dec 16, 2023
1 parent 2610371 commit 8f4ece1
Show file tree
Hide file tree
Showing 14 changed files with 300 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.10"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
formats: all

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
43 changes: 43 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# sphinx build folder
_build

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db

# Editor backup files #
#######################
*~
# generated automatically
api/
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 = .
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)
9 changes: 9 additions & 0 deletions docs/cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. _cli:

Command line interface
======================

.. argparse::
:module: dpti.main
:func: create_parser
:prog: dpti
99 changes: 99 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
from datetime import date

# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = "DPTI"
copyright = "2021-%d, Deep Modeling" % date.today().year
author = "DeepModeling"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"deepmodeling_sphinx",
"dargs.sphinx",
"myst_parser",
"sphinx_rtd_theme",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"numpydoc",
"sphinx.ext.autosummary",
"sphinxarg.ext",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_css_files = []

autodoc_default_flags = ["members"]
autosummary_generate = True
master_doc = "index"


def run_apidoc(_):
from sphinx.ext.apidoc import main

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
cur_dir = os.path.abspath(os.path.dirname(__file__))
module = os.path.join(cur_dir, "..", "dpti")
main(
[
"-M",
"--tocfile",
"api",
"-H",
"DPTI API",
"-o",
os.path.join(cur_dir, "api"),
module,
"--force",
]
)


def setup(app):
app.connect("builder-inited", run_apidoc)


intersphinx_mapping = {
"python": ("https://docs.python.org/", None),
"dargs": ("https://docs.deepmodeling.com/projects/dargs/en/latest/", None),
}
4 changes: 4 additions & 0 deletions docs/credits.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Authors
=======

.. git-shortlog-authors::
3 changes: 3 additions & 0 deletions docs/examples/water.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Phase Diagram of Water

This example describes how to calculate the phase diagram of water.
5 changes: 5 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Getting Started

DPTI: A Thermodynamic Integration Automization Package for Free Energy Calculation

TODO
33 changes: 33 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
DPTI's documentation
======================================

DPTI is a Python package to automate thermodynamic integration (TI) calculations for free energy.

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


install
getting-started
cli
api/api

.. toctree::
:caption: Examples
:glob:

examples/water

.. toctree::
:caption: Project details
:glob:

credits

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

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
8 changes: 8 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Install DPTI
====================

DPTI can installed by `pip`:

```bash
pip install dpti
```
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.[docs]
6 changes: 5 additions & 1 deletion dpti/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# from . import gdi


def main():
def create_parser():
parser = argparse.ArgumentParser(
description="DPTI: An Automatic Workflow Software for Thermodynamic Integration Calculations"
)
Expand All @@ -25,7 +25,11 @@ def main():
ti.add_module_subparsers(main_subparsers)
ti_water.add_module_subparsers(main_subparsers)
gdi.add_module_subparsers(main_subparsers)
return parser


def main():
parser = create_parser()
args = parser.parse_args()
if hasattr(args, "func"):
args.func(args)
Expand Down
14 changes: 11 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ dependencies = [
[project.urls]
homepage = "https://github.com/deepmodeling/dpti"

[project.optional-dependencies]
# docs = ["sphinx", "recommonmark", "sphinx_rtd_theme"]

[project.scripts]
dpti = "dpti.main:main"

[project.optional-dependencies]
docs = [
'sphinx',
'myst-parser',
'sphinx_rtd_theme>=1.0.0rc1',
'numpydoc',
'deepmodeling_sphinx>=0.1.1',
'dargs>=0.3.1',
'sphinx-argparse',
]

[tool.setuptools.packages.find]
include = ["dpti*"]

Expand Down

0 comments on commit 8f4ece1

Please sign in to comment.