Skip to content

build: migrate linting from flake8, isort, and black to ruff - #706

Open
hasansezertasan wants to merge 4 commits into
python-escpos:masterfrom
hasansezertasan:migrate/ruff
Open

build: migrate linting from flake8, isort, and black to ruff#706
hasansezertasan wants to merge 4 commits into
python-escpos:masterfrom
hasansezertasan:migrate/ruff

Conversation

@hasansezertasan

@hasansezertasan hasansezertasan commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

Summary

Migrate the project's linting and formatting toolchain from flake8, isort, and black to a single tool: ruff.

Changes

  • pyproject.toml: add [tool.ruff] config (line length 120, E/F/W/D/I lint rules, pep257 docstring convention, mccabe complexity, LF line endings); remove [tool.black] and [tool.isort].
  • setup.cfg: replace flake8 with ruff in test dependencies; drop the [flake8] section.
  • tox: replace the flake8 env with a style env that runs ruff check and ruff format.
  • CI: add style.yml (runs ruff via astral-sh/ruff-action) and remove black.yml; drop the now-unneeded flake8 install from the package workflows.
  • Apply ruff format / ruff check --fix across the source tree.

Notes

  • Conflicts with the Housekeeping 2026 refactor on master have been resolved by keeping master's pyproject.toml-based tox configuration and reapplying the ruff migration on top of it.

Related to #703

@codecov

codecov Bot commented Sep 7, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.85246% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.06%. Comparing base (6e8029f) to head (086eb21).

Files with missing lines Patch % Lines
src/escpos/cli.py 10.00% 9 Missing ⚠️
src/escpos/escpos.py 80.00% 5 Missing ⚠️
src/escpos/config.py 66.66% 1 Missing ⚠️
src/escpos/magicencode.py 83.33% 1 Missing ⚠️
src/escpos/printer/lp.py 0.00% 1 Missing ⚠️
src/escpos/printer/usb.py 75.00% 1 Missing ⚠️
src/escpos/printer/win32raw.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #706      +/-   ##
==========================================
- Coverage   79.07%   79.06%   -0.02%     
==========================================
  Files          21       21              
  Lines        1754     1753       -1     
  Branches      243      243              
==========================================
- Hits         1387     1386       -1     
  Misses        286      286              
  Partials       81       81              
Flag Coverage Δ
unittests 79.06% <68.85%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/escpos/capabilities.py 81.72% <100.00%> (ø)
src/escpos/printer/cups.py 89.36% <100.00%> (ø)
src/escpos/printer/file.py 92.85% <100.00%> (ø)
src/escpos/printer/network.py 82.97% <100.00%> (ø)
src/escpos/printer/serial.py 77.46% <100.00%> (ø)
src/escpos/config.py 89.28% <66.66%> (ø)
src/escpos/magicencode.py 90.55% <83.33%> (ø)
src/escpos/printer/lp.py 78.12% <0.00%> (ø)
src/escpos/printer/usb.py 58.24% <75.00%> (ø)
src/escpos/printer/win32raw.py 90.00% <66.66%> (ø)
... and 2 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hasansezertasan
hasansezertasan marked this pull request as ready for review July 27, 2026 15:19
Resolve conflicts from the 'Housekeeping 2026' refactor on master:
- Drop black/isort config and the flake8 tox env from pyproject.toml;
  keep master's pyproject-based tox config and add a ruff 'style' env
- Replace flake8 with ruff in setup.cfg; drop the [flake8] section
- Remove black.yml (superseded by style.yml) and drop tox.ini
  (tox config now lives in pyproject.toml)
- Keep tox-gh in CI workflows; drop the now-unneeded flake8 install
- Take master's source changes and reapply ruff format/lint
@hasansezertasan hasansezertasan changed the title migrate(ruff): migrate from flake8, isort, and black to ruff build: migrate linting from flake8, isort, and black to ruff Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant