Skip to content

Add mojo format to lint pipeline; parallelize update_challenges.py uploads#239

Merged
kunal-mansukhani merged 1 commit intomainfrom
mojo-format-and-parallel-updates
Apr 5, 2026
Merged

Add mojo format to lint pipeline; parallelize update_challenges.py uploads#239
kunal-mansukhani merged 1 commit intomainfrom
mojo-format-and-parallel-updates

Conversation

@kunal-mansukhani
Copy link
Copy Markdown
Contributor

Summary

  • Wires mojo format into pre-commit and the lint-mojo CI job, and reformats all 78 existing .mojo starter files so the check goes green.
  • Adds modular (provides the mojo binary) to the challenge-creation cron's pip install, so Claude's pre-commit run --all-files step won't fail on missing mojo.
  • Drops target-version = ['py312'] from [tool.black] in pyproject.toml: mojo format wraps mblack, which reads the same [tool.black] section but only accepts targets up to py311 (or mojo). Black auto-detects the target fine without it.
  • Parallelizes scripts/update_challenges.py: HTTP uploads now fan out via ThreadPoolExecutor(max_workers=16). Loading stays sequential because importlib reuses a "challenge" module name and mutates sys.path, which isn't thread-safe.

Test plan

  • pre-commit run --all-files — all hooks pass locally (black, isort, flake8, clang-format, mojo format, etc.)
  • mojo format -q run over all challenges/**/*.mojo; git diff --exit-code clean afterward
  • python -c "import ast; ast.parse(open('scripts/update_challenges.py').read())" parses cleanly
  • Verify the lint-mojo CI job installs modular and the format check passes on this PR
  • Verify update_challenges.py still deploys correctly end-to-end against staging (sanity check that concurrent POSTs don't hit a rate limit — max_workers=16 may need tuning)
  • Next scheduled run of the challenge-creation cron succeeds with mojo now available on PATH

🤖 Generated with Claude Code

Wires mojo format into the lint pipeline and applies it repo-wide (78
starter files reformatted). Also parallelizes the HTTP uploads in
scripts/update_challenges.py so deploys fan out instead of running
serially.

- .pre-commit-config.yaml: local mojo-format hook running `mojo format -q`
- .github/workflows/lint.yml: lint-mojo job now installs `modular` via pip
  and enforces formatting via `mojo format` + `git diff --exit-code`
- .github/workflows/create-challenge.yml: adds `modular` to the cron's pip
  install so Claude's `pre-commit run --all-files` step has `mojo` on PATH
- pyproject.toml: drop `target-version = ['py312']` from [tool.black] —
  mblack (which `mojo format` wraps) reads the same section and rejects
  any target above py311; black auto-detects target fine without it
- scripts/update_challenges.py: upload via ThreadPoolExecutor(max_workers=16).
  Loading stays sequential because importlib with a shared "challenge"
  module name and sys.path mutation is not thread-safe.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@kunal-mansukhani kunal-mansukhani force-pushed the mojo-format-and-parallel-updates branch from 0942f74 to 29f72d5 Compare April 5, 2026 07:54
@kunal-mansukhani kunal-mansukhani merged commit 0dd4aca into main Apr 5, 2026
4 checks passed
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