Skip to content

Commit

Permalink
Merge pull request #2 from birdday/docs
Browse files Browse the repository at this point in the history
Initial Docs build.
  • Loading branch information
birdday authored Jan 1, 2025
2 parents 6f3107a + e7f0eea commit 500013b
Show file tree
Hide file tree
Showing 11 changed files with 247 additions and 2 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Sphinx: Render docs"

on: push

jobs:
build:
runs-on: macos-latest
permissions:
contents: write

env:
ETS_TOOLKIT: qt4
QT_API: "pyqt5"
TVTK_VERBOSE: "true"
VTK_PARSER_VERBOSE: "true"
PYTHONUNBUFFERED: "1"
USER: "github-pages"

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Linux packages for Qt5/Qt6 support and start Xvfb
uses: pyvista/setup-headless-display-action@v3
with:
qt: true
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Upgrade pip, install package, install requirements, build docs
run: |
pip install --upgrade pip
pip install -r ./docs/requirements.txt
- name: Install dependencies
run: |
set -exo pipefail
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pyqt5 numpy vtk pillow pytest pytest-timeout traits traitsui --only-binary="numpy,vtk"
- name: Install mayavi and tvtk
run: pip install mayavi
# - name: Test Mayavi package
# run: pytest -v --timeout=10 mayavi
# - name: Test tvtk package
# run: pytest -sv --timeout=60 tvtk
- name: Install Atomaton
run: pip install -e .
- name: Build Docs
run: sphinx-build docs ./docs/_build/html/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/_build/html/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html/
4 changes: 3 additions & 1 deletion atomaton/visualize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import imageio
import mayavi.mlab as mlab
import os
if not (os.environ.get("USER") == "github-pages"):
import mayavi.mlab as mlab
import numpy as np
import matplotlib.cm

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 = .
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)
41 changes: 41 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
import atomaton


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

project = 'Atomaton'
copyright = '2024, Brian A. Day'
author = 'Brian A. Day'
release = '0.1.0'

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

extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
]

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 = 'pydata_sphinx_theme'
html_static_path = ['_static']
38 changes: 38 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.. Atomaton documentation master file, created by
sphinx-quickstart on Fri Feb 2 21:53:39 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Atomaton's documentation!
====================================

.. toctree::
:maxdepth: 10
:caption: Contents:



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

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`



Contents
--------

.. toctree::

usage
lammps
visualize

Check out the :doc:`usage` section for further information, including how to
:ref:`install <installation>` the project.

Learn how to :ref:`view structures <visualization>` and generate movies!

Integrate with :ref:`LAMMPS <lammps>`!
12 changes: 12 additions & 0 deletions docs/lammps.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
LAMMPS
======

.. _lammps:

LAMMPS Input File Generation: :mod:`atomaton.write_lammps_files`
----------------------------------------------------------------

.. automodule:: atomaton.write_lammps_files
:members:
:undoc-members:
:show-inheritance:
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
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx==7.4.7
pydata-sphinx-theme
23 changes: 23 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Usage
=====

.. _installation:

Installation
------------

To use Atomaton, first install it using pip:

.. code-block:: console
(.venv) $ pip install atomaton
Analyzer: :mod:`atomaton.analyze`
--------------------------------------------

.. automodule:: atomaton.analyze
:members:
:undoc-members:
:show-inheritance:

12 changes: 12 additions & 0 deletions docs/visualize.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
View structures
=====

.. _visualization:

Visualizer: :mod:`atomaton.visualize`
--------------------------------------------

.. automodule:: atomaton.visualize
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
author_email="[email protected]",
url="https://github.com/birdday/atomaton",
packages=["atomaton"],
install_requires=["numpy", "ase", "vtk==9.2.6", "mayavi", "imageio", "pyqt5", ],
install_requires=["numpy", "ase", "vtk", "mayavi", "imageio", "PyQt6"],
tests_require=["pytest"],
)

0 comments on commit 500013b

Please sign in to comment.