diff --git a/.flake8 b/.flake8 deleted file mode 100644 index d8110dc..0000000 --- a/.flake8 +++ /dev/null @@ -1,4 +0,0 @@ -[flake8] -extend-ignore = E203, E402, E501, E731, E741, B950, W503 -select = C,E,F,W,B,B9 -extend-immutable-calls = typer.Argument, typer.Option diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..32180b3 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# chore: run ruff on all files +d48354b3b86ddf160e8d3359b33f32a02c565cad diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a6a70e7..7645102 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: deploy +name: Deploy on: release: @@ -15,6 +15,7 @@ concurrency: jobs: build: + name: Build distributions runs-on: ubuntu-latest permissions: contents: read @@ -26,10 +27,9 @@ jobs: - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - name: Install requirements and build wheel - shell: bash -l {0} run: | python -m pip install build - python -m build . + python -m build - name: Store the distribution packages uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 @@ -39,7 +39,7 @@ jobs: if-no-files-found: error publish-to-pypi: - name: Publish Python 🐍 distribution 📦 to PyPI + name: Publish Python 🐍 distributions 📦 to PyPI needs: - build runs-on: ubuntu-latest @@ -48,9 +48,8 @@ jobs: name: pypi url: https://pypi.org/p/auditwheel-emscripten permissions: - contents: write id-token: write # IMPORTANT: mandatory for trusted publishing - attestations: write + attestations: write # For generating artifact attestations steps: - name: Download all the dists uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9e2fb65..fe450c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: test +name: Test on: push: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b8e6ba7..7cbe59a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,41 +3,36 @@ default_language_version: python: "3.13" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v5.0.0" + rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0 hooks: - id: check-case-conflict - id: check-merge-conflict - id: check-symlinks - id: check-yaml - exclude: .clang-format - id: debug-statements - id: end-of-file-fixer - id: mixed-line-ending - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: "v3.19.1" + rev: "75992aaa40730136014f34227e0135f63fc951b4" # frozen: v3.21.2 hooks: - id: pyupgrade args: ["--py312-plus"] - repo: https://github.com/hadialqattan/pycln - rev: "v2.5.0" + rev: "c722dfaa45d90314cd1ad726bb561894321b278d" # frozen: v2.6.0 hooks: - id: pycln args: [--config=pyproject.toml] stages: [manual] - - repo: https://github.com/psf/black - rev: "25.1.0" + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "0671d8ab202c4ac093b78433ae5baf74f3fc7246" # frozen: v0.15.15 hooks: - - id: black - - - repo: https://github.com/pycqa/flake8 - rev: "7.2.0" - hooks: - - id: flake8 - additional_dependencies: [flake8-bugbear] + - id: ruff-check + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: "v1.15.0" @@ -45,19 +40,19 @@ repos: - id: mypy exclude: auditwheel_emscripten/emscripten_tools - - repo: https://github.com/shellcheck-py/shellcheck-py - rev: "v0.10.0.1" + - repo: https://github.com/koalaman/shellcheck-precommit + rev: 99470f5e12208ff0fb17ab81c3c494f7620a1d8d # frozen: v0.11.0 hooks: - id: shellcheck - repo: https://github.com/codespell-project/codespell - rev: "v2.4.1" + rev: "2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a" # frozen: v2.4.2 hooks: - id: codespell args: ["-L", "te,slowy,aray,ba,nd,classs,crate,feld,lits"] - repo: https://github.com/woodruffw/zizmor-pre-commit - rev: "v1.5.2" + rev: "9257c6050c0261b8c57e712f632dc4a8010109a9" # frozen: v1.25.2 hooks: - id: zizmor - args: ["--pedantic"] + args: ["--pedantic", "--fix=safe"] diff --git a/auditwheel_emscripten/repair.py b/auditwheel_emscripten/repair.py index a3af4c2..324e043 100644 --- a/auditwheel_emscripten/repair.py +++ b/auditwheel_emscripten/repair.py @@ -9,7 +9,9 @@ from .wheel_utils import WHEEL_INFO_RE, is_emscripten_wheel, pack, unpack -def resolve_sharedlib(wheel_file: str | Path, libdir: str | Path | list[str | Path]) -> dict[str, Path]: +def resolve_sharedlib( + wheel_file: str | Path, libdir: str | Path | list[str | Path] +) -> dict[str, Path]: """ Resolve the full path of shared libraries inside the wheel file """ diff --git a/test/test_exports.py b/test/test_exports.py index 7fd3ec8..cec8fd6 100644 --- a/test/test_exports.py +++ b/test/test_exports.py @@ -26,6 +26,6 @@ def test_exports(shared_lib, expected): export_list.append(field) for expected_export in expected: - assert ( - expected_export in export_list - ), f"expected import {expected_export} not found" + assert expected_export in export_list, ( + f"expected import {expected_export} not found" + ) diff --git a/test/test_function_type.py b/test/test_function_type.py index bad0205..d21e1a3 100644 --- a/test/test_function_type.py +++ b/test/test_function_type.py @@ -30,9 +30,9 @@ def test_get_function_type_by_idx(shared_lib, expected): if func_name in expected: function_type = get_function_type_by_idx(wasmfile, export.index) formatted = format_function_type(function_type) - assert ( - formatted == expected[func_name] - ), f"expected {expected[func_name]} but got {formatted}" + assert formatted == expected[func_name], ( + f"expected {expected[func_name]} but got {formatted}" + ) @pytest.mark.parametrize( @@ -55,6 +55,6 @@ def test_get_function_type_by_typeval(shared_lib, expected): if func_name in expected: function_type = get_function_type_by_typeval(wasmfile, _import.type) formatted = format_function_type(function_type) - assert ( - formatted == expected[func_name] - ), f"expected {expected[func_name]} but got {formatted}" + assert formatted == expected[func_name], ( + f"expected {expected[func_name]} but got {formatted}" + ) diff --git a/test/test_imports.py b/test/test_imports.py index 41fa7b5..5c6e6b0 100644 --- a/test/test_imports.py +++ b/test/test_imports.py @@ -27,6 +27,6 @@ def test_imports(shared_lib, expected): import_list.append((module, field)) for expected_import in expected: - assert ( - expected_import in import_list - ), f"expected import {expected_import} not found" + assert expected_import in import_list, ( + f"expected import {expected_import} not found" + ) diff --git a/test/test_repair.py b/test/test_repair.py index 6db2d3f..aba5164 100644 --- a/test/test_repair.py +++ b/test/test_repair.py @@ -55,9 +55,9 @@ def test_copylib(tmp_path, wheel_file, expected): copylib(extract_dir, dep_map, lib_sdir) for expected_lib in expected: - assert ( - extract_dir / lib_sdir / expected_lib - ).is_file(), f"expected lib {expected_lib} not found" + assert (extract_dir / lib_sdir / expected_lib).is_file(), ( + f"expected lib {expected_lib} not found" + ) @pytest.mark.parametrize( @@ -78,9 +78,9 @@ def test_repair(tmp_path, wheel_file, expected): libs = show(repaired_wheel) libs_dependencies = list(chain(*[dep for (dep, _) in libs.values()])) for expected_lib in expected: - assert ( - expected_lib in libs_dependencies - ), f"expected lib {expected_lib} not found in dependencies" + assert expected_lib in libs_dependencies, ( + f"expected lib {expected_lib} not found in dependencies" + ) @pytest.mark.parametrize( @@ -116,6 +116,6 @@ def test_repair_rpath(tmp_path, wheel_file, libname, expected): for lib in shared_libs: lib_dylink = parse_dylink_section(lib) libname_index = libname.index(lib.name) - assert ( - expected[libname_index] in lib_dylink.runtime_paths - ), f"expected runtime path {expected[libname_index]} not found in {lib.name}" + assert expected[libname_index] in lib_dylink.runtime_paths, ( + f"expected runtime path {expected[libname_index]} not found in {lib.name}" + ) diff --git a/test/test_show.py b/test/test_show.py index d776ac0..f9b8cec 100644 --- a/test/test_show.py +++ b/test/test_show.py @@ -36,13 +36,13 @@ def test_show(wheel_file, expected): libs_inside_wheel = libs.keys() assert libs_inside_wheel, "no libs found inside wheel" - assert all( - [lib.endswith(".so") for lib in libs_inside_wheel] - ), "not all libs are .so files" + assert all([lib.endswith(".so") for lib in libs_inside_wheel]), ( + "not all libs are .so files" + ) for expected_lib in expected: - assert ( - expected_lib in libs_inside_wheel - ), f"expected lib {expected_lib} not found" + assert expected_lib in libs_inside_wheel, ( + f"expected lib {expected_lib} not found" + ) @pytest.mark.parametrize( @@ -61,9 +61,9 @@ def test_show_dependencies(wheel_file, expected): libs_dependencies = list(chain(*[dep for (dep, _) in libs.values()])) for expected_lib in expected: - assert ( - expected_lib in libs_dependencies - ), f"expected lib {expected_lib} not found in dependencies" + assert expected_lib in libs_dependencies, ( + f"expected lib {expected_lib} not found in dependencies" + ) def test_locate_dependency():