Skip to content

Commit

Permalink
Merge branch 'WIP-doc' into WIP-update_deps
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanzwicknagl committed Nov 1, 2023
2 parents ad781c3 + 406b278 commit b832f78
Show file tree
Hide file tree
Showing 11 changed files with 384 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ __pycache__/
*.egg-info
dist/
build/
docs/_build/
# mac
*DS_Store
# dev
Expand Down
32 changes: 32 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .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 OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

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

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
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)
74 changes: 74 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 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

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

project = 'viASP'
copyright = '2023, Stephan Zwicknagl, Luis Glaser'
author = 'Stephan Zwicknagl, Luis Glaser'

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

extensions = [
'nbsphinx',
'sphinx_rtd_theme',
# 'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.autosectionlabel',
'sphinx.ext.intersphinx'
]
# intersphinx_mapping = {'clorm': ('https://clorm.readthedocs.io/en/latest/', None)}

# napoleon_google_docstring = False
# napoleon_use_ivar = True
napoleon_include_init_with_doc = False
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_references = True

# napoleon_use_param = True
# napoleon_type_aliases = {
# "Factbase": "clingraph.orm.Factbase",
# "dict-like": ":term:`array-like`",
# }

# 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 -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#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'

html_theme_options = {
'canonical_url': '',
# 'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
'logo_only': False,
'display_version': True,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
# Toc options
'collapse_navigation': True,
'sticky_navigation': False,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
}

# 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']
33 changes: 33 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
=======================================
viASP: An interactive ASP visualizer
=======================================

viASP generates interactive explanations of ASP programs and their stable models. A step-by-step break-down shows how the atoms of the stable models are derived.

To use viASP the programs have to executed them using the clingo python API.

..
comment viASP uses the clingo python API, a Flask server and a Dash frontend to generate the visualizations.
.. image:: ./img/header.png

viASP allows you to explore the visualization in a variety of ways:

* Inspect iterations of recursive rules individually
* Explain the derivation of symbols with arrows
* Relax the constraints of unsatisfiable programs
* Toggle parts of the program
* Show the added symbols or all of them
* Inspect a single model
* Add #show statements on the fly
* Search models, signatures and rules.


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

viasp/installation
viasp/usage
viasp/api
viasp/contributing
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
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
clingo>=5.5.2
sphinx>=4.5.0
sphinx-rtd-theme==0.5.2
nbsphinx>=0.8.8
jinja2>=3.0.3
4 changes: 4 additions & 0 deletions docs/viasp/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
=================
API Documentation
=================

35 changes: 35 additions & 0 deletions docs/viasp/contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
=================
Contributing
=================

Requirements
============

- `Git <https://git-scm.com>`_
- `Node.JS <https://nodejs.org>`_
- `Python <https://www.python.org>`_
- A suitable browser


Getting started
===============

1. Clone the repository using :code:`git clone https://github.com/stephanzwicknagl/viasp.git`
2. Create and activate a conda environment
3. Install pip :code:`conda install pip`
4. Install viASP in editable mode :code:`pip install -e viasp -e viasp/backend -e viasp/frontend`

Developing the backend
======================

1. Simply edit the code in the backend folder :code:`viasp/backend/src`
2. Run viASP with a clingo program :code:`viasp encoding.lp`

Developing the frontend
=======================

1. Move to frontend folder :code:`cd viasp/frontend`
2. Run :code:`npm i` to install all needed dependencies
3. Run :code:`npx webpack` to pack the javascript
4. Run viASP with a clingo program :code:`viasp encoding.lp`

40 changes: 40 additions & 0 deletions docs/viasp/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
============
Installation
============

Installing with pip
===================

The python viasp package can be found `here <https://pypi.org/project/viasp/>`_.

.. warning::
The latest version is currently not available on PyPI. Please install from source.

.. code-block:: bash
$ pip install viasp
Installing from source
======================

The project can currently only be installed from source. To do so, clone the repository at https://github.com/stephanzwicknagl/viasp and run the following commands in the root directory of the project:

1. create a virtual environment

.. code-block:: bash
$ conda create -n viasp_env
$ conda activate viasp_env
2. install pip

.. code-block:: bash
$ conda install pip
3. use pip to install the project

.. code-block:: bash
$ pip install -q viasp viasp/backend viasp/frontend
Loading

0 comments on commit b832f78

Please sign in to comment.