Skip to content

Commit a47761a

Browse files
Merge pull request #60 from agriyakhetarpal/update-pre-commit
* Update Zizmor version, add `fix=safe`, fix issues * Update pre-commit hooks and their versions * Lint all files with Ruff * Ignore Ruff linter commit
2 parents 955fbbd + 4e60edf commit a47761a

11 files changed

Lines changed: 54 additions & 60 deletions

File tree

.flake8

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

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# chore: run ruff on all files
2+
d48354b3b86ddf160e8d3359b33f32a02c565cad

.github/workflows/deploy.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: deploy
1+
name: Deploy
22

33
on:
44
release:
@@ -15,6 +15,7 @@ concurrency:
1515

1616
jobs:
1717
build:
18+
name: Build distributions
1819
runs-on: ubuntu-latest
1920
permissions:
2021
contents: read
@@ -26,10 +27,9 @@ jobs:
2627
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2728

2829
- name: Install requirements and build wheel
29-
shell: bash -l {0}
3030
run: |
3131
python -m pip install build
32-
python -m build .
32+
python -m build
3333
3434
- name: Store the distribution packages
3535
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -39,7 +39,7 @@ jobs:
3939
if-no-files-found: error
4040

4141
publish-to-pypi:
42-
name: Publish Python 🐍 distribution 📦 to PyPI
42+
name: Publish Python 🐍 distributions 📦 to PyPI
4343
needs:
4444
- build
4545
runs-on: ubuntu-latest
@@ -48,9 +48,8 @@ jobs:
4848
name: pypi
4949
url: https://pypi.org/p/auditwheel-emscripten
5050
permissions:
51-
contents: write
5251
id-token: write # IMPORTANT: mandatory for trusted publishing
53-
attestations: write
52+
attestations: write # For generating artifact attestations
5453
steps:
5554
- name: Download all the dists
5655
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test
1+
name: Test
22

33
on:
44
push:

.pre-commit-config.yaml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,56 @@ default_language_version:
33
python: "3.13"
44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: "v5.0.0"
6+
rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0
77
hooks:
88
- id: check-case-conflict
99
- id: check-merge-conflict
1010
- id: check-symlinks
1111
- id: check-yaml
12-
exclude: .clang-format
1312
- id: debug-statements
1413
- id: end-of-file-fixer
1514
- id: mixed-line-ending
1615
- id: trailing-whitespace
1716

1817
- repo: https://github.com/asottile/pyupgrade
19-
rev: "v3.19.1"
18+
rev: "75992aaa40730136014f34227e0135f63fc951b4" # frozen: v3.21.2
2019
hooks:
2120
- id: pyupgrade
2221
args: ["--py312-plus"]
2322

2423
- repo: https://github.com/hadialqattan/pycln
25-
rev: "v2.5.0"
24+
rev: "c722dfaa45d90314cd1ad726bb561894321b278d" # frozen: v2.6.0
2625
hooks:
2726
- id: pycln
2827
args: [--config=pyproject.toml]
2928
stages: [manual]
3029

31-
- repo: https://github.com/psf/black
32-
rev: "25.1.0"
30+
- repo: https://github.com/astral-sh/ruff-pre-commit
31+
rev: "0671d8ab202c4ac093b78433ae5baf74f3fc7246" # frozen: v0.15.15
3332
hooks:
34-
- id: black
35-
36-
- repo: https://github.com/pycqa/flake8
37-
rev: "7.2.0"
38-
hooks:
39-
- id: flake8
40-
additional_dependencies: [flake8-bugbear]
33+
- id: ruff-check
34+
args: [--fix, --exit-non-zero-on-fix]
35+
- id: ruff-format
4136

4237
- repo: https://github.com/pre-commit/mirrors-mypy
4338
rev: "v1.15.0"
4439
hooks:
4540
- id: mypy
4641
exclude: auditwheel_emscripten/emscripten_tools
4742

48-
- repo: https://github.com/shellcheck-py/shellcheck-py
49-
rev: "v0.10.0.1"
43+
- repo: https://github.com/koalaman/shellcheck-precommit
44+
rev: 99470f5e12208ff0fb17ab81c3c494f7620a1d8d # frozen: v0.11.0
5045
hooks:
5146
- id: shellcheck
5247

5348
- repo: https://github.com/codespell-project/codespell
54-
rev: "v2.4.1"
49+
rev: "2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a" # frozen: v2.4.2
5550
hooks:
5651
- id: codespell
5752
args: ["-L", "te,slowy,aray,ba,nd,classs,crate,feld,lits"]
5853

