Skip to content

python: restore formatting for ty-based modules#476

Merged
ryantm merged 1 commit intomainfrom
zerg/restore-python-formatting
Mar 13, 2026
Merged

python: restore formatting for ty-based modules#476
ryantm merged 1 commit intomainfrom
zerg/restore-python-formatting

Conversation

@ryantm
Copy link
Collaborator

@ryantm ryantm commented Mar 12, 2026

Why

Switching Python modules from pyright-extended to ty removed formatting support in the default Python module experience.

What changed

  • Added a Ruff formatter to the ty module via replit.dev.formatters.ruff.
  • Added a run-ruff-format wrapper that understands our formatter option contract (--stdin, --apply, and --file).
  • Updated python modules to import ../ty so ty language-server + formatter behavior is shared in one place.
  • Made ty module metadata and PATH defaults use lib.mkDefault so it can be safely imported into other modules.

Test plan

  • direnv exec /home/developer/replit/nixmodules nix build --no-link --print-out-paths '.#activeModules.\"python-3.11\"' '.#activeModules.ty'
  • Confirmed the build succeeds and emits both module artifacts.
  • Confirmed the run-ruff-format derivation check phase passes for both stdout formatting and --apply mode.

Revertibility

Safe to revert. This change only affects module wiring and formatter configuration and does not modify stateful data or irreversible behavior.

Rollout

  • This is fully backward and forward compatible

~ written by Zerg 👾

@ryantm ryantm added the zergling-authored Authored by Zerg agent label Mar 12, 2026
@ryantm ryantm marked this pull request as ready for review March 13, 2026 00:01
@ryantm ryantm requested a review from a team as a code owner March 13, 2026 00:01
@ryantm ryantm requested review from airportyh and removed request for a team March 13, 2026 00:01
@ryantm ryantm merged commit 4110eba into main Mar 13, 2026
3 checks passed
@ryantm ryantm deleted the zerg/restore-python-formatting branch March 13, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zergling-authored Authored by Zerg agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants