diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6d056faa..fd4cbf0b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -27,9 +27,7 @@ jobs: enable-cache: true activate-environment: true - name: Lint with Ruff - run: | - uv tool install ruff - uv run ruff check --output-format=github . + run: uvx ruff check --output-format=github . continue-on-error: false - name: Install dependencies diff --git a/pyproject.toml b/pyproject.toml index 0e815b3d..ba5e18fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,6 +87,15 @@ target-version = "py39" # "UP", # "W", #] +# Pin the rule set explicitly - ruff 0.16 widened its defaults from 2 to 38 rule +# prefixes, so relying on the defaults makes lint results depend on the ruff version. +select = [ + "E4", + "E7", + "E9", + "F", + "I", +] ignore = [ "PLR0915", "PLR0912", diff --git a/src/pyff/builtins.py b/src/pyff/builtins.py index 9c560956..a3a69ae2 100644 --- a/src/pyff/builtins.py +++ b/src/pyff/builtins.py @@ -551,6 +551,11 @@ def _nop(x): resource_name = m.group(2) out = output_file data = req.t + + # clean unused namespaces - the working document isn't always XML (eg discojson* produce JSON) + if isinstance(data, (etree._Element, etree._ElementTree)): + etree.cleanup_namespaces(data) + if not req.args.get('raw'): data = dumptree(req.t, pretty_print=req.args.get('pretty_print'))