From 9d15754fa4eb6156a7c9d30be0c681997869e92a Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Fri, 8 Oct 2021 06:26:17 +0300 Subject: [PATCH 1/6] add 404 page to docs --- conda-envs/environment-dev-py37.yml | 2 ++ conda-envs/environment-dev-py38.yml | 2 ++ conda-envs/environment-dev-py39.yml | 2 ++ conda-envs/windows-environment-dev-py38.yml | 2 ++ docs/source/404.md | 39 +++++++++++++++++++++ docs/source/conf.py | 12 +++++-- requirements-dev.txt | 2 ++ 7 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 docs/source/404.md diff --git a/conda-envs/environment-dev-py37.yml b/conda-envs/environment-dev-py37.yml index 20caf9e6d7..bea62b9347 100644 --- a/conda-envs/environment-dev-py37.yml +++ b/conda-envs/environment-dev-py37.yml @@ -25,6 +25,8 @@ dependencies: - recommonmark>=0.4 - scipy>1.4.1 - sphinx-autobuild>=0.7 +- sphinx-design +- sphinx-notfound-page - sphinx-panels - sphinx>=1.5 - typing-extensions diff --git a/conda-envs/environment-dev-py38.yml b/conda-envs/environment-dev-py38.yml index b7b7e5325f..5e7e72365e 100644 --- a/conda-envs/environment-dev-py38.yml +++ b/conda-envs/environment-dev-py38.yml @@ -26,6 +26,8 @@ dependencies: - recommonmark>=0.4 - scipy>1.4.1 - sphinx-autobuild>=0.7 +- sphinx-design +- sphinx-notfound-page - sphinx-panels - sphinx>=1.5 - typing-extensions>=3.7.4 diff --git a/conda-envs/environment-dev-py39.yml b/conda-envs/environment-dev-py39.yml index 546c54ed9d..5c0ece1a2a 100644 --- a/conda-envs/environment-dev-py39.yml +++ b/conda-envs/environment-dev-py39.yml @@ -26,6 +26,8 @@ dependencies: - recommonmark>=0.4 - scipy>1.4.1 - sphinx-autobuild>=0.7 +- sphinx-design +- sphinx-notfound-page - sphinx-panels - sphinx>=1.5 - typing-extensions>=3.7.4 diff --git a/conda-envs/windows-environment-dev-py38.yml b/conda-envs/windows-environment-dev-py38.yml index 82affd358a..37f06ba6ba 100644 --- a/conda-envs/windows-environment-dev-py38.yml +++ b/conda-envs/windows-environment-dev-py38.yml @@ -32,6 +32,8 @@ dependencies: - pytest>=3.0 - recommonmark>=0.4 - sphinx-autobuild>=0.7 +- sphinx-design +- sphinx-notfound-page - sphinx-panels - sphinx>=1.5 - watermark diff --git a/docs/source/404.md b/docs/source/404.md new file mode 100644 index 0000000000..dafe0bf024 --- /dev/null +++ b/docs/source/404.md @@ -0,0 +1,39 @@ +--- +orphan: true +--- + +**Sorry, we could not find this page** + +We are working on the next major release for PyMC, +which will come with faster sampling, more flexible +model building, multiple computational backends... + +::::{grid} 3 +:::{grid-item} +![old banner](https://raw.githubusercontent.com/pymc-devs/pymc/v3/docs/logos/svg/PyMC3_banner.svg) +::: +:::{grid-item} +{fas}`arrow-alt-circle-right;fa-10x` +::: +:::{grid-item} +![new banner](https://raw.githubusercontent.com/pymc-devs/pymc/main/docs/logos/svg/PyMC_banner.svg) +::: +:::: + +...and much better documentation too! However, to +do so we have moved some files around and we have +modified the base url in order to support multi version docs +(you'll see the version switcher at the bottom right of the page). + +::::{grid} 3 +:::{grid-item} +::: +:::{grid-item} +```{button-link} https://docs.pymc.io/en/stable/ +:color: primary +:outline: +``` +::: +:::{grid-item} +::: +:::: diff --git a/docs/source/conf.py b/docs/source/conf.py index 2017f59df5..cc605940e5 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -49,7 +49,9 @@ "sphinx.ext.napoleon", "gallery_generator", "myst_nb", + "sphinx_design", "sphinx_panels", + "notfound.extension", ] # Don't auto-generate summary for class members. @@ -83,9 +85,12 @@ # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -# -# The short X.Y version. + version = pymc.__version__ +if os.environ.get("READTHEDOCS", False): + rtd_version = os.environ.get("READTHEDOCS_VERSION", "") + if rtd_version.lower() == "latest": + version = "dev" # The full version, including alpha/beta/rc tags. release = version @@ -96,6 +101,9 @@ # Usually you set "language" from the command line for these cases. language = None +# configure notfound extension to not add any prefix to the urls +notfound_urls_prefix = "/en/latest/" + # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' diff --git a/requirements-dev.txt b/requirements-dev.txt index a3107a4c73..e51a295fba 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -20,6 +20,8 @@ pytest>=3.0 recommonmark>=0.4 scipy>1.4.1 sphinx-autobuild>=0.7 +sphinx-design +sphinx-notfound-page sphinx-panels sphinx>=1.5 typing-extensions>=3.7.4 From 09289e0edba36620e504f9a8e82c8cfab2c4e987 Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Fri, 8 Oct 2021 06:45:35 +0300 Subject: [PATCH 2/6] tweak page a bit --- docs/source/404.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/source/404.md b/docs/source/404.md index dafe0bf024..eb41ff8904 100644 --- a/docs/source/404.md +++ b/docs/source/404.md @@ -2,6 +2,8 @@ orphan: true --- +# Page not found + **Sorry, we could not find this page** We are working on the next major release for PyMC, @@ -13,7 +15,7 @@ model building, multiple computational backends... ![old banner](https://raw.githubusercontent.com/pymc-devs/pymc/v3/docs/logos/svg/PyMC3_banner.svg) ::: :::{grid-item} -{fas}`arrow-alt-circle-right;fa-10x` +{fas}`arrow-alt-circle-right;fa-3x` ::: :::{grid-item} ![new banner](https://raw.githubusercontent.com/pymc-devs/pymc/main/docs/logos/svg/PyMC_banner.svg) @@ -31,7 +33,9 @@ modified the base url in order to support multi version docs :::{grid-item} ```{button-link} https://docs.pymc.io/en/stable/ :color: primary -:outline: +:expand: + +Back to stable version documentation ``` ::: :::{grid-item} From e55a338d653ea27397483c2431763c4826450460 Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Fri, 8 Oct 2021 07:03:07 +0300 Subject: [PATCH 3/6] fix conda env --- conda-envs/environment-dev-py37.yml | 3 ++- conda-envs/environment-dev-py38.yml | 3 ++- conda-envs/environment-dev-py39.yml | 3 ++- conda-envs/windows-environment-dev-py38.yml | 3 ++- docs/source/404.md | 3 ++- docs/source/conf.py | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/conda-envs/environment-dev-py37.yml b/conda-envs/environment-dev-py37.yml index bea62b9347..b2dd058e67 100644 --- a/conda-envs/environment-dev-py37.yml +++ b/conda-envs/environment-dev-py37.yml @@ -25,9 +25,10 @@ dependencies: - recommonmark>=0.4 - scipy>1.4.1 - sphinx-autobuild>=0.7 -- sphinx-design - sphinx-notfound-page - sphinx-panels - sphinx>=1.5 - typing-extensions - watermark +- pip: + - sphinx-design diff --git a/conda-envs/environment-dev-py38.yml b/conda-envs/environment-dev-py38.yml index 5e7e72365e..5a5b7c0dbd 100644 --- a/conda-envs/environment-dev-py38.yml +++ b/conda-envs/environment-dev-py38.yml @@ -26,9 +26,10 @@ dependencies: - recommonmark>=0.4 - scipy>1.4.1 - sphinx-autobuild>=0.7 -- sphinx-design - sphinx-notfound-page - sphinx-panels - sphinx>=1.5 - typing-extensions>=3.7.4 - watermark +- pip: + - sphinx-design diff --git a/conda-envs/environment-dev-py39.yml b/conda-envs/environment-dev-py39.yml index 5c0ece1a2a..c58dabea2c 100644 --- a/conda-envs/environment-dev-py39.yml +++ b/conda-envs/environment-dev-py39.yml @@ -26,9 +26,10 @@ dependencies: - recommonmark>=0.4 - scipy>1.4.1 - sphinx-autobuild>=0.7 -- sphinx-design - sphinx-notfound-page - sphinx-panels - sphinx>=1.5 - typing-extensions>=3.7.4 - watermark +- pip: + - sphinx-design diff --git a/conda-envs/windows-environment-dev-py38.yml b/conda-envs/windows-environment-dev-py38.yml index 37f06ba6ba..f61fd0c0b6 100644 --- a/conda-envs/windows-environment-dev-py38.yml +++ b/conda-envs/windows-environment-dev-py38.yml @@ -32,8 +32,9 @@ dependencies: - pytest>=3.0 - recommonmark>=0.4 - sphinx-autobuild>=0.7 -- sphinx-design - sphinx-notfound-page - sphinx-panels - sphinx>=1.5 - watermark +- pip: + - sphinx-design diff --git a/docs/source/404.md b/docs/source/404.md index eb41ff8904..f3b2356207 100644 --- a/docs/source/404.md +++ b/docs/source/404.md @@ -15,7 +15,8 @@ model building, multiple computational backends... ![old banner](https://raw.githubusercontent.com/pymc-devs/pymc/v3/docs/logos/svg/PyMC3_banner.svg) ::: :::{grid-item} -{fas}`arrow-alt-circle-right;fa-3x` +:class: text-center +{fas}`arrow-alt-circle-right;fa-5x` ::: :::{grid-item} ![new banner](https://raw.githubusercontent.com/pymc-devs/pymc/main/docs/logos/svg/PyMC_banner.svg) diff --git a/docs/source/conf.py b/docs/source/conf.py index cc605940e5..c899b9a441 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -89,7 +89,7 @@ version = pymc.__version__ if os.environ.get("READTHEDOCS", False): rtd_version = os.environ.get("READTHEDOCS_VERSION", "") - if rtd_version.lower() == "latest": + if "." not in rtd_version and rtd_version.lower() != "stable": version = "dev" # The full version, including alpha/beta/rc tags. release = version From 27e34bbf9d323e6d65056c2c1c68e2434f21dd09 Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Fri, 8 Oct 2021 18:10:06 +0300 Subject: [PATCH 4/6] fix pre-commit? --- .pre-commit-config.yaml | 9 ++------- requirements-dev.txt | 7 +++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb3b1a0cf8..6fcca5850f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,6 +38,8 @@ repos: hooks: - id: no-print-statements files: ^pymc3/ + - id: conda-env-sorter + paths: ^conda-envs/environment-dev-py37\.yml$ - repo: local hooks: - id: check-no-tests-are-ignored @@ -47,13 +49,6 @@ repos: language: python name: Check no tests are ignored pass_filenames: false - - id: conda-env-sort - additional_dependencies: [pyyaml] - entry: python scripts/sort_conda_envs.py - files: ^conda-envs/environment-dev-py37\.yml$ - language: python - name: Sort dependencies in conda envs - types: [yaml] - id: pip-from-conda additional_dependencies: [pyyaml] entry: python scripts/generate_pip_deps_from_conda.py diff --git a/requirements-dev.txt b/requirements-dev.txt index e51a295fba..7f0af661e6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,10 +9,9 @@ fastprogress>=0.2.0 h5py>=2.7 ipython>=7.16 myst-nb -nbsphinx>=0.4 -numpy>=1.15.0 +numpy==1.15 numpydoc>=0.9 -pandas>=0.24.0 +pandas==0.24 pre-commit>=2.8.0 pydata-sphinx-theme pytest-cov>=2.5 @@ -24,5 +23,5 @@ sphinx-design sphinx-notfound-page sphinx-panels sphinx>=1.5 -typing-extensions>=3.7.4 +typing-extensions watermark From 54d80ce2cb5675a6c2fee5e8cb2e3fd322029860 Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Sun, 10 Oct 2021 07:57:49 +0300 Subject: [PATCH 5/6] fix pre commit --- .pre-commit-config.yaml | 2 +- conda-envs/environment-dev-py37.yml | 4 ++-- conda-envs/environment-dev-py38.yml | 3 +-- conda-envs/environment-dev-py39.yml | 1 - conda-envs/windows-environment-dev-py38.yml | 1 - requirements-dev.txt | 6 +++--- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6fcca5850f..286aecd9f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: - id: no-print-statements files: ^pymc3/ - id: conda-env-sorter - paths: ^conda-envs/environment-dev-py37\.yml$ + files: ^conda-envs/environment-dev-py.+\.yml$ - repo: local hooks: - id: check-no-tests-are-ignored diff --git a/conda-envs/environment-dev-py37.yml b/conda-envs/environment-dev-py37.yml index b2dd058e67..39a1d88f5c 100644 --- a/conda-envs/environment-dev-py37.yml +++ b/conda-envs/environment-dev-py37.yml @@ -13,9 +13,9 @@ dependencies: - libblas=*=*mkl - mkl-service - myst-nb -- numpy=1.15 +- numpy>=1.15 - numpydoc>=0.9 -- pandas=0.24 +- pandas>=0.24 - pre-commit>=2.8.0 - pydata-sphinx-theme - pytest-cov>=2.5 diff --git a/conda-envs/environment-dev-py38.yml b/conda-envs/environment-dev-py38.yml index 5a5b7c0dbd..614b8e11f1 100644 --- a/conda-envs/environment-dev-py38.yml +++ b/conda-envs/environment-dev-py38.yml @@ -13,10 +13,9 @@ dependencies: - libblas=*=*mkl - mkl-service - myst-nb -- nbsphinx>=0.4 - numpy>=1.15.0 - numpydoc>=0.9 -- pandas +- pandas>=0.24.0 - pre-commit>=2.8.0 - pydata-sphinx-theme - pytest-cov>=2.5 diff --git a/conda-envs/environment-dev-py39.yml b/conda-envs/environment-dev-py39.yml index c58dabea2c..fff17b0c6d 100644 --- a/conda-envs/environment-dev-py39.yml +++ b/conda-envs/environment-dev-py39.yml @@ -13,7 +13,6 @@ dependencies: - libblas=*=*mkl - mkl-service - myst-nb -- nbsphinx>=0.4 - numpy>=1.15.0 - numpydoc>=0.9 - pandas>=0.24.0 diff --git a/conda-envs/windows-environment-dev-py38.yml b/conda-envs/windows-environment-dev-py38.yml index f61fd0c0b6..5259a74b57 100644 --- a/conda-envs/windows-environment-dev-py38.yml +++ b/conda-envs/windows-environment-dev-py38.yml @@ -24,7 +24,6 @@ dependencies: # Extra stuff for dev, testing and docs build - ipython>=7.16 - myst-nb -- nbsphinx>=0.4 - numpydoc>=0.9 - pre-commit>=2.8.0 - pydata-sphinx-theme diff --git a/requirements-dev.txt b/requirements-dev.txt index 7f0af661e6..84935561c3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,9 +9,9 @@ fastprogress>=0.2.0 h5py>=2.7 ipython>=7.16 myst-nb -numpy==1.15 +numpy>=1.15.0 numpydoc>=0.9 -pandas==0.24 +pandas>=0.24.0 pre-commit>=2.8.0 pydata-sphinx-theme pytest-cov>=2.5 @@ -23,5 +23,5 @@ sphinx-design sphinx-notfound-page sphinx-panels sphinx>=1.5 -typing-extensions +typing-extensions>=3.7.4 watermark From 9d23f52fc655675f944aa9552eb81c2b2455b042 Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Sun, 10 Oct 2021 08:00:18 +0300 Subject: [PATCH 6/6] remove unused script --- scripts/sort_conda_envs.py | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 scripts/sort_conda_envs.py diff --git a/scripts/sort_conda_envs.py b/scripts/sort_conda_envs.py deleted file mode 100644 index 299892858e..0000000000 --- a/scripts/sort_conda_envs.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -Sort dependencies in conda environment files. - -This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`. -You can run it manually with `pre-commit run conda-env-sort --all`. -""" - -import argparse - -import yaml - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("files", nargs="*") - args = parser.parse_args() - for file_ in args.files: - with open(file_) as fd: - doc = yaml.safe_load(fd) - doc["dependencies"].sort() - with open(file_, "w") as fd: - yaml.dump(doc, fd, sort_keys=False)