5954
- repo: https://github.com/woodruffw/zizmor-pre-commit
60-
rev: "v1.5.2"
55+
rev: "9257c6050c0261b8c57e712f632dc4a8010109a9" # frozen: v1.25.2
6156
hooks:
6257
- id: zizmor
63-
args: ["--pedantic"]
58+
args: ["--pedantic", "--fix=safe"]

auditwheel_emscripten/repair.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
from .wheel_utils import WHEEL_INFO_RE, is_emscripten_wheel, pack, unpack
1010

1111

12-
def resolve_sharedlib(wheel_file: str | Path, libdir: str | Path | list[str | Path]) -> dict[str, Path]:
12+
def resolve_sharedlib(
13+
wheel_file: str | Path, libdir: str | Path | list[str | Path]
14+
) -> dict[str, Path]:
1315
"""
1416
Resolve the full path of shared libraries inside the wheel file
1517
"""

test/test_exports.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ def test_exports(shared_lib, expected):
2626
export_list.append(field)
2727

2828
for expected_export in expected:
29-
assert (
30-
expected_export in export_list
31-
), f"expected import {expected_export} not found"
29+
assert expected_export in export_list, (
30+
f"expected import {expected_export} not found"
31+
)

test/test_function_type.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def test_get_function_type_by_idx(shared_lib, expected):
3030
if func_name in expected:
3131
function_type = get_function_type_by_idx(wasmfile, export.index)
3232
formatted = format_function_type(function_type)
33-
assert (
34-
formatted == expected[func_name]
35-
), f"expected {expected[func_name]} but got {formatted}"
33+
assert formatted == expected[func_name], (
34+
f"expected {expected[func_name]} but got {formatted}"
35+
)
3636

3737

3838
@pytest.mark.parametrize(
@@ -55,6 +55,6 @@ def test_get_function_type_by_typeval(shared_lib, expected):
5555
if func_name in expected:
5656
function_type = get_function_type_by_typeval(wasmfile, _import.type)
5757
formatted = format_function_type(function_type)
58-
assert (
59-
formatted == expected[func_name]
60-
), f"expected {expected[func_name]} but got {formatted}"
58+
assert formatted == expected[func_name], (
59+
f"expected {expected[func_name]} but got {formatted}"
60+
)

test/test_imports.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ def test_imports(shared_lib, expected):
2727
import_list.append((module, field))
2828

2929
for expected_import in expected:
30-
assert (
31-
expected_import in import_list
32-
), f"expected import {expected_import} not found"
30+
assert expected_import in import_list, (
31+
f"expected import {expected_import} not found"
32+
)

test/test_repair.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def test_copylib(tmp_path, wheel_file, expected):
5555
copylib(extract_dir, dep_map, lib_sdir)
5656

5757
for expected_lib in expected:
58-
assert (
59-
extract_dir / lib_sdir / expected_lib
60-
).is_file(), f"expected lib {expected_lib} not found"
58+
assert (extract_dir / lib_sdir / expected_lib).is_file(), (
59+
f"expected lib {expected_lib} not found"
60+
)
6161

6262

6363
@pytest.mark.parametrize(
@@ -78,9 +78,9 @@ def test_repair(tmp_path, wheel_file, expected):
7878
libs = show(repaired_wheel)
7979
libs_dependencies = list(chain(*[dep for (dep, _) in libs.values()]))
8080
for expected_lib in expected:
81-
assert (
82-
expected_lib in libs_dependencies
83-
), f"expected lib {expected_lib} not found in dependencies"
81+
assert expected_lib in libs_dependencies, (
82+
f"expected lib {expected_lib} not found in dependencies"
83+
)
8484

8585

8686
@pytest.mark.parametrize(
@@ -116,6 +116,6 @@ def test_repair_rpath(tmp_path, wheel_file, libname, expected):
116116
for lib in shared_libs:
117117
lib_dylink = parse_dylink_section(lib)
118118
libname_index = libname.index(lib.name)
119-
assert (
120-
expected[libname_index] in lib_dylink.runtime_paths
121-
), f"expected runtime path {expected[libname_index]} not found in {lib.name}"
119+
assert expected[libname_index] in lib_dylink.runtime_paths, (
120+
f"expected runtime path {expected[libname_index]} not found in {lib.name}"
121+
)

0 commit comments

Comments
 (0)