Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioned documenation hosting #104

Merged
merged 73 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
74a1140
Merge remote-tracking branch 'upstream/master'
yardasol Dec 13, 2021
d66a31f
Merge remote-tracking branch 'origin/master'
yardasol Jan 17, 2022
07f5baa
inital version of .readthedocs.yaml
yardasol Jan 19, 2022
17f1133
update environent.yml
yardasol Jan 19, 2022
1320f0b
add mambaforge
yardasol Jan 19, 2022
e95095a
add fail on warning for sphinx option
yardasol Jan 19, 2022
100afd4
add pip deps to environment file
yardasol Jan 19, 2022
361b0d6
add correct version in sphinx config
yardasol Jan 19, 2022
c18e393
make versions consistent
yardasol Jan 19, 2022
b9ae15b
add new dependencies to installation page
yardasol Jan 19, 2022
a4fbd6c
update installation instructions
yardasol Jan 19, 2022
7bc7e88
typo fix in .readthedocs.yaml
yardasol Jan 19, 2022
e62483e
try adding python
yardasol Jan 19, 2022
cea25ad
doc->docs
yardasol Jan 19, 2022
061c29f
doc->docs
yardasol Jan 19, 2022
480be71
try disabling sphinx fail_on_error
Jan 20, 2022
e98049d
remove cruft from docs/src
Jan 20, 2022
539e614
remove crift from integration tests
Jan 20, 2022
f6a4bf2
fix merge conflict
Jan 21, 2022
5c41d58
Revert "doc->docs"
Jan 21, 2022
446dd53
Revert "doc->docs"
Jan 21, 2022
4fe57be
created doc-environment.yml
Jan 21, 2022
e4c6aff
env typo fix
Jan 21, 2022
cfc6157
update doc-environment.yml
Jan 21, 2022
3a7f111
update doc-environment.yml
Jan 21, 2022
bb63eb9
add sphinx_multiversion to conf.py
Jan 21, 2022
392d0a4
update doc-environment.yml
Jan 21, 2022
0bb73ba
add _templates/versions.html
Jan 21, 2022
cd3b2fe
add conf settigns for sphinx-multiverison'
Jan 21, 2022
6b6b86b
remove build saltproc in deploy-docs
Jan 21, 2022
128a1de
modify deploy-docs workflow to work with sphinx-multiversion
Jan 21, 2022
9b93f39
update cache-depenencies worflow
Jan 21, 2022
f82732c
typo fix
Jan 21, 2022
aa343f6
typo fixes in deploy-docs.yml
Jan 21, 2022
46963c1
add path specifier for push trigger in test-saltproc workflow
Jan 21, 2022
96dce81
use prebuid package to allow us to make api pages
Jan 21, 2022
2d772b9
use sphinxcontrib_apidoc instead of the prerelease package
Jan 21, 2022
c082fe8
try to add all subfolders of built docs
Jan 21, 2022
506b1da
try to add all version subfolders of built docs
Jan 21, 2022
244c44f
resolve revert conflicct
Jan 21, 2022
815ecde
try using remote branches/tags for sphinx-multiversion
Jan 21, 2022
22af779
try using fetch-depth 0 w/ checkout action so we can build versioned ocs
Jan 21, 2022
93ba835
try preferring remote branhces
Jan 21, 2022
e919e17
restrcuture environments
Jan 21, 2022
f40e45f
remove extra testing branches
Jan 21, 2022
a3f1738
pep8 fixes
Jan 21, 2022
5a95c35
remove .readthedocs.yaml
Jan 21, 2022
530a68b
add manual triggers for workflows, remove commented out commands
Jan 21, 2022
6961b30
add redirect page
Jan 21, 2022
02ba340
test redirect page
Jan 21, 2022
d52606d
typo fix
Jan 21, 2022
655cb12
typo fix
Jan 21, 2022
5e0af0e
add upstream to the remotes whitelist for sphinx-multiversion config
Jan 21, 2022
4f32938
add another branch to demonstrate deployment
Jan 21, 2022
2e00786
changes for merging
Jan 21, 2022
d5d7843
add packages needed for sphinx-apidoc to work
yardasol Jan 24, 2022
905f97d
update readme install instructions
yardasol Jan 24, 2022
b93761e
minor adjustments to instructions for building documentation
yardasol Jan 24, 2022
18da4bb
update author, copyright in conf.py
yardasol Jan 27, 2022
f60282b
update version
yardasol Jan 27, 2022
ac67c32
try importing __version from version.py
yardasol Jan 27, 2022
6e418d1
remove build testing params
yardasol Jan 27, 2022
56e9bdd
prefer remote refs
yardasol Jan 27, 2022
26bacd1
pep8 fixes
yardasol Jan 27, 2022
415e8ea
add explanation comment
yardasol Jan 27, 2022
7cc11b7
update descriptions in version.py
yardasol Jan 28, 2022
f67358d
update readme instructions
yardasol Jan 28, 2022
552b922
update install instructions in docs
yardasol Jan 28, 2022
679187c
add note on using mamba
yardasol Jan 28, 2022
e980a3b
add mamba blurb to readme
yardasol Jan 28, 2022
9967207
README.md
yardasol Jan 28, 2022
44bf02a
added @munkm suggestions
yardasol Jan 28, 2022
9f31ce4
update maintainer email
yardasol Jan 28, 2022
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
45 changes: 44 additions & 1 deletion .github/workflows/cache-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ name: Cache dependencies
on:
schedule:
- cron: '0 9 * * 1' # run every monday @ 9AM
# enable worflow to be run manually
workflow_dispatch:

