Skip to content

Chore: align Black/flake8/isort (or Ruff) and normalise formatting across meshflow-bot + meshflow-api #101

@pskillen

Description

@pskillen

Summary

Meshflow Python repos (meshflow-bot, meshflow-api) should share one documented formatting/lint toolchain and quote policy, then land the inevitable large mechanical formatting PR once—not as drive-by churn on feature branches.

Do not start this until explicitly scheduled. Feature work (e.g. bot version reporting) should stay off a repo-wide reformat branch.

Background

  • Black normalises strings to double quotes; it has no single-quote mode. skip-string-normalization only preserves existing quotes.
  • flake8-quotes can enforce single quotes, but does not auto-fix the whole tree.
  • meshflow-bot largely uses single quotes today; meshflow-api CI historically used double in .flake8 while much code is mixed.
  • Partial config already landed on some branches (pyproject.toml skip-string-normalization, bot .flake8, dev deps)—this ticket is to finish the policy, align both repos, and run the big format pass deliberately.

Options to decide in planning (not now)

Approach Pros Cons
Stay on Black + flake8-quotes + isort Minimal CI change No auto-format to single; huge manual or one-off script
Ruff format + check (quote-style = "single") Single tool, Black-like layout, configurable quotes CI/skill doc migration; team learns ruff commands

Recommendation to evaluate when picking up: Ruff if the goal is consistent single quotes with one formatter; Black + flake8-quotes if the goal is minimal tool churn and lint-only enforcement.

Scope — meshflow-api

  • Agree quote policy: single inline/multiline code strings; double docstrings (or document alternative).
  • Single source of truth: Meshflow/pyproject.toml + Meshflow/.flake8 (or Ruff-only config).
  • Align requirements.dev.txt / PR workflow (black --check, isort, flake8) with bot.
  • Update meshflow-api/.cursor/skills/meshflow-git-workflow pre-commit section if commands change.
  • One dedicated PR: run formatter/linter across Meshflow/ (exclude migrations per existing force-exclude / policy).
  • Confirm CI green; no behaviour changes expected.

Scope — meshflow-bot

  • Mirror API config (pyproject.toml, .flake8, requirements.dev.txt).
  • Add CI lint job if missing (today: pytest only in unit-tests.yaml).
  • Same quote policy as API.
  • One dedicated PR: format src/ + test/.
  • Update bot meshflow-git-workflow skill if needed.

Out of scope (this ticket)

  • meshflow-ui (Prettier/ESLint—separate concern).
  • Reformatting on unrelated feature branches.
  • Changing runtime behaviour or API contracts.

Expected outcome

  • Both repos document the same commands in README or AGENTS.md.
  • One formatting PR per repo (or one coordinated merge order: agree config PRs first, then format PRs).
  • Future PRs fail CI if quotes/style drift.

Risks

  • Large diff → painful merges with in-flight branches; coordinate freeze or merge main first.
  • Blame noise on git blame → optional .git-blame-ignore-revs entry after format commit.

Test plan (when implemented)

  • black/ruff format --check (or equivalent) passes in both repos.
  • flake8 / ruff check passes in both repos.
  • isort --check-only passes (or Ruff import sorting).
  • Existing unit test suites unchanged (pytest).

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions