Skip to content

ci: use Ruff for Python quality checks#331

Open
okt-limonikas wants to merge 8 commits into
ts-factory:mainfrom
okt-limonikas:fix-ci
Open

ci: use Ruff for Python quality checks#331
okt-limonikas wants to merge 8 commits into
ts-factory:mainfrom
okt-limonikas:fix-ci

Conversation

@okt-limonikas

@okt-limonikas okt-limonikas commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

We have a lot of tools for handling formatting, quotes etc, do pre-commit checks etc.
Black and ruff have conflicts currently so CI is almost always in failed state in each new PR.

We should just use ruff for running lint and formatting checks.
Also added to readme instruction on how to setup pre-commit check

Changed config to prefer double quotes for docstring as advised in PEP 257

Changes:

  • Replace separate Black, Flynt, Flake8, and Ruff CI jobs with a single Ruff quality check job.
  • Simplify scripts/pyformat so it uses Ruff only for formatting and linting.
  • Keep pre-commit wired through scripts/pyformat -c, but rename the hook to Ruff Python Quality.
  • Move formatter ownership from Black to Ruff in pyproject.toml.
  • Remove replaced formatting/lint dependencies from requirements.txt.
  • Update scripts/pyanalyze and README docs to reflect Ruff-based checks.

Comment thread pyproject.toml
okt-limonikas added a commit to okt-limonikas/bublik that referenced this pull request Jun 16, 2026
Link: https://peps.python.org/pep-0257/
Link: ts-factory#331
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
okt-limonikas added a commit to okt-limonikas/bublik that referenced this pull request Jun 16, 2026
Link: https://peps.python.org/pep-0257/
Link: ts-factory#331
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
okt-limonikas added a commit to okt-limonikas/bublik that referenced this pull request Jun 17, 2026
Link:
ts-factory#331 (comment)
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
okt-limonikas added a commit to okt-limonikas/bublik that referenced this pull request Jun 17, 2026
Link:
ts-factory#331 (comment)
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>

@ol-nata ol-nata left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I'd prefer not to reformat existing migrations. They are historical artifacts, and formatting them adds a lot of noise with little practical benefit. It also makes reviews and git blame less useful.

  2. I don’t think splitting commits by tool (ruff format / ruff check --fix) is useful for review or Git history.

    Each commit mixes multiple unrelated kinds of changes, which makes review and later debugging harder. I’d suggest splitting commits by intent instead, so each commit represents a single coherent change that can be reviewed, reverted, or bisected safely:

    • formatting-only changes (quote style ' → ", docstring quote changes, f-string quote normalization, import ordering, whitespace changes)
    • safe lint fixes (removal of unused imports like DeepHash, Meta, TestIterationResult, unused serializers, minor cleanups)
    • code simplifications (removal of else after return, class X(object) → class X, small expression simplifications)
    • potential logic-affecting changes (changes in conditions/loops/lambdas, variable replacements)

    This would make the history more atomic and significantly improve reviewability and git bisect usability.

Comment thread bublik/core/testing_coverage.py Outdated
Changes:
- Replace separate Black, Flynt, Flake8, and Ruff CI jobs with a single
Ruff quality check job.
- Simplify `scripts/pyformat` so it uses Ruff only for formatting and
linting.
- Keep pre-commit wired through `scripts/pyformat -c`, but rename the
hook to `Ruff Python Quality`.
- Remove replaced formatting/lint dependencies from `requirements.txt`.
- Update `scripts/pyanalyze` and README docs to reflect Ruff-based
checks.

Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
Link: https://peps.python.org/pep-0257/
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
@okt-limonikas

Copy link
Copy Markdown
Collaborator Author
  1. I'd prefer not to reformat existing migrations. They are historical artifacts, and formatting them adds a lot of noise with little practical benefit. It also makes reviews and git blame less useful.

  2. I don’t think splitting commits by tool (ruff format / ruff check --fix) is useful for review or Git history.
    Each commit mixes multiple unrelated kinds of changes, which makes review and later debugging harder. I’d suggest splitting commits by intent instead, so each commit represents a single coherent change that can be reviewed, reverted, or bisected safely:

    • formatting-only changes (quote style ' → ", docstring quote changes, f-string quote normalization, import ordering, whitespace changes)
    • safe lint fixes (removal of unused imports like DeepHash, Meta, TestIterationResult, unused serializers, minor cleanups)
    • code simplifications (removal of else after return, class X(object) → class X, small expression simplifications)
    • potential logic-affecting changes (changes in conditions/loops/lambdas, variable replacements)

    This would make the history more atomic and significantly improve reviewability and git bisect usability.

Should be done

okt-limonikas added a commit to okt-limonikas/bublik that referenced this pull request Jun 18, 2026
Link: https://peps.python.org/pep-0257/
Link: ts-factory#331
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
@okt-limonikas okt-limonikas requested a review from ol-nata June 18, 2026 00:53
Replacing `packages[i]` with package is not guaranteed to be equivalent
due to potential index shifts during iteration so ignore it.

Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
okt-limonikas added a commit to okt-limonikas/bublik that referenced this pull request Jun 18, 2026
Link: https://peps.python.org/pep-0257/
Link: ts-factory#331
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
okt-limonikas added a commit to okt-limonikas/bublik that referenced this pull request Jun 18, 2026
Link: https://peps.python.org/pep-0257/
Link: ts-factory#331
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
okt-limonikas added a commit to okt-limonikas/bublik that referenced this pull request Jun 18, 2026
Link: https://peps.python.org/pep-0257/
Link: ts-factory#331
Signed-off-by: Danil Kostromin <danil.kostromin@icloud.com>
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.

2 participants