From b9baba2dd09afa26a0d96e44cb448351395b1f3f Mon Sep 17 00:00:00 2001 From: mmcky Date: Mon, 14 Nov 2022 14:43:21 +1100 Subject: [PATCH 1/5] MAINT: update testing against sphinx5, drop sphinx3 --- docs/conf.py | 5 +++-- docs/configure.md | 27 +++++++++++++++++++-------- setup.py | 4 ++-- tox.ini | 6 +++--- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 686f232..b6b060a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,7 +38,7 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ["myst_nb", "sphinx_copybutton", "sphinx_panels", "sphinx_thebe"] +extensions = ["myst_nb", "sphinx_copybutton", "sphinx_design", "sphinx_thebe"] thebe_config = { "repository_url": "https://github.com/binder-examples/jupyter-stacks-datascience", @@ -70,7 +70,8 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +# language = None +# Not recommended sphinx >=5. https://github.com/sphinx-doc/sphinx/issues/10474 # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/docs/configure.md b/docs/configure.md index aad6c9e..cd12625 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -36,8 +36,10 @@ code and Thebe will detect it. For example, the following code: -``````{tabbed} MyST Markdown -````` +``````{tab-set} + +`````{tab-item} Myst Markdown + ````{container} thebe ```{code-block} r print("hi") @@ -47,10 +49,11 @@ print("hi") "hi" ``` ```` + ````` -`````` -``````{tabbed} reStructuredText +`````{tab-item} reStructuredText + ```{code-block} rst .. container:: thebe .. code-block:: r @@ -59,6 +62,9 @@ print("hi") .. container:: output "hi" ``` + +````` + `````` Defines a *parent container* in which we'll put both code and the output of the @@ -146,21 +152,26 @@ qplot(hp, mpg, data=mtcars, shape=am, color=am, You can tag code blocks to run as soon as the kernel is ready (i.e., without any user input) by adding the `thebe-init` class to the code blocks. For example: -`````{tabbed} MyST Markdown -```` +`````{tab-set} + +````{tab-item} MyST Markdown ```{code-block} :class: thebe, thebe-init print("hi") ``` ```` -````` -`````{tabbed} reStructuredText + +````{tab-item} reStructuredText + ```rst .. code-block:: :class: thebe, thebe-init print("hi") ``` + +```` + ````` These code blocks will be run automatically once the kernel is ready, and their outputs diff --git a/setup.py b/setup.py index 5204d88..5fccdc6 100644 --- a/setup.py +++ b/setup.py @@ -47,14 +47,14 @@ "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", ], - install_requires=["sphinx>=3.5,<5"], + install_requires=["sphinx>=4,<6"], extras_require={ "sphinx": [ "matplotlib", "myst-nb", "sphinx-book-theme", "sphinx-copybutton", - "sphinx-panels", + "sphinx-design", ], "testing": ["matplotlib", "pytest", "pytest-regressions", "beautifulsoup4"], }, diff --git a/tox.ini b/tox.ini index 209fde2..7bedccc 100644 --- a/tox.ini +++ b/tox.ini @@ -11,16 +11,16 @@ # then then deleting compiled files has been found to fix it: `find . -name \*.pyc -delete` [tox] -envlist = py39-sphinx3 +envlist = py39-sphinx4 [testenv] usedevelop = true -[testenv:py{37,38,39}-sphinx{3,4}] +[testenv:py{38,39}-sphinx{4,5}] extras = sphinx,testing deps = - sphinx3: sphinx>=3,<4 sphinx4: sphinx>=4,<5 + sphinx5: sphinx>=5,<6 commands = pytest {posargs} [testenv:docs-{update,clean}] From cd974564c9d659b01981544c79586f9c67e3f859 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Thu, 5 Jan 2023 13:02:41 +0100 Subject: [PATCH 2/5] Adding Sphinx 6 --- docs/conf.py | 17 ----------------- setup.py | 2 +- tox.ini | 7 ++++--- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index b6b060a..1db70e8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -102,21 +102,6 @@ "launch_buttons": {"thebelab": True}, } -# 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"] - -# Custom sidebar templates, must be a dictionary that maps document names -# to template names. -# -# The default sidebars (for documents that don't match any pattern) are -# defined by theme itself. Builtin themes are using these templates by -# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', -# 'searchbox.html']``. -# -# html_sidebars = {} - # CopyButton configuration copybutton_prompt_text = ">>> " # Switches for testing but shouldn't be activated in the live docs @@ -125,8 +110,6 @@ # copybutton_image_path = "test/TEST_COPYBUTTON.png" # copybutton_selector = "div" -panels_add_bootstrap_css = False - # -- Options for HTMLHelp output --------------------------------------------- # Output file base name for HTML help builder. diff --git a/setup.py b/setup.py index 5fccdc6..a822d75 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", ], - install_requires=["sphinx>=4,<6"], + install_requires=["sphinx>=4,<7"], extras_require={ "sphinx": [ "matplotlib", diff --git a/tox.ini b/tox.ini index 7bedccc..d0ba95a 100644 --- a/tox.ini +++ b/tox.ini @@ -11,16 +11,17 @@ # then then deleting compiled files has been found to fix it: `find . -name \*.pyc -delete` [tox] -envlist = py39-sphinx4 +envlist = py39-sphinx5 [testenv] usedevelop = true +passenv = TERM # To make terminal coloring / other variables pass through -[testenv:py{38,39}-sphinx{4,5}] +[testenv:py{38,39}-sphinx{5,6}] extras = sphinx,testing deps = - sphinx4: sphinx>=4,<5 sphinx5: sphinx>=5,<6 + sphinx6: sphinx>=6,<7 commands = pytest {posargs} [testenv:docs-{update,clean}] From 6a29e781a3dfbdc442b2e2a013e0caac697356af Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Thu, 5 Jan 2023 13:08:03 +0100 Subject: [PATCH 3/5] Less often tests --- .github/workflows/integration.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 452ed7b..ce44f76 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -1,6 +1,12 @@ name: continuous-integration -on: [push, pull_request] +on: + push: + branches: [master] + tags: + - 'v*' + pull_request: + workflow_call: jobs: docs: From bc4c4b693533254977eeb792eafc6465d7c1c1d9 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Thu, 5 Jan 2023 13:09:24 +0100 Subject: [PATCH 4/5] Fix publishing tests infra --- .github/workflows/publish.yml | 33 +++++++++++++++++++ .../workflows/{integration.yml => tests.yml} | 23 ------------- 2 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/publish.yml rename .github/workflows/{integration.yml => tests.yml} (50%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a83308c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +# This will run every time a tag is created and pushed to the repository. +# It calls our tests workflow via a `workflow_call`, and if tests pass +# then it triggers our upload to PyPI for a new release. +name: Publish to PyPI +on: + release: + types: ["published"] + +jobs: + tests: + uses: ./.github/workflows/tests.yml + publish: + name: publish + needs: [tests] # require tests to pass before deploy runs + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Build package + run: | + python -m pip install -U pip build + python -m build + + - name: Publish + uses: pypa/gh-action-pypi-publish@v1.6.4 + with: + user: __token__ + password: ${{ secrets.PYPI_KEY }} diff --git a/.github/workflows/integration.yml b/.github/workflows/tests.yml similarity index 50% rename from .github/workflows/integration.yml rename to .github/workflows/tests.yml index ce44f76..5c0374c 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/tests.yml @@ -28,26 +28,3 @@ jobs: - name: Run tests run: | pytest - - publish: - - name: Publish to PyPi - needs: [docs] - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - runs-on: ubuntu-latest - steps: - - name: Checkout source - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: "3.8" - - name: Build package - run: | - pip install build - python -m build - - name: Publish - uses: pypa/gh-action-pypi-publish@v1.1.0 - with: - user: __token__ - password: ${{ secrets.PYPI_KEY }} From 3e51597d5bdccdae9f6051ca77188f2558f63541 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Thu, 5 Jan 2023 13:15:51 +0100 Subject: [PATCH 5/5] Pre-release for book theme --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a822d75..d9d3b3d 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ "sphinx": [ "matplotlib", "myst-nb", - "sphinx-book-theme", + "sphinx-book-theme>=0.4.0rc1", "sphinx-copybutton", "sphinx-design", ],