Skip to content

✨ feat: add PyPI-backed oxfmt pre-commit mirror - #1

Merged
SigureMo merged 1 commit into
mainfrom
feature/add-oxfmt-hook
Sep 30, 2026
Merged

SigureMo merged 1 commit into
mainfrom
feature/add-oxfmt-hook

Conversation

@ShigureNyako

Copy link
Copy Markdown
Member

Summary

Requested in redai-studio/Relax#392 comment. This PR creates the Python-ecosystem hook only; Relax is intentionally unchanged.

  • Follow the existing typos mirror / yamlfmt mirror layout: pyproject.toml, .pre-commit-hooks.yaml, mirror.py, README, Mirror/Release workflows. Preserve the copied MIT license attribution.
  • Pin oxfmt-mirror to the existing PyPI oxfmt==0.69.0. No new binary wrapper, Node/npm dependency, or PyPI publishing workflow.
  • Preserve upstream oxfmt hook entry/options/file selection; change installation language to python.
  • Reuse the existing daily mirror and GitHub release workflows unchanged. The updater only differs by package name and two small safeguards: skip empty/fully-yanked releases, and stop on failed Git commands before tagging.

The PyPI package is an unofficial repackaging by dhruvkb/oxc-py. Its macOS ARM64 executable was verified byte-for-byte against the official Oxc release containing oxfmt 0.69.0. We do not use oxfmt-bin, whose package version 1.81.0 corresponds to the older formatter 0.66.0.

Validation

Validated commit 914802aa346129657ae434bb5319225f8f1f78c2 on macOS ARM64:

  • git diff main...HEAD --check and pre-commit validate-manifest .pre-commit-hooks.yaml passed.
  • Fresh isolated PRE_COMMIT_HOME installations from both local checkout and public GitHub URL, with no node on PATH, passed with pre-commit 4.6.2 / Python 3.14 and the advertised minimum 2.9.2 / Python 3.9.
  • pre-commit install --install-hooks; JS, JSX, TS and TSX fixtures were formatted (expected first-run failure because files changed), then passed unchanged on the second run. Python/JSON fixtures stayed untouched and were skipped. args: [--check] correctly reported unformatted input without rewriting it.
  • Installed distributions were verified as oxfmt==0.69.0 and oxfmt-mirror==0.69.0; installed executable reported Version: 0.69.0. Executable SHA256: ef074c281d0e4552b24b9e53a2848804cae9a494db7d7d67839645bd570b20a7.
  • uv run --script mirror.py against live PyPI performed a clean no-op.
  • Five isolated updater tests passed: no-op; sorted multi-version commits/tags plus skipping prerelease/empty/yanked versions; HTTP failure; Git failure stops tagging; invalid dependency pin rejected. Tests used scratch fixtures, not additional files/frameworks in the mirror repo.

Reproduce public-repo installation now by using this config in a temporary Git repository:

repos:
  - repo: https://github.com/ShigureLab/oxfmt-pre-commit-mirror
    rev: 914802aa346129657ae434bb5319225f8f1f78c2
    hooks:
      - id: oxfmt

Then add an unformatted JS/TS file to Git and run pre-commit install --install-hooks, followed by pre-commit run --all-files twice. The first run should format it; the second should pass.

Readiness

  • Implementation is validated and usable at the commit above; the documented v0.69.0 tag is not published yet. Maintainer review/merge and an initial v0.69.0 tag are still needed. Nothing was pushed to main, merged, or released to PyPI.
  • Automatic updates are not provisioned: repository secrets and organization secrets shared with this repository both list zero entries. A maintainer must separately provision/authorize PRE_COMMIT_HOOK_AUTO_UPDATE_TOKEN with repository write access. No secrets, organization permissions, or external services were changed.
  • Version lag: PyPI currently stops at 0.69.0 while upstream/npm is 0.71.0. The third-party packager's detector only looks for apps_* releases, whereas newer formatter releases use oxfmt_v*. This repo tracks actual PyPI availability; resolving that upstream packaging lag is outside this PR.
  • Runtime execution was tested on macOS ARM64 only. PyPI also supplies macOS x86_64, Linux x86_64/ARM64 (glibc 2.18+ / musl 1.2+), and Windows x86_64 wheels, but those environments were not executed here. No local Linux Docker daemon was available. There is no source-build fallback.
  • CI is not claimed: the copied workflows are triggered by default-branch pushes/schedule and version tags, not PRs. The auto-update push and GitHub-release publication paths remain untested until maintainer provisioning/release.

@SigureMo please review the new mirror. Relax's hook migration remains deferred.

Adapt the existing ShigureLab yamlfmt/typos mirror layout and upstream oxfmt hook defaults.

Co-authored-by: Codex <[email protected]>
@SigureMo
SigureMo merged commit 149c0c8 into main Sep 30, 2026
@SigureMo
SigureMo deleted the feature/add-oxfmt-hook branch September 30, 2026 20:28
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