Repository navigation
Description
Problem
CI on #77 failed at the black --check . step because hand-authored changes to inference_gateway/models.py and tests/test_client.py were pushed without being formatted. The fix was trivial (two whitespace-only reformattings), but the failure only surfaced after the code reached CI.
Root cause
The repo ships a .pre-commit-config.yaml backed by the pip pre-commit framework (black, isort, mypy, etc.), but it is opt-in: it only runs once a contributor has run pre-commit install. When a change is authored in an environment where the hooks were never installed or can't be installed (e.g. a sandbox with pip/network blocked), unformatted code sails straight through git commit/git push and is caught only by CI.
The ci: block in .pre-commit-config.yaml targets pre-commit.ci with autofix_prs: true, but the pre-commit.ci GitHub App is not enabled on this repo, so server-side auto-fix never fires either.
Proposal
Replace the pip pre-commit framework with a plain .githooks/pre-commit shell script, following the same pattern used in inference-gateway/cli. This eliminates the pip dependency, works in sandboxed environments, and is trivially installable.
What to build
-
.githooks/pre-commit- a plain shell script that runstask format(black + isort) on staged Python files. No pip pre-commit framework, no YAML config, no network calls. -
task precommit:install- setsgit config core.hooksPath .githooksso git picks up the hook automatically. -
task precommit:run- runs./.githooks/pre-commitdirectly (for manual invocation or CI checks).
What to clean up
- Delete
.pre-commit-config.yaml- no longer needed. - Delete
pre-commit:install,pre-commit:run,pre-commit:updatetasks fromTaskfile.yml. - Update
dev:setupinTaskfile.ymlto callprecommit:installinstead ofpre-commit:install. - Update
AGENTS.md/CLAUDE.md/CONTRIBUTING.mdto referencetask precommit:installandtask precommit:runinstead of the oldpre-commitcommands.
What stays
task format(black + isort) - the hook calls this.task lint(black --check, isort --check-only, mypy) - CI still runs this independently.
Acceptance criteria
-
.githooks/pre-commitexists as a plain shell script that runstask formaton staged files. -
task precommit:installconfigures git to use.githooksas the hooks path. -
task precommit:runruns the hook directly. -
.pre-commit-config.yamlis deleted. - Old
pre-commit:*tasks are removed fromTaskfile.yml. -
dev:setupcallsprecommit:installinstead ofpre-commit:install. - Dev docs are updated to reference the new commands.
- An unformatted commit is blocked locally at commit time (not just in CI).
Context
- Originating PR: feat: sync SDK to schemas v0.6.2 (zai provider + Responses API) #77
- Failing step:
Testjob ->Check formatting with Black(black --check ., black26.3.1) - Pattern source:
inference-gateway/cli(.githooks/pre-commit,task precommit:install,task precommit:run)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]feat: add pre-push pre-commit gate to catch formatting before CI[/-][+]feat: replace pip pre-commit framework with plain .githooks pre-commit hook[/+][-]feat: replace pip pre-commit framework with plain .githooks pre-commit hook[/-][+][FEATURE] Replace pip pre-commit framework with plain .githooks pre-commit hook[/+][-][FEATURE] Replace pip pre-commit framework with plain .githooks pre-commit hook[/-][+][TASK] Replace pip pre-commit framework with plain .githooks pre-commit hook[/+]edenreich commentedon Jul 18, 2026
@claude Can you work on this?
inference-gateway-maintainer commentedon Jul 18, 2026
Claude finished @edenreich's task in 9m 32s —— View job •
feat/issue-78-20260718-2111• [Create PR ➔](https://github.com/inference-gateway/python-sdk/compare/main...feat/issue-78-20260718-2111?quick_pull=1&title=Issue%20%2378%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%2378%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)Task: Replace pip pre-commit framework with plain
.githooks/pre-commit✅Opened PR #80.
inference-gateway/clipattern source).githooks/pre-commitshell script (runstask formaton staged Python files, blocks commit on reformat)precommit:install+precommit:runtasks toTaskfile.ymlpre-commit:*tasks; updatedev:setup.pre-commit-config.yamlpre-commitpip dep frompyproject.tomlAGENTS.md/CLAUDE.md)100755so git actually executes itWhat changed
.githooks/pre-commit(new, mode100755) - plain POSIX shell, no pip framework/YAML/network:Taskfile.yml- replacedpre-commit:{install,run,update}with:precommit:install→git config core.hooksPath .githooks+chmod +x .githooks/pre-commitprecommit:run→./.githooks/pre-commitdev:setupnow callsprecommit:install.Also: deleted
.pre-commit-config.yaml, removedpre-commit>=4.6.0frompyproject.tomldev extras (eliminates the pip dependency), documented the new commands inCLAUDE.md+AGENTS.md.CONTRIBUTING.mddoesn't exist in this repo, so nothing to update there.Notes
task format, then blocks the commit only if a staged.pyfile was reformatted - so an unformatted commit is stopped locally at commit time, not just in CI.task lint(with mypy) still runs independently in CI.100755: git silently ignores non-executable hooks, so a644hook would recreate the exact "unformatted code slips to CI" bug this fixes.precommit:installre-applieschmod +xdefensively.chmod/test-script execution, so I traced the hook logic rather than running it live - block-on-unformatted, pass-when-formatted, and skip-when-no-.py-staged all hold (commands inifconditions are exempt fromset -e; atask formatfailure also blocks the commit). The mode fix was confirmed via the Git Data API (.githooks/pre-commit=100755).· Branch:
feat/issue-78-20260718-2111inference-gateway-releaser commentedon Jul 18, 2026
🎉 This issue has been resolved in version 0.8.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