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

MAINT: update testing against sphinx6, drop sphinx3 #57

Merged
merged 5 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 0 additions & 47 deletions .github/workflows/integration.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: continuous-integration

on:
push:
branches: [master]
tags:
- 'v*'
pull_request:
workflow_call:

jobs:
docs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[sphinx,testing]
- name: Run tests
run: |
pytest
22 changes: 3 additions & 19 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -101,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
Expand All @@ -124,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.
Expand Down
27 changes: 19 additions & 8 deletions docs/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -47,10 +49,11 @@ print("hi")
"hi"
```
````

`````
``````

``````{tabbed} reStructuredText
`````{tab-item} reStructuredText

```{code-block} rst
.. container:: thebe
.. code-block:: r
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,<7"],
extras_require={
"sphinx": [
"matplotlib",
"myst-nb",
"sphinx-book-theme",
"sphinx-book-theme>=0.4.0rc1",
"sphinx-copybutton",
"sphinx-panels",
"sphinx-design",
],
"testing": ["matplotlib", "pytest", "pytest-regressions", "beautifulsoup4"],
},
Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
# then then deleting compiled files has been found to fix it: `find . -name \*.pyc -delete`

[tox]
envlist = py39-sphinx3
envlist = py39-sphinx5

[testenv]
usedevelop = true
passenv = TERM # To make terminal coloring / other variables pass through

[testenv:py{37,38,39}-sphinx{3,4}]
[testenv:py{38,39}-sphinx{5,6}]
extras = sphinx,testing
deps =
sphinx3: sphinx>=3,<4
sphinx4: sphinx>=4,<5
sphinx5: sphinx>=5,<6
sphinx6: sphinx>=6,<7
commands = pytest {posargs}

[testenv:docs-{update,clean}]
Expand Down