diff --git a/.github/workflows/page.yml b/.github/workflows/doc_dev.yml similarity index 76% rename from .github/workflows/page.yml rename to .github/workflows/doc_dev.yml index 968006c54..0cccd37b1 100644 --- a/.github/workflows/page.yml +++ b/.github/workflows/doc_dev.yml @@ -1,6 +1,15 @@ -name: documentation +name: documentation_dev +on: + pull_request_target: + branches: + - main + types: [closed] + push: + branches: + - main + paths: + - docs/* -on: [push, pull_request, workflow_dispatch] permissions: contents: write @@ -9,7 +18,8 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: '3.10' diff --git a/.github/workflows/doc_stable.yml b/.github/workflows/doc_stable.yml new file mode 100644 index 000000000..eebc85303 --- /dev/null +++ b/.github/workflows/doc_stable.yml @@ -0,0 +1,51 @@ +name: documentation_stable +on: + workflow_run: + workflows: ["documentation_dev"] + types: + - completed + +permissions: + contents: write + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + path: main + - name: checkout latest + run: | + cd main + git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) + cd .. + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install dependencies + run: | + pip install -r main/docs/requirements.txt + pip install -r main/requirements.txt + - name: Sphinx build + run: | + sphinx-build main/docs _build + - uses: actions/checkout@v4 + with: + # This is necessary so that we have the tags. + fetch-depth: 0 + ref: gh-pages + path: gh_pages + - name: Commit documentation changes + run: | + cd gh_pages + rm -r stable || echo "Ignoring exit status" + mkdir stable + cp -rv ../_build/* stable + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "Documentation Stable" + git push diff --git a/.github/workflows/dunamai.yml b/.github/workflows/dunamai.yml index aea20fe5e..ca86f5c8a 100644 --- a/.github/workflows/dunamai.yml +++ b/.github/workflows/dunamai.yml @@ -10,10 +10,10 @@ jobs: if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: '3.7' - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: # This is necessary so that we have the tags. fetch-depth: 0 diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 000000000..5995fa217 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,110 @@ +name: "preview" + +on: + workflow_run: + workflows: ["ready_for_review"] + types: + - completed + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + docs: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Download workflow artifact + uses: dawidd6/action-download-artifact@v2.11.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + workflow: peek_icons.yml + run_id: ${{ github.event.workflow_run.id }} + + - name: Read the pr_num file + id: pr_num_reader + uses: juliangruber/read-file-action@v1.0.0 + with: + path: ./pr_num/pr_num.txt + + - name: Checkout + uses: actions/checkout@v4 + with: + path: main + - name: Checkout Pull Request + env: + GITHUB_USER: ${{ secrets.GITHUB_USER }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd main + gh pr checkout ${{ steps.pr_num_reader.outputs.content }} + cd .. + + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install dependencies + run: | + set +e + pip install -r main/docs/requirements.txt + pip install -r main/requirements.txt + sphinx-build main/docs _build + echo "exitcode=$?" >> $GITHUB_ENV + + - uses: actions/checkout@v4 + with: + # This is necessary so that we have the tags. + fetch-depth: 0 + ref: gh-pages + path: gh_pages + + - name: Commit documentation changes + if: ${{ env.exitcode == 0 }} + run: | + cd gh_pages + rm -r preview_pr || echo "Ignoring exit status" + mkdir preview_pr + cp -rv ../_build/* preview_pr + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "Preview documentation" + git push + - name: Comment on the PR about the result + uses: jungwinter/comment@v1 # let us comment on a specific PR + if: ${{ env.exitcode == 0 }} + env: + MESSAGE: | + Hello, + The build of the doc succeeded. The documentation preview is available here: + https://rlberry-py.github.io/rlberry/preview_pr + + with: + type: create + issue_number: ${{ steps.pr_num_reader.outputs.content }} + token: ${{ secrets.GITHUB_TOKEN }} + body: > + ${{ format(env.MESSAGE, + fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0], + join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), '')) }} + + - name: Comment on the PR about the result, fail + uses: jungwinter/comment@v1 # let us comment on a specific PR + if: ${{ env.exitcode != 0 }} + env: + MESSAGE: | + Hello, + The build of the doc failed. Look up the reason here: + https://github.com/rlberry-py/rlberry/actions/workflows/preview.yml + + with: + type: create + issue_number: ${{ steps.pr_num_reader.outputs.content }} + token: ${{ secrets.GITHUB_TOKEN }} + body: > + ${{ format(env.MESSAGE, + fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0], + join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), '')) }} + - name: Exit + run: exit "$exitcode" diff --git a/.github/workflows/ready_for_review.yml b/.github/workflows/ready_for_review.yml new file mode 100644 index 000000000..ec1e0fda1 --- /dev/null +++ b/.github/workflows/ready_for_review.yml @@ -0,0 +1,26 @@ +name: ready_for_review + +on: + pull_request: + types: [labeled, opened, reopened, synchronize] + +jobs: + build: + if: contains( github.event.pull_request.labels.*.name, 'ready for review') + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Run a one-line script + run: echo ready for review! + - name: Save the PR number in an artifact + shell: bash + env: + PR_NUM: ${{ github.event.number }} + run: echo $PR_NUM > pr_num.txt + + - name: Upload the PR number + uses: actions/upload-artifact@v2 + with: + name: pr_num + path: ./pr_num.txt diff --git a/README.md b/README.md index 1ee5cc510..b39642c76 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,6 @@ Python Version - - pytest - - - Documentation Status - contributors @@ -82,12 +76,12 @@ Install the latest version for a stable release. pip install rlberry ``` -The documentation includes more [installation instructions](https://rlberry.readthedocs.io/en/latest/installation.html) in particular for users that work with Jax. +The documentation includes more [installation instructions](https://rlberry-py.github.io/rlberry/installation.html). ## Getting started -In our [documentation](https://rlberry.readthedocs.io/en/latest/), you will find [quick starts](https://rlberry.readthedocs.io/en/latest/user_guide.html#quick-start-setup-an-experiment-and-evaluate-different-agents) to the library and a [user guide](https://rlberry.readthedocs.io/en/latest/user_guide.html) with a few tutorials on using rlberry. +In our [documentation](https://rlberry-py.github.io/rlberry/), you will find [quick starts](https://rlberry-py.github.io/rlberry/basics/quick_start_rl/quickstart.html#quick-start) to the library and a [user guide](https://rlberry-py.github.io/rlberry/user_guide.html) with a few tutorials on using rlberry. See also the [stable documentation](https://rlberry-py.github.io/rlberry/stable/) for the documentation corresponding to the last release. Also, we provide a handful of notebooks on [Google colab](https://colab.research.google.com/) as examples to show you how to use `rlberry`: @@ -99,7 +93,7 @@ how to use `rlberry`: ## Changelog -See the [changelog](https://rlberry.readthedocs.io/en/latest/changelog.html) for a history of the chages made to rlberry. +See the [changelog](https://rlberry-py.github.io/rlberry/changelog.html) for a history of the chages made to rlberry. ## Citing rlberry @@ -126,9 +120,9 @@ The modules listed below are experimental at the moment, that is, they are not t ## About us This project was initiated and is actively maintained by [INRIA SCOOL team](https://team.inria.fr/scool/). -More information [here](https://rlberry.readthedocs.io/en/latest/about.html#). +More information [here](https://rlberry-py.github.io/rlberry/stable/about.html). ## Contributing -Want to contribute to `rlberry`? Please check [our contribution guidelines](https://rlberry.readthedocs.io/en/latest/contributing.html). **If you want to add any new agents or environments, do not hesitate +Want to contribute to `rlberry`? Please check [our contribution guidelines](https://rlberry-py.github.io/rlberry/stable/contributing.html). **If you want to add any new agents or environments, do not hesitate to [open an issue](https://github.com/rlberry-py/rlberry/issues/new/choose)!** diff --git a/docs/beginner_dev_guide.md b/docs/beginner_dev_guide.md index 8c7a24624..cf2f244f4 100644 --- a/docs/beginner_dev_guide.md +++ b/docs/beginner_dev_guide.md @@ -111,7 +111,7 @@ Before a PR can be merged, it needs to be approved. Please prefix the title of y * Azure pipelines are used for testing rlberry on Linux, Mac and Windows, with different dependencies and settings. -* Readthedocs is used to build the docs for viewing. +* github page are used to build the docs for viewing. Please note that if you want to skip the CI (azure pipeline is long to run), use `[ci skip]` in the description of the commit. diff --git a/docs/changelog.rst b/docs/changelog.rst index 7416c87e5..cb89c5016 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -63,7 +63,6 @@ Version 0.4.1 Version 0.4.0 ------------- - *PR #273* * Change the default behavior of `plot_writer_data` so that if seaborn has version >= 0.12.0 then diff --git a/docs/conf.py b/docs/conf.py index e7ceb34d2..1927c813e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,6 +13,7 @@ import os import sys + import sphinx_gallery # noqa from sphinx_gallery.sorting import ExplicitOrder @@ -22,10 +23,9 @@ # -- Project information ----------------------------------------------------- project = "rlberry" -copyright = "2022, rlberry team" +copyright = "2023, rlberry team" author = "rlberry team" - ver_file = os.path.join("../rlberry", "_version.py") with open(ver_file) as f: exec(f.read()) @@ -51,19 +51,7 @@ ] myst_enable_extensions = ["amsmath"] -# myst_enable_extensions = [ -# "amsmath", -# "colon_fence", -# "deflist", -# "dollarmath", -# "fieldlist", -# "html_admonition", -# "html_image", -# "replacements", -# "smartquotes", -# "substitution", -# "tasklist", -# ] + autodoc_default_options = { "members": True, diff --git a/docs/index.rst b/docs/index.rst index e37669089..9f4868f3b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,9 @@ :align: center .. _rlberry: https://github.com/rlberry-py/rlberry +../ +.. _index: An RL Library for Research and Education ======================================== diff --git a/docs/themes/scikit-learn-fork/layout.html b/docs/themes/scikit-learn-fork/layout.html index da58ab475..3fbaa6c9c 100644 --- a/docs/themes/scikit-learn-fork/layout.html +++ b/docs/themes/scikit-learn-fork/layout.html @@ -19,7 +19,7 @@ {% block htmltitle %} {{ title|striptags|e }}{{ titlesuffix }} {% endblock %} - + {% if favicon %} @@ -59,10 +59,12 @@ {%- if pagename != "install" %}
{%- endif %} {%- if meta and meta['parenttoc']|tobool %} diff --git a/docs/themes/scikit-learn-fork/nav.html b/docs/themes/scikit-learn-fork/nav.html index 70acf902a..1bbd96a20 100644 --- a/docs/themes/scikit-learn-fork/nav.html +++ b/docs/themes/scikit-learn-fork/nav.html @@ -71,7 +71,7 @@