Skip to content

Commit c34a616

Browse files
authored
docs: Python 3.12 compatibility (#1123)
* docs: Python 3.12 compatibility * docs: make 3.10 backwards compatible * docs: remove print * docs: update changelog * chore: replace flake8 for ruff * downgrade minimum python version * add back setuptools * move setuptools as a dependency
1 parent 5fbefec commit c34a616

File tree

24 files changed

+308
-332
lines changed

24 files changed

+308
-332
lines changed

.flake8

Lines changed: 0 additions & 3 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,26 @@ repos:
99
args: ["build"]
1010
language: system
1111
pass_filenames: false
12-
- repo: https://github.com/psf/black
13-
rev: 23.9.1
14-
hooks:
15-
- id: black
1612

1713
- repo: https://github.com/pycqa/isort
18-
rev: 5.12.0
14+
rev: 5.13.2
1915
hooks:
2016
- id: isort
2117

22-
- repo: https://github.com/pre-commit/mirrors-prettier
23-
rev: v3.0.3
24-
hooks:
25-
- id: prettier
26-
2718
- repo: https://github.com/rtts/djhtml
2819
rev: 3.0.6
2920
hooks:
3021
- id: djhtml
3122

32-
- repo: https://github.com/pycqa/flake8
33-
rev: "6.1.0"
23+
- repo: https://github.com/astral-sh/ruff-pre-commit
24+
rev: v0.5.0
3425
hooks:
35-
- id: flake8
26+
- id: ruff
27+
args: [ --fix ]
28+
- id: ruff-format
3629

3730
- repo: https://github.com/pre-commit/pre-commit-hooks
38-
rev: v4.4.0
31+
rev: v4.6.0
3932
hooks:
4033
- id: end-of-file-fixer
4134
- id: trailing-whitespace

.ruff.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
line-length = 88
2+
exclude = ["sphinx_scylladb_theme/lexers/cql.py"]

docs/_utils/pyproject_template.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ version = "0.1.0"
55
authors = ["ScyllaDB Documentation Contributors"]
66

77
[tool.poetry.dependencies]
8-
python = "^3.9"
9-
pyyaml = "6.0.1"
10-
pygments = "2.15.1"
8+
python = "^3.10"
9+
pygments = "2.18.0"
1110
sphinx-scylladb-theme = "~1.6.1"
12-
myst-parser = "2.0.0"
13-
sphinx-autobuild = "2021.3.14"
14-
Sphinx = "7.2.6"
11+
myst-parser = "3.0.1"
12+
sphinx-autobuild = "2024.4.16"
13+
Sphinx = "7.3.7"
1514
sphinx-multiversion-scylla = "^0.3.1"
16-
sphinx-sitemap = "2.5.1"
15+
sphinx-sitemap = "2.6.0"
1716
redirects_cli ="~0.1.3"
1817

1918
[build-system]

docs/source/upgrade/CHANGELOG.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,26 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 1.7.3 - 25 Jun 2024
9+
10+
### Updated
11+
12+
- [#1123](https://github.com/scylladb/sphinx-scylladb-theme/pull/1123): Compatibility with Python 3.12.
13+
- [#1123](https://github.com/scylladb/sphinx-scylladb-theme/pull/1123): Replaced Flake8 with Ruff for faster code linting.
14+
15+
### Removed
16+
17+
- [#1123](https://github.com/scylladb/sphinx-scylladb-theme/pull/1123): Deprecate Prettier for code linting (pre-commit).
18+
819
## 1.7.2 - 30 Apr 2024
920

1021
### Added
1122

12-
- Option to override the "Create an issue" label per project.
23+
- [#1093](https://github.com/scylladb/sphinx-scylladb-theme/pull/1093): Option to override the "Create an issue" label per project.
1324

1425
### Fixed
1526

16-
- Right sidebar scroll highlighting.
27+
- [#1092](https://github.com/scylladb/sphinx-scylladb-theme/pull/1092): Right sidebar scroll highlighting.
1728

1829

1930
## 1.7.1 - 12 Apr 2024

extensions/sphinx-scylladb-markdown/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"sphinx >= 2.1",
2121
"recommonmark == 0.7.1",
2222
"sphinx-markdown-tables == 0.0.17",
23-
"myst-parser >= 2.0.0"
23+
"myst-parser >= 2.0.0",
2424
],
2525
packages=["sphinx_scylladb_markdown"],
2626
)

extensions/sphinx-scylladb-markdown/sphinx_scylladb_markdown/__init__.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,60 @@
11
# -*- coding: utf-8 -*-
22
import os
3+
34
from recommonmark.transform import AutoStructify
45

56
__version__ = "0.1.3"
67

8+
79
class BaseParser:
810
def __init__(self, app):
911
self.app = app
1012

1113
def setup(self):
1214
raise NotImplementedError
1315

16+
1417
class RecommonmarkParser(BaseParser):
1518
def setup(self):
1619
try:
17-
self.app.setup_extension('recommonmark')
18-
self.app.setup_extension('sphinx_markdown_tables')
20+
self.app.setup_extension("recommonmark")
21+
self.app.setup_extension("sphinx_markdown_tables")
1922

20-
self.app.add_config_value('recommonmark_config', {
21-
'enable_eval_rst': True,
22-
'enable_auto_toc_tree': False,
23-
}, True)
23+
self.app.add_config_value(
24+
"recommonmark_config",
25+
{
26+
"enable_eval_rst": True,
27+
"enable_auto_toc_tree": False,
28+
},
29+
True,
30+
)
2431
self.app.add_transform(AutoStructify)
2532
except ImportError:
26-
raise RuntimeError("recommonmark and sphinx_markdown_tables are not installed!")
33+
raise RuntimeError(
34+
"recommonmark and sphinx_markdown_tables are not installed!"
35+
)
36+
2737

2838
class MystParser(BaseParser):
2939
def setup(self):
3040
try:
31-
self.app.setup_extension('myst_parser')
41+
self.app.setup_extension("myst_parser")
3242
self.app.config.myst_enable_extensions = ["colon_fence"]
3343
self.app.config.myst_heading_anchors = 6
3444

3545
except ImportError:
3646
raise RuntimeError("myst-parser is not installed")
3747

48+
3849
def select_parser(app, config):
3950
if not config.scylladb_markdown_enable:
4051
return
4152

42-
current_version = os.environ.get('SPHINX_MULTIVERSION_NAME', 'stable')
53+
current_version = os.environ.get("SPHINX_MULTIVERSION_NAME", "stable")
4354

4455
config.source_suffix = {
45-
'.rst': 'restructuredtext',
46-
'.md': 'markdown',
56+
".rst": "restructuredtext",
57+
".md": "markdown",
4758
}
4859

4960
if current_version in config.scylladb_markdown_recommonmark_versions:
@@ -53,10 +64,11 @@ def select_parser(app, config):
5364

5465
parser.setup()
5566

67+
5668
def setup(app):
57-
app.add_config_value('scylladb_markdown_enable', True, 'env')
58-
app.add_config_value('scylladb_markdown_recommonmark_versions', [], 'env')
59-
app.connect('config-inited', select_parser)
69+
app.add_config_value("scylladb_markdown_enable", True, "env")
70+
app.add_config_value("scylladb_markdown_recommonmark_versions", [], "env")
71+
app.connect("config-inited", select_parser)
6072

6173
return {
6274
"version": "0.1",

0 commit comments

Comments
 (0)