Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ permissions:

env:
UV_VERSION: "0.8"
UV_LINK_MODE: "copy"

jobs:
build:
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Sphinx: Render docs"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
UV_VERSION: "0.8"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Build HTML
uses: ammaraskar/sphinx-action@master
with:
docs-folder: docs
build-command: make html
pre-build-command: |
python -m pip install -U pip
python -m pip install "uv==${{ env.UV_VERSION }}"
uv --version
uv venv
uv pip install -e ".[docs]"
df -h
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/source/build/html/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/source/build/html
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,16 @@ dist/*
.DS_Store
__pycache__/
*.pyc

models/

# Sphinx build artifacts
docs/_build/
docs/build/
docs/source/_build/
docs/source/build/

# Autosummary/autogenerated pages
docs/source/_autosummary/
docs/source/_generated/
docs/source/_api/
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Batched optimisation algorithms for neural network potential–driven molecular
- IO methods for RDkit molecules and ASE atoms objects.

## Installation
Pre-requisities: Python 3.11, PyTorch and PyTorch Geometric compatible with your envirnment
Pre-requisities: Python 3.11, PyTorch and PyTorch Geometric compatible with your environment.

```bash
# For example
Expand Down Expand Up @@ -136,9 +136,7 @@ class MyCalculator(Calculator):
return energies, forces

def to_atomic_data():
pass

def from_atomic_data():
# writing this in a batched format is crucial for GPU acceleration
pass
```

Expand Down
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 = source/_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)
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

%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.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

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

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

:end
popd
Empty file added docs/source/_static/.gitkeep
Empty file.
Empty file added docs/source/_templates/.gitkeep
Empty file.
12 changes: 12 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. rst

API reference
=============

The public API is documented below. Expand entries to see available classes and functions.

.. autosummary::
:toctree: _autosummary
:recursive:

neural_optimiser
99 changes: 99 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# 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 os
import sys
from datetime import date

# Make the src/ directory importable so autodoc can find neural_optimiser
sys.path.insert(0, os.path.abspath("../../src"))

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

project = "neural-optimiser"
author = "Ewan Wallace"
copyright = f"{date.today().year}, {author}"

# Dynamic versioning
release = "0.0.0"
try:
from importlib.metadata import PackageNotFoundError, version # py3.8+

try:
release = version("neural-optimiser")
except PackageNotFoundError:
try:
from neural_optimiser import __version__ # noqa: F401

release = __version__
except Exception:
pass
except Exception:
pass

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

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"sphinx.ext.extlinks",
"myst_parser",
]

extlinks = {
"pyg": ("https://pytorch-geometric.readthedocs.io/en/latest/generated/%s.html", "%s"),
}

# Support .rst and .md sources
source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

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

html_theme = "furo"
html_static_path = ["_static"]

# Autodoc/autosummary
autosummary_generate = True
autodoc_default_options = {
"members": True,
"undoc-members": True,
"inherited-members": True,
"show-inheritance": True,
}
autodoc_typehints = "description"

# Napoleon (Google/Numpy style docstrings)
napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_attr_annotations = True

# Intersphinx links
intersphinx_mapping = {
"python": ("https://docs.python.org/3", {}),
"numpy": ("https://numpy.org/doc/stable/", {}),
"torch": ("https://pytorch.org/docs/stable/", {}),
}

# MyST config
myst_enable_extensions = [
"colon_fence",
"deflist",
"fieldlist",
"html_admonition",
"html_image",
"tasklist",
]
20 changes: 20 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. neural-optimiser documentation master file, created by
sphinx-quickstart on Thu Oct 23 06:10:35 2025.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

neural-optimiser documentation
==============================

Overview
--------

.. mdinclude:: ../../README.md

Contents
--------

.. toctree::
:maxdepth: 2

api
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies = [
"numpy",
"loguru",
"universal-pathlib",
"sphinx",
]

[project.optional-dependencies]
Expand All @@ -27,6 +28,13 @@ dev = [
"pre-commit",
]

docs = [
"sphinx>=3.0.0",
"furo==2021.11.16",
"myst-parser",
"sphinx-autodoc-typehints"
]

[tool.uv.sources]
torch = { index = "pytorch-cu128" }
torch-cluster = { index = "pyg-cu128" }
Expand Down