Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Jul 27, 2023
2 parents 96ac918 + 7e322bb commit 37a3104
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 60 deletions.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: github-actions
directory: /
commit-message:
prefix: ⬆️
schedule:
interval: monthly
- package-ecosystem: pip
directory: /
commit-message:
prefix: ⬆️
schedule:
interval: monthly
75 changes: 41 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,69 +14,57 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: pre-commit/action@v2.0.0
- uses: pre-commit/action@v3.0.0

tests:

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
sphinx-version: ["~=7.0"]
include:
- os: ubuntu-latest
python-version: 3.8
sphinx-version: "~=5.0"
- os: ubuntu-latest
python-version: 3.8
sphinx-version: "~=6.0"
- os: windows-latest
python-version: 3.8
sphinx-version: "~=7.0"

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[testing]
pip install --upgrade "sphinx${{ matrix.sphinx-version }}" -e .[testing]
- name: Run pytest
run: |
pytest --cov=sphinx_design --cov-report=xml --cov-report=term-missing
- name: Upload to Codecov
if: matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
name: pytests
flags: pytests
file: ./coverage.xml
fail_ci_if_error: true

tests-sphinx4:

strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.10"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[testing] sphinx~=4.5
- name: Run pytest
run: pytest

docs-build-format:

runs-on: ubuntu-latest
Expand All @@ -85,18 +73,37 @@ jobs:
format: [html, latex, man]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[rtd]
- name: Build documentation
run: sphinx-build -nW --keep-going -b ${{ matrix.format }} docs/ docs/_build/${{ matrix.format }}

# https://github.com/marketplace/actions/alls-green#why
check: # This job does nothing and is only used for the branch protection

if: always()

needs:
- pre-commit
- tests
- docs-build-format

runs-on: ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

publish:

name: Publish to PyPi
Expand All @@ -105,9 +112,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: install flit
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black

Expand All @@ -35,7 +35,7 @@ repos:
additional_dependencies: [flake8-bugbear~=22.7]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
rev: v1.4.1
hooks:
- id: mypy
additional_dependencies: []
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License Copyright (c) 2021 Chris Sewell
MIT License Copyright (c) 2023 Chris Sewell

Permission is hereby granted, free
of charge, to any person obtaining a copy of this software and associated
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"repository_branch": "main",
"path_to_docs": "docs",
"home_page_in_toc": False,
"logo_only": True,
}
if html_theme == "furo":
html_css_files = [
Expand Down
17 changes: 8 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -27,26 +26,26 @@ classifiers = [
"Topic :: Text Processing :: Markup :: reStructuredText",
]
keywords = ["sphinx", "extension", "material design", "web components"]
requires-python = ">=3.7"
dependencies = ["sphinx>=4,<7"]
requires-python = ">=3.8"
dependencies = ["sphinx>=5,<8"]

[project.urls]
Homepage = "https://github.com/executablebooks/sphinx-design"
Documentation = "https://sphinx-design.readthedocs.io"

[project.optional-dependencies]
code_style = ["pre-commit~=2.12"]
rtd = ["myst-parser>=0.18.0,<2"]
code_style = ["pre-commit>=3,<4"]
rtd = ["myst-parser>=1,<3"]
testing = [
"myst-parser>=0.18.0,<2",
"myst-parser>=1,<3",
"pytest~=7.1",
"pytest-cov",
"pytest-regressions",
]
theme_furo = ["furo>=2022.06.04,<2022.07"]
theme_pydata = ["pydata-sphinx-theme~=0.9.0"]
theme_furo = ["furo~=2023.7.0"]
theme_pydata = ["pydata-sphinx-theme~=0.13.0"]
theme_rtd = ["sphinx-rtd-theme~=1.0"]
theme_sbt = ["sphinx-book-theme~=0.3.0"]
theme_sbt = ["sphinx-book-theme~=1.0"]

[tool.flit.sdist]
exclude = [
Expand Down
26 changes: 18 additions & 8 deletions tests/test_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ def test_snippets_rst(
builder.src_path.joinpath("index.rst").write_text(content, encoding="utf8")
write_assets(builder.src_path)
builder.build()
pformat = builder.get_doctree("index").pformat()
doctree = builder.get_doctree("index", post_transforms=False)
doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1
file_regression.check(
pformat,
doctree.pformat(),
basename=f"snippet_pre_{path.name[:-len(path.suffix)]}",
extension=".xml",
encoding="utf8",
Expand All @@ -56,8 +57,10 @@ def test_snippets_myst(
builder.src_path.joinpath("index.md").write_text(content, encoding="utf8")
write_assets(builder.src_path)
builder.build()
doctree = builder.get_doctree("index", post_transforms=False)
doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1
file_regression.check(
builder.get_doctree("index").pformat(),
doctree.pformat(),
basename=f"snippet_pre_{path.name[:-len(path.suffix)]}",
extension=".xml",
encoding="utf8",
Expand All @@ -78,9 +81,10 @@ def test_snippets_rst_post(
builder.src_path.joinpath("index.rst").write_text(content, encoding="utf8")
write_assets(builder.src_path)
builder.build()
pformat = builder.get_doctree("index", post_transforms=True).pformat()
doctree = builder.get_doctree("index", post_transforms=True)
doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1
file_regression.check(
pformat,
doctree.pformat(),
basename=f"snippet_post_{path.name[:-len(path.suffix)]}",
extension=".xml",
encoding="utf8",
Expand All @@ -101,8 +105,10 @@ def test_snippets_myst_post(
builder.src_path.joinpath("index.md").write_text(content, encoding="utf8")
write_assets(builder.src_path)
builder.build()
doctree = builder.get_doctree("index", post_transforms=True)
doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1
file_regression.check(
builder.get_doctree("index", post_transforms=True).pformat(),
doctree.pformat(),
basename=f"snippet_post_{path.name[:-len(path.suffix)]}",
extension=".xml",
encoding="utf8",
Expand All @@ -117,8 +123,10 @@ def test_sd_hide_title_rst(
content = ":sd_hide_title:\n\nHeading\n-------\n\ncontent"
builder.src_path.joinpath("index.rst").write_text(content, encoding="utf8")
builder.build()
doctree = builder.get_doctree("index", post_transforms=False)
doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1
file_regression.check(
builder.get_doctree("index", post_transforms=False).pformat(),
doctree.pformat(),
basename="sd_hide_title",
extension=".xml",
encoding="utf8",
Expand All @@ -133,8 +141,10 @@ def test_sd_hide_title_myst(
content = "---\nsd_hide_title: true\n---\n\n# Heading\n\ncontent"
builder.src_path.joinpath("index.md").write_text(content, encoding="utf8")
builder.build()
doctree = builder.get_doctree("index", post_transforms=False)
doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1
file_regression.check(
builder.get_doctree("index", post_transforms=False).pformat(),
doctree.pformat(),
basename="sd_hide_title",
extension=".xml",
encoding="utf8",
Expand Down
6 changes: 1 addition & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ envlist = py38
[testenv]
usedevelop = true

[testenv:py{37,38,39,310}]
[testenv:py{38,39,310,311}]
description = Run unit tests with this Python version
extras =
testing
deps =
black
flake8~=3.8
flake8-bugbear~=21.3
commands = pytest {posargs}

[testenv:docs-{update,clean}-{alabaster,rtd,pydata,sbt,furo}]
Expand Down

0 comments on commit 37a3104

Please sign in to comment.