Skip to content

Commit

Permalink
Merge branch 'main' into reraise-error-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
GenevieveBuckley authored Nov 21, 2023
2 parents 57f9215 + d4c2d7f commit e7a9f84
Show file tree
Hide file tree
Showing 23 changed files with 1,319 additions and 1,014 deletions.
22 changes: 22 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
This Pull request fixes #xx, fixes #yy, fixes #zz

- [ ] I completed the issue numbers (#xx) in the sentence above. The word "fixes" should remain in front of each issue
- [ ] My PR is tagged as draft when I'm still working on it, and I remove the draft flag when it is ready for review.
- [ ] I added one or several `changelog.md` entries in the appropriate "in progress" section (not the last release one)

### b - My PR adds some features:

*(Delete this section if not relevant)*

- [ ] Each issue is well-described, well-labeled and explains/agrees on the expected solution (high-level).
- [ ] I added documentation gallery examples showing the new features
- [ ] I created tests for each new feature. In particular I have for each feature:
- [ ] nominal tests (several simple ones or a parametrized one, or both)
- [ ] edge tests (valid but very particular cases, for example empty data, daylight savings change day, sparse matrix, etc.)
- [ ] error tests (in which case use `with pytest.raises(MyErrorType, match="...")`)

### b - My PR fixes some issues:

*(Delete this section if not relevant)*

- [ ] Each issue is well-described, well-labeled, and contains reproducible code examples.
102 changes: 58 additions & 44 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,32 @@ on:
pull_request:
branches:
- main

defaults:
run:
shell: bash -l {0}

jobs:
# pre-job to read nox tests matrix - see https://stackoverflow.com/q/66747359/7262247
list_nox_test_sessions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- name: Checkout
uses: actions/checkout@v2

- name: Install python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
architecture: x64

- name: Install noxfile requirements
shell: bash -l {0}
run: pip install -r noxfile-requirements.txt

- name: List 'tests' nox sessions
- name: List 'tests' nox sessions and required python versions
id: set-matrix
run: echo "::set-output name=matrix::$(nox -s gha_list -- tests)"
run: echo "::set-output name=matrix::$(nox -s gha_list -- -s tests -v)"

outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }} # save nox sessions list to outputs

Expand All @@ -43,31 +51,29 @@ jobs:
# nox_session: ["tests-2.7", "tests-3.7"]
nox_session: ${{ fromJson(needs.list_nox_test_sessions.outputs.matrix) }}

name: ${{ matrix.os }} ${{ matrix.nox_session }} # ${{ matrix.name_suffix }}
name: ${{ matrix.os }} ${{ matrix.nox_session.python }} ${{ matrix.nox_session.session }} # ${{ matrix.name_suffix }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

# Conda install
- name: Install conda v3.7
uses: conda-incubator/setup-miniconda@v2
- name: Install python ${{ matrix.nox_session.python }} for tests
uses: actions/setup-python@v4
with:
# auto-update-conda: true
python-version: 3.7
activate-environment: noxenv
- run: conda info
shell: bash -l {0} # so that conda works
- run: conda list
shell: bash -l {0} # so that conda works

# Nox install + run
python-version: ${{ matrix.nox_session.python }}
architecture: x64

- name: Install python 3.9 for nox
uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: x64

- name: Install noxfile requirements
shell: bash -l {0} # so that conda works
run: pip install -r noxfile-requirements.txt
- run: conda list
shell: bash -l {0} # so that conda works
- run: nox -s "${{ matrix.nox_session }}"
shell: bash -l {0} # so that conda works

- name: Run nox session ${{ matrix.nox_session.session }}
run: nox -s "${{ matrix.nox_session.session }}"

# Share ./docs/reports so that they can be deployed with doc in next job
- name: Share reports with other jobs
Expand All @@ -77,6 +83,25 @@ jobs:
name: reports_dir
path: ./docs/reports