env:
CACHE_NUMBER: 0

jobs:
cache-dependencies:
cache-build-dependencies:
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -18,6 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v2

## TESTING CACHE ##
# Setup conda
- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
Expand Down Expand Up @@ -52,3 +55,43 @@ jobs:

- name: Check packages
run: conda list
cache-doc-dependencies:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2

## DOCUMENTATION CACHE ##
- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge # mamba is faster than base conda
miniforge-version: latest
activate-environment: saltproc-doc-env
yardasol marked this conversation as resolved.
Show resolved Hide resolved
use-mamba: true
use-only-tar-bz2: true
- run: |
conda config --env --set pip_interop_enabled True

# check for existing cache
- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV

- uses: actions/cache@v2
id: dependencies-cache
with:
path: |
/usr/share/miniconda3/envs/saltproc-doc-env
~/.cache/pip
key: depcache-${{ hashFiles('doc/doc-environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}

# Install dependencies
- name: Update environment
run: mamba env update -n saltproc-doc-env -f doc/doc-environment.yml
if: steps.dependencies-cache.outputs.cache-hit != 'true'

- name: Check packages
run: conda list
24 changes: 13 additions & 11 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
name: Deploy SaltProc docs

on:
release:
type: [published]
push:
branches:
- master
paths:
- 'doc/**'
- 'saltproc/**'
# enable worflow to be run manually
workflow_dispatch:

env:
CACHE_NUMBER: 0 #change to manually reset cache
Expand All @@ -22,14 +26,16 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

# Setup conda
- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge # mamba is faster than base conda
miniforge-version: latest
activate-environment: saltproc-env
activate-environment: saltproc-doc-env
use-mamba: true
use-only-tar-bz2: true
- run: |
Expand All @@ -43,30 +49,26 @@ jobs:
id: dependencies-cache
with:
path: |
/usr/share/miniconda3/envs/saltproc-env
/usr/share/miniconda3/envs/saltproc-doc-env
~/.cache/pip
key: depcache-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
key: depcache-${{ hashFiles('doc/doc-environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}

# Install dependencies
- name: Update environment
run: mamba env update -n saltproc-env -f environment.yml
run: mamba env update -n saltproc-doc-env -f doc/doc-environment.yml
if: steps.dependencies-cache.outputs.cache-hit != 'true'

- name: Install SaltProc
run: pip install .

- name: Check packages
run: conda list

- name: Build Sphinx Documentation
run: |
cd doc
sphinx-apidoc --separate --force --output-dir=src/ ../saltproc
make clean
make html
sphinx-multiversion doc doc/_build/html
cp doc/redirect.html doc/_build/html/index.html

- name: Deploy documentation to gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/_build/html
commit_message: "update docs at commit: ${{ github.event.head_commit.message }}"
yardasol marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 5 additions & 1 deletion .github/workflows/test-saltproc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ name: Test SaltProc

on:
push:
paths:
- 'saltproc/**'
- 'saltproc/tests/**'
pull_request:
workflow_dispatch:
workflow_run:
workflows: ["Cache dependencies"]
types: [completed]
# enable worflow to be run manually
workflow_dispatch:

env:
CACHE_NUMBER: 0 #change to manually reset cache
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ Detailed installation instructions can be found in the

The documentation for SaltProc can be found at
[arfc.github.io/saltproc/](http://arfc.github.io/saltproc/).
Additionally, the entire contents of that
website can be built from the doc directory in the source code using the
following steps
The entire contents of that
website can be built from the `doc` directory in the repositiory using the following steps with the [`conda`](https://docs.conda.io/en/latest/) tool:

1. `pip install sphinx`
2. `pip install sphinx_rtd_theme`.
3. `cd doc/`
4. `sphinx-apidoc --separate --force --output-dir=src/ ../saltproc`
5. `make clean`
6. `make html`
1. `conda env create -f doc/doc-environment.yml`
2. `cd doc/`
3. `make clean`
4. `make html`

After these steps, the website will be found in `saltproc/doc/_build/html`.

_Note_: We recommend using [`mamba`](https://github.com/mamba-org/mamba) CLI tool to install packages quickly. SaltProc has a compltex package dependency structure which can result is long environment solve times in the default ``conda`` solver. ``mamba`` is a reimplementation of ``conda`` in ``C++`` and we have found it is significantly faster.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the future, you can import the readme in the docs so that you don't have to repeat the same info twice. That way both don't need to be updated if something changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting for the .rst files and the .md files is slightly different. I'll need to think of a solution to this later.



## License

The license for this work can be found
Expand Down
27 changes: 27 additions & 0 deletions doc/_templates/versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{%- if current_version %}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Other Versions</span>
v: {{ current_version.name }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{%- if versions.tags %}
<dl>
<dt>Tags</dt>
{%- for item in versions.tags %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
{%- if versions.branches %}
<dl>
<dt>Branches</dt>
{%- for item in versions.branches %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
</div>
</div>
{%- endif %}
43 changes: 38 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,43 @@
import sphinx_rtd_theme
sys.path.append(os.path.abspath('../'))
sys.path.append(os.path.abspath('../saltproc'))
# autopep8 will make a stink about this but
# we need to have saltproc on ouy syspath
# before we can import it
from saltproc.version import __version__


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

project = u'Saltproc'
copyright = u'2018, Andrei Rykhlevskii, Jin Whan Bae, Kathryn D. Huff'
author = u'Andrei Rykhlevskii, Jin Whan Bae, Kathryn D. Huff'
author = u'Oleksandr Yardas, Andrei Rykhlevskii,\
Jin Whan Bae, Kathryn D. Huff'
copyright = u'2021, ' + author

# The short X.Y version
version = ''
version = __version__
# The full version, including alpha/beta/rc tags
release = ''
release = __version__

# -- sphinx-multiversion configuration ---------------------------------------
# Whitelist pattern for tags (set to None to ignore all tags)
smv_tag_whitelist = r'^v\d[.][^12][.]\d.*$'

# Whitelist pattern for branches (set to None to ignore all branches)
smv_branch_whitelist = r'^(master)*$'

# Whitelist pattern for remotes (set to None to use local branches only)
smv_remote_whitelist = r'^(origin|upstream)$'

# Pattern for released versions
smv_released_pattern = r'^tags/.*$'

# Format for versioned output directories inside the build directory
smv_outputdir_format = '{ref.name}'

# Determines whether remote or local git branches/tags are preferred
# if their output dirs conflict
smv_prefer_remote_refs = True


# -- General configuration ---------------------------------------------------
Expand All @@ -40,6 +66,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinxcontrib.apidoc',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
Expand All @@ -49,7 +76,13 @@
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
]
'sphinx_multiversion']

# apidoc settings
apidoc_module_dir = '../saltproc/'
apidoc_output_dir = 'src/'
apidoc_excluded_paths = []
apidoc_separate_modules = True

# Napoleon settings
napoleon_google_docstring = False
Expand Down
15 changes: 15 additions & 0 deletions doc/doc-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: saltproc-doc-env
channels:
- conda-forge
- defaults
dependencies:
- pyne>=0.5.11
- numpy>=1.14.0
- pytables
- networkx
- pydotplus
- sphinx
- sphinx_rtd_theme
- pip:
- sphinx-multiversion
yardasol marked this conversation as resolved.
Show resolved Hide resolved
- sphinxcontrib-apidoc
34 changes: 27 additions & 7 deletions doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,48 @@ SaltProc has the following dependencies:
.. _PyTables: http://pytables.org
.. _NetworkX: http://networkx.github.io
.. _PyDotPlus: https://pydotplus.readthedocs.io/
.. _pytest: https://docs.pytest.org
.. _sphinx: https://www.sphinx-doc.org
.. _sphinx-rtd-theme: https://sphinx-rtd-theme.readthedocs.io
.. _matplotlib: http://matplotlib.org
.. _ViTables: http://vitables.org
.. _GitHub: http://github.com/arfc/saltproc

.. _conda package manager: https://docs.conda.io/en/latest/
.. _mamba: https://github.com/mamba-org/mamba

Optional Depenendencies:

#. `pytest`_ (for testing)
#. `sphinx`_ and `sphinx-rtd-theme`_ (for building documentation)
#. `matplotlib`_
#. `ViTables`_



Most of the dependencies are readily available through package managers.
Once all the dependencies are installed, SaltProc can be installed.
Clone the source from the SaltProc repository from `GitHub`_.
Then run the following commands from the directory above cloned repository:

.. code-block:: bash

git clone https://github.com/arfc/saltproc.git
git clone [email protected]:arfc/saltproc.git

All of the dependencies are readily available through the `conda package manager`_.

.. note:: We recommend using the `mamba`_ CLI tool to install packages quickly. SaltProc has a compltex package dependency structure which can result is long environment solve times in the default ``conda`` solver. ``mamba`` is a reimplementation of ``conda`` in ``C++`` and we have found it is significantly faster.
yardasol marked this conversation as resolved.
Show resolved Hide resolved

You can download the required ones using ``conda`` on the provided ``environment.yml``
file in the repository:

.. code-block:: bash

cd saltproc/
python setup.py install --user
conda env create -f environment.yml
yardasol marked this conversation as resolved.
Show resolved Hide resolved

Once all the dependencies are installed, SaltProc can be installed by
running the following commands from within the cloned directory
repository (assuming the `saltproc-env` environment is active):

.. code-block:: bash

pip install .

Please let us know if you run into trouble.

Expand Down
9 changes: 9 additions & 0 deletions doc/redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Redirecting to master branch</title>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=./master/index.html">
<link rel="canonical" href="https://arfc.github.io/saltproc/master/index.html">
</head>
</html>
6 changes: 4 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: saltproc-env
channels:
- conda-forge
- defaults
dependencies:
- pyne>=0.5.11
- numpy>=1.14.0
- pytables
- networkx
- pydotplus
- pytest
- sphinx
- sphinx_rtd_theme
- pip:
- argparse==1.4.0
Loading