-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sphinx based docs with CI action to build and hosted on gh-pages (#119)
* started rtd * testing docs action * update pip * corrected python version * added s to docs * publish every time * added static folder * skipping ci for non code files * changed to rerad the docs theme * started install section * added more sections * added api class * docs ci using conda * added -y for freecad * trying py 3.12 * mimic working conda ci * using rst so no markdown convertion needed * added github edit link * removed path prints * added readme link, badge * format
- Loading branch information
Showing
16 changed files
with
505 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: documentation | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- dev | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
testing: | ||
name: Documentation | ||
runs-on: "ubuntu-latest" | ||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- name: checkout actions | ||
uses: actions/checkout@v4 | ||
- uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
auto-update-conda: true | ||
python-version: ${{ matrix.python-version }} | ||
channels: conda-forge | ||
|
||
- name: install dependencies | ||
run: conda install -c conda-forge freecad -y | ||
|
||
- name: install package | ||
run: | | ||
pip install --upgrade pip | ||
pip install .[docs] | ||
- name: Sphinx build | ||
run: | | ||
sphinx-build docs _build | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v4 | ||
with: | ||
publish_branch: gh-pages | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: _build/ | ||
force_orphan: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Upload Python Package | ||
name: PyPI Python Package | ||
|
||
on: | ||
release: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# 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 | ||
|
||
sys.path.insert(0, os.path.abspath("../../src")) | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "GEOUNED" | ||
copyright = "2024, UNED" | ||
author = "Juan-Pablo Catalan and Patrick Sauvan" | ||
|
||
# The full version, including alpha/beta/rc tags | ||
release = "1.0.1" | ||
|
||
|
||
# -- 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 = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.autosummary", | ||
"sphinx_autodoc_typehints", | ||
"sphinx.ext.coverage", | ||
"sphinx.ext.napoleon", | ||
"sphinx.ext.doctest", | ||
"sphinx.ext.viewcode", | ||
] | ||
|
||
# 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_context = { | ||
"display_github": True, | ||
} | ||
# html_favicon = "favicon.ico" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Developer guide | ||
=============== | ||
|
||
TOOD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.. GEOUNED documentation master file, created by | ||
sphinx-quickstart on Tue Apr 30 09:47:11 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
GEOUNED | ||
======= | ||
|
||
GEOUNED converts CAD to Constructive Solid Geometry (CSG) formats for use in | ||
Monte Carlo transport codes. | ||
Supported codes include OpenMC, PHITS, Serpent and MCNP. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
install | ||
usage | ||
python_api | ||
methodology | ||
developer_guide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
Install | ||
======= | ||
|
||
There are several options for installing GEOUNED package. | ||
The installation selected has implications for how you run GEOUNED Python scripts. | ||
Currently the Mamba / Conda install is the recommended method. | ||
The main difficulty in installing GEOUNED is integration between the main dependnacy (FreeCAD) and the users system Python. | ||
Mamba / Conda provides the a connection between the FreeCAD Python library and your system Python. | ||
Users have had success installing FreeCAD and making use of the FreeCAD Python as well so these installation methods are listed for completeness. | ||
|
||
|
||
Linux | ||
----- | ||
|
||
Mamba | ||
~~~~~ | ||
|
||
First we need to install a Mamba distribution. There are a few options but here we opt for Miniforge3 as it includes Mamba. | ||
|
||
You can follow the install instructions for `Miniforge3 here <https://github.com/conda-forge/miniforge>`_ or follows the commands below. | ||
Download | ||
|
||
.. code-block:: sh | ||
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" | ||
bash Miniforge3-$(uname)-$(uname -m).sh | ||
Install Miniforge3 | ||
|
||
.. code-block:: sh | ||
bash Miniforge3-Linux-x86_64.sh | ||
Activate the base environment in your current terminal | ||
|
||
.. code-block:: sh | ||
mamba activate | ||
It is recommended to create a new environment | ||
|
||
.. code-block:: sh | ||
mamba create --name new_new python=3.11 | ||
Activate the new environment | ||
|
||
.. code-block:: sh | ||
mamba activate new_new | ||
We have aspirations to create a conda-forge package which will combine these final two steps, but for now FreeCAD and GEOUNED can be installed in two commands. | ||
Install FreeCAD which is the main dependency | ||
|
||
.. code-block:: sh | ||
mamba install -c conda-forge freecad | ||
Install GEOUNED with pip | ||
|
||
.. code-block:: sh | ||
pip install git+https://github.com/GEOUNED-code/GEOUNED.git | ||
Then you will be able to run import GEOUNED from within Python | ||
|
||
.. code-block:: python | ||
import geouned | ||
Conda | ||
~~~~~ | ||
|
||
First we need to install a Conda distribution. There are a few options but we here we opt for [MiniConda3](https://docs.anaconda.com/free/miniconda/) as it downloads quicker than the fuller [AnaConda](https://www.anaconda.com/download). | ||
|
||
You can follow the install instructions for [MiniConda3 here](https://docs.anaconda.com/free/miniconda/) or follow the commands below. | ||
Download. | ||
|
||
.. code-block:: sh | ||
mkdir -p ~/miniconda3 | ||
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh | ||
Install MiniConda3 | ||
|
||
.. code-block:: sh | ||
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 | ||
Activate the base environment in your current terminal | ||
|
||
.. code-block:: sh | ||
~/miniconda3/bin/conda init bash | ||
It is recommended to create a new environment | ||
|
||
.. code-block:: sh | ||
conda create --name new_new python=3.11 | ||
Activate the new environment | ||
|
||
.. code-block:: sh | ||
conda activate new_new | ||
We have aspirations to create a conda-forge package which will combine these final two steps, but for now FreeCAD and GEOUNED can be installed in two commands. | ||
Install FreeCAD which is the main dependency | ||
|
||
.. code-block:: sh | ||
conda install -c conda-forge freecad | ||
Install GEOUNED with pip | ||
|
||
.. code-block:: sh | ||
pip install git+https://github.com/GEOUNED-code/GEOUNED.git | ||
Then you will be able to run import GEOUNED from within Python | ||
|
||
.. code-block:: python | ||
import geouned | ||
Apt-get | ||
~~~~~~~ | ||
|
||
Snap | ||
~~~~ | ||
|
||
AppImage | ||
~~~~~~~~ | ||
|
||
Mac | ||
--- | ||
|
||
|
||
Mamba | ||
~~~~~ | ||
|
||
Conda | ||
~~~~~ | ||
|
||
Brew | ||
~~~~ | ||
|
||
|
||
Windows | ||
------- | ||
|
||
Mamba | ||
~~~~~ | ||
|
||
Conda | ||
~~~~~ | ||
|
||
Portable FreeCAD installer | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Windows Subsystem for Linux (WSL) | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
Oops, something went wrong.