# build_doc: useless in our case since own doc is part of the tests session
# runs-on: ubuntu-latest
# if: github.event_name == 'pull_request'
# steps:
# - name: Checkout
# uses: actions/checkout@v2
#
# - name: Install python 3.9 for nox
# uses: actions/setup-python@v4
# with:
# python-version: 3.9
# architecture: x64
#
# - name: Install noxfile requirements
# run: pip install -r noxfile-requirements.txt
#
# - name: Build the doc including example gallery
# run: nox -s docs -- build

publish_release:
needs: run_all_tests
runs-on: ubuntu-latest
Expand All @@ -87,47 +112,37 @@ jobs:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"

- uses: actions/checkout@v2
- name: Checkout with no depth
uses: actions/checkout@v2
with:
fetch-depth: 0 # so that gh-deploy works

- name: Install python 3.9 for nox
uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: x64

# 1) retrieve the reports generated previously
- name: Retrieve reports
uses: actions/download-artifact@master
with:
name: reports_dir
path: ./docs/reports

# Conda install
- name: Install conda v3.7
uses: conda-incubator/setup-miniconda@v2
with:
# auto-update-conda: true
python-version: 3.7
activate-environment: noxenv
- run: conda info
shell: bash -l {0} # so that conda works
- run: conda list
shell: bash -l {0} # so that conda works

# Nox install
- name: Install noxfile requirements
shell: bash -l {0} # so that conda works
run: pip install -r noxfile-requirements.txt
- run: conda list
shell: bash -l {0} # so that conda works

# 5) Run the flake8 report and badge
- name: Run flake8 analysis and generate corresponding badge
shell: bash -l {0} # so that conda works
run: nox -s flake8

# -------------- only on Ubuntu + MAIN PUSH (no pull request, no tag) -----------

# 5) Publish the doc and test reports
- name: \[not on TAG\] Publish documentation, tests and coverage reports
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads') # startsWith(matrix.os,'ubuntu')
shell: bash -l {0} # so that conda works
run: nox -s publish

# 6) Publish coverage report
Expand All @@ -151,7 +166,6 @@ jobs:
# 7) Create github release and build the wheel
- name: \[TAG only\] Build wheel and create github release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
shell: bash -l {0} # so that conda works
run: nox -s release -- ${{ secrets.GITHUB_TOKEN }}

# 8) Publish the wheel on PyPi
Expand Down
7 changes: 5 additions & 2 deletions ci_tools/nox_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
nox_logger = logging.getLogger("nox")


PY27, PY35, PY36, PY37, PY38, PY39, PY310 = "2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"
PY27, PY35, PY36, PY37, PY38, PY39, PY310, PY311 = "2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"
DONT_INSTALL = "dont_install"


Expand Down Expand Up @@ -322,7 +322,10 @@ def read_pyproject_toml():
nox_logger.debug("\nA `pyproject.toml` file exists. Loading it.")
pyproject = toml.load("pyproject.toml")
requires = pyproject['build-system']['requires']
conda_pkgs = pyproject['tool']['conda']['conda_packages']
try:
conda_pkgs = pyproject['tool']['conda']['conda_packages']
except KeyError:
conda_pkgs = ()
return requires, conda_pkgs
else:
raise FileNotFoundError("No `pyproject.toml` file exists. No dependency will be installed ...")
Expand Down
20 changes: 17 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
# Changelog

### 0.7.9 - (In Progress)

