Skip to content

Commit 0106bc8

Browse files
committed
build: Update builds
Signed-off-by: Dmitry Dygalo <[email protected]>
1 parent 53f62f0 commit 0106bc8

File tree

7 files changed

+30
-41
lines changed

7 files changed

+30
-41
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
- uses: actions/setup-python@v5
2929
with:
30-
python-version: 3.9
30+
python-version: 3.11
3131

3232
- run: pip install pre-commit
3333
- run: SKIP=fmt,cargo-check,clippy pre-commit run --all-files

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ css-inline/fuzz/corpus/
77
profiler/target/
88
bindings/*/target/
99

10+
node_modules/
11+
1012
perf.data
1113
perf.data.old
1214
trace.svg

.pre-commit-config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
default_language_version:
2-
python: python3.9
2+
python: python3.11
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.5.0
6+
rev: v4.6.0
77
hooks:
88
- id: check-yaml
99
- id: end-of-file-fixer
@@ -14,7 +14,7 @@ repos:
1414
- id: check-merge-conflict
1515

1616
- repo: https://github.com/pre-commit/mirrors-prettier
17-
rev: v3.1.0
17+
rev: v4.0.0-alpha.8
1818
hooks:
1919
- id: prettier
2020
exclude: index.d.ts|index.js|README.md|example.html|index.min.js|index.mjs|index_bg.wasm|js-binding.*
@@ -25,16 +25,16 @@ repos:
2525
- id: gitlint
2626

2727
- repo: https://github.com/adrienverge/yamllint
28-
rev: v1.33.0
28+
rev: v1.35.1
2929
hooks:
3030
- id: yamllint
3131

3232
- repo: https://github.com/astral-sh/ruff-pre-commit
33-
rev: v0.1.9
33+
rev: v0.3.7
3434
hooks:
3535
- id: ruff-format
3636

3737
- repo: https://github.com/astral-sh/ruff-pre-commit
38-
rev: v0.1.9
38+
rev: v0.3.7
3939
hooks:
4040
- id: ruff

.yamllint

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
extends: relaxed
22
rules:
33
line-length:
4-
max: 120
4+
max: 350

bindings/python/benches/bench.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
benchmark_data = json.load(f)
1717

1818

19-
def parametrize_functions(
20-
*funcs, ids=("css_inline", "premailer", "pynliner", "inlinestyler", "toronado")
21-
):
19+
def parametrize_functions(*funcs, ids=("css_inline", "premailer", "pynliner", "inlinestyler", "toronado")):
2220
return pytest.mark.parametrize("func", funcs, ids=ids)
2321

2422

bindings/python/pyproject.toml

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
[tool.black]
2-
line-length = 120
3-
target_version = ["py37"]
4-
5-
[tool.isort]
6-
# config compatible with Black
7-
line_length = 120
8-
multi_line_output = 3
9-
default_section = "THIRDPARTY"
10-
include_trailing_comma = true
11-
known_first_party = "css_inline"
12-
known_third_party = []
13-
141
[project]
152
name = "css-inline"
163
description = "High-performance library for inlining CSS into HTML 'style' attributes"
@@ -44,6 +31,17 @@ requires-python = ">=3.7"
4431
homepage = "https://github.com/Stranger6667/css-inline/tree/master/bindings/python"
4532
repository = "https://github.com/Stranger6667/css-inline"
4633

34+
[tool.ruff]
35+
line-length = 120
36+
target-version = "py37"
37+
38+
[tool.ruff.lint.isort]
39+
known-first-party = ["css_inline"]
40+
known-third-party = ["hypothesis", "pytest"]
41+
42+
[tool.ruff.format]
43+
skip-magic-trailing-comma = false
44+
4745
[build-system]
4846
requires = ["maturin>=1.1"]
4947
build-backend = "maturin"

bindings/python/tests-py/test_inlining.py

+8-17
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99

1010
def make_html(style: str, body: str) -> str:
11-
return "<html><head><style>{style}</style></head><body>{body}</body></html>".format(
12-
style=style, body=body
13-
)
11+
return "<html><head><style>{style}</style></head><body>{body}</body></html>".format(style=style, body=body)
1412

1513

1614
SAMPLE_STYLE = """h1, h2 { color:red; }
@@ -60,9 +58,7 @@ def test_inline_many_wrong_type():
6058

6159

6260
def test_missing_stylesheet():
63-
with pytest.raises(
64-
css_inline.InlineError, match="Missing stylesheet file: tests/missing.css"
65-
):
61+
with pytest.raises(css_inline.InlineError, match="Missing stylesheet file: tests/missing.css"):
6662
css_inline.inline(
6763
"""<html>
6864
<head>
@@ -198,18 +194,17 @@ def test_cache():
198194
color: blue;
199195
}
200196
"""
201-
EXPECTED_INLINED_FRAGMENT = '<main>\n<h1 style="color: blue;">Hello</h1>\n<section>\n<p style="color: red;">who am i</p>\n</section>\n</main>'
197+
EXPECTED_INLINED_FRAGMENT = (
198+
'<main>\n<h1 style="color: blue;">Hello</h1>\n<section>\n<p style="color: red;">who am i</p>\n</section>\n</main>'
199+
)
202200

203201

204202
def test_inline_fragment():
205203
assert css_inline.inline_fragment(FRAGMENT, CSS) == EXPECTED_INLINED_FRAGMENT
206204

207205

208206
def test_inline_fragment_method():
209-
assert (
210-
css_inline.CSSInliner().inline_fragment(FRAGMENT, CSS)
211-
== EXPECTED_INLINED_FRAGMENT
212-
)
207+
assert css_inline.CSSInliner().inline_fragment(FRAGMENT, CSS) == EXPECTED_INLINED_FRAGMENT
213208

214209

215210
def test_inline_many_fragments():
@@ -220,19 +215,15 @@ def test_inline_many_fragments():
220215

221216

222217
def test_inline_many_fragments_method():
223-
assert css_inline.CSSInliner().inline_many_fragments(
224-
[FRAGMENT, FRAGMENT], [CSS, CSS]
225-
) == [
218+
assert css_inline.CSSInliner().inline_many_fragments([FRAGMENT, FRAGMENT], [CSS, CSS]) == [
226219
EXPECTED_INLINED_FRAGMENT,
227220
EXPECTED_INLINED_FRAGMENT,
228221
]
229222

230223

231224
@pytest.mark.parametrize("size", (0, -1, "foo"))
232225
def test_invalid_cache(size):
233-
with pytest.raises(
234-
ValueError, match="Cache size must be an integer greater than zero"
235-
):
226+
with pytest.raises(ValueError, match="Cache size must be an integer greater than zero"):
236227
css_inline.StylesheetCache(size=size)
237228

238229

0 commit comments

Comments
 (0)