Skip to content

Commit

Permalink
Update template (#12)
Browse files Browse the repository at this point in the history
* Update template

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Fix test workflow

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Debug

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Debug

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Fix environments

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Drop PyPy support

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Revert "Debug"

This reverts commit 7cd89f0.

* Revert "Debug"

This reverts commit d8f1bc4.

* Fix typing

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Ignore annoying typing error

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

---------

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
  • Loading branch information
astrojuanlu authored Oct 1, 2024
1 parent d77aaa1 commit 8cb4070
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v2024.02.1
_commit: v2024.09.1
_src_path: gh:astrojuanlu/copier-pylib
author_email: juan_luis_cano@mckinsey.com
author_name: Juan Luis Cano Rodríguez
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ jobs:
id-token: write
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: '3.8'
- name: Install uv
run: python -m pip install uv
- name: Install build dependencies
run: python -m pip install build
run: uv pip install --system build
- name: Build package
run: python -m build
- name: Publish to PyPI
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: python -m pip install uv
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
uv pip install --system tox tox-uv tox-gh-actions
- name: Test with tox
run: tox
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
- id: check-merge-conflict

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.2
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ make sure that you **read our code of conduct** (`CODE_OF_CONDUCT.md`).
2. Set up and activate a Python development environment
(advice: use [venv](https://docs.python.org/3/library/venv.html),
[virtualenv](https://virtualenv.pypa.io/), or [miniconda](https://docs.conda.io/en/latest/miniconda.html))
3. Install tox: `python -m pip install tox`
3. Install tox: `uv tool install tox`
4. Make sure the tests run: `tox -e py38`
(change the version number according to the Python you are using)
5. Start a new branch: `git switch -c new-branch main`
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ Sphinx theme for the Kedro ecosystem
To install, run

```
(.venv) $ pip install kedro-sphinx-theme
$ uv pip install kedro-sphinx-theme
```

## Development

To run style checks:

```
(.venv) $ pip install pre-commit
(.venv) $ pre-commit run -a
$ uv tool install pre-commit
$ pre-commit run -a
```

## Overview
Expand Down
12 changes: 6 additions & 6 deletions src/kedro_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
THEME_PATH = (Path(__file__).parent / "theme" / "kedro-sphinx-theme").resolve()


def env_override(default_appid):
def env_override(default_appid: str) -> str:
"""Override Heap ID based on the build version."""
build_version = os.getenv("READTHEDOCS_VERSION")

Expand All @@ -24,7 +24,7 @@ def env_override(default_appid):
return default_appid # default to Development for local builds


def _add_jinja_filters(app):
def _add_jinja_filters(app: Sphinx) -> None:
# https://github.com/crate/crate/issues/10833
from sphinx.builders.latex import LaTeXBuilder
from sphinx.builders.linkcheck import CheckExternalLinksBuilder
Expand All @@ -35,14 +35,14 @@ def _add_jinja_filters(app):
app.builder.templates.environment.filters["env_override"] = env_override


def _override_permalinks_icon(app):
def _override_permalinks_icon(app: Sphinx) -> None:
# https://github.com/readthedocs/sphinx_rtd_theme/issues/98#issuecomment-1503211439
app.config.html_permalinks_icon = "¶"
app.config.html_permalinks_icon = "¶" # type: ignore


def setup(app: Sphinx):
def setup(app: Sphinx) -> None:
"""Register theme."""
app.add_html_theme("kedro-sphinx-theme", THEME_PATH)
app.add_html_theme("kedro-sphinx-theme", THEME_PATH.as_posix())

app.connect("builder-inited", _add_jinja_filters)
app.connect("builder-inited", _override_permalinks_icon)
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
env_list =
check
docs
{py3}{,-coverage}
py{38,39,310,311,312}{,-coverage}

[gh-actions]
python =
Expand All @@ -14,7 +14,6 @@ python =

[testenv]
basepython =
pypy3: pypy3
py38: python3.8
py39: python3.9
py310: python3.10
Expand Down

0 comments on commit 8cb4070

Please sign in to comment.