- Swapped from deprecated `disutils.version` to `packaging.version`. PR [#79](https://github.com/smarie/mkdocs-gallery/pull/79) by [Samreay](https://github.com/Samreay)

### 0.7.8 - Bugfixes

- Fixed `Plugin 'gallery' option 'binder': Sub-option 'org': Required configuration not provided.`. Fixes [#62](https://github.com/smarie/mkdocs-gallery/issues/62)
- Support relative path to `mkdocs.yaml` file using `--config-file` option. Fixes [#63](https://github.com/smarie/mkdocs-gallery/issues/63). PR [#64](https://github.com/smarie/mkdocs-gallery/pull/64) by [fgrbr](https://github.com/fgrbr).

### 0.7.7 - Bugfixes and new python versions

- Official support for python 3.10 and 3.11. PR [#52](https://github.com/smarie/mkdocs-gallery/pull/52) by [GenevieveBuckley](https://github.com/GenevieveBuckley)
- Fixed `AttributeError: MySubConfig has no '_pre_validate'` with `mkdocs` version `1.4` or greater. Fixes [#57](https://github.com/smarie/mkdocs-gallery/issues/57)

### 0.7.6 - Bugfixes

- Fixed incorrect img `srcset` paths leading to figures not being displayed in gallery examples. Fixes [#47](https://github.com/smarie/mkdocs-gallery/issues/47)
- Fixed `TypeError: startswith first arg must be str or a tuple of str, not WindowsPath` when running with `mkdocs serve`. Fixes [#45](https://github.com/smarie/mkdocs-gallery/isues/45). PR [#46](https://github.com/smarie/mkdocs-gallery/pull/46) by [mchaaler](https://github.com/mchaaler).
- Fixed `TypeError: startswith first arg must be str or a tuple of str, not WindowsPath` when running with `mkdocs serve`. Fixes [#45](https://github.com/smarie/mkdocs-gallery/issues/45). PR [#46](https://github.com/smarie/mkdocs-gallery/pull/46) by [mchaaler](https://github.com/mchaaler).

### 0.7.5 - Bugfixes

- Examples expected to fail are now correctly skipped in case of identical md5 hash, too. Fixes [#34](https://github.com/smarie/mkdocs-gallery/isues/34). PR [#39](https://github.com/smarie/mkdocs-gallery/pull/39) by [mchaaler](https://github.com/mchaaler).
- Examples expected to fail are now correctly skipped in case of identical md5 hash, too. Fixes [#34](https://github.com/smarie/mkdocs-gallery/issues/34). PR [#39](https://github.com/smarie/mkdocs-gallery/pull/39) by [mchaaler](https://github.com/mchaaler).

### 0.7.4 - Bugfixes

- Python scripts are now correctly skipped in case of identical md5 hash. Fixes [#29](https://github.com/smarie/mkdocs-gallery/issues/29). PR [#27](https://github.com/smarie/mkdocs-gallery/pull/27) by [mchaaler](https://github.com/mchaaler).
- Fixed error when `edit_url` is set to empty to [disable the "edit page" feature](https://www.mkdocs.org/user-guide/configuration/#edit_uri). Fixes [#32](https://github.com/smarie/mkdocs-gallery/issues/32). PR [#27](https://github.com/smarie/mkdocs-gallery/pull/27) by [mchaaler](https://github.com/mchaaler).

This release was yanked because of [#34](https://github.com/smarie/mkdocs-gallery/isues/34).
This release was yanked because of [#34](https://github.com/smarie/mkdocs-gallery/issues/34).

### 0.7.3 - Bugfix

Expand Down
7 changes: 6 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ plugins:
- search # make sure the search plugin is still enabled
```
Most [sphinx-gallery configuration options](https://sphinx-gallery.github.io/stable/configuration.html) are supported and can be configured in here after `examples_dirs` and `gallery_dirs`. All paths should be relative to the `mkdocs.yml` file (which is supposed to be located at project root).
Most [sphinx-gallery configuration options](https://sphinx-gallery.github.io/stable/configuration.html) are supported and can be configured in here after `examples_dirs` and `gallery_dirs`. All paths should be relative to the `mkdocs.yml` file (which is supposed to be located at project root).

For some general rules:

1. The default matching filename pattern is `plot_`, so to have your files run, ensure the filenames are prefixed with `plot_`.
2. `__init__.py` files are ignored. You can change what's ignored by setting the `ignore_pattern` as per the [sphinx-gallery configuration options](https://sphinx-gallery.github.io/stable/configuration.html)

You can look at the configuration used to generate this site as an example: [mkdocs.yml](https://github.com/smarie/mkdocs-gallery/blob/main/mkdocs.yml).

Expand Down
Loading

0 comments on commit e7a9f84

Please sign in to comment.