{"id":45446789,"url":"https://github.com/bitflight-devops/pre-commit-pep723-linter-wrapper","last_synced_at":"2026-02-22T04:04:16.984Z","repository":{"id":323807994,"uuid":"1093545571","full_name":"bitflight-devops/pre-commit-pep723-linter-wrapper","owner":"bitflight-devops","description":"Pre-commit fails to run linters on scripts using PEP 723 because the dependencies are missing, this wrapper handles that.","archived":false,"fork":false,"pushed_at":"2026-02-01T16:02:44.000Z","size":281,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-01T23:47:04.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitflight-devops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-10T14:14:11.000Z","updated_at":"2026-01-11T00:46:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bitflight-devops/pre-commit-pep723-linter-wrapper","commit_stats":null,"previous_names":["bitflight-devops/pre-commit-pep723-linter-wrapper"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/bitflight-devops/pre-commit-pep723-linter-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fpre-commit-pep723-linter-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fpre-commit-pep723-linter-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fpre-commit-pep723-linter-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fpre-commit-pep723-linter-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitflight-devops","download_url":"https://codeload.github.com/bitflight-devops/pre-commit-pep723-linter-wrapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fpre-commit-pep723-linter-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29704420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-22T04:03:32.687Z","updated_at":"2026-02-22T04:04:16.978Z","avatar_url":"https://github.com/bitflight-devops.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pep723-loader\n\nA CLI wrapper that auto-installs [PEP 723](https://peps.python.org/pep-0723/) inline script dependencies before executing linters and other tools.\n\n## The Problem\n\nPython scripts with PEP 723 inline metadata declare their dependencies directly in the file:\n\n```python\n# /// script\n# requires-python = \"\u003e=3.11\"\n# dependencies = [\n#   \"requests\u003e=2.31.0\",\n#   \"rich\u003e=13.0.0\",\n# ]\n# ///\n\nimport requests\nfrom rich import print\n# ...\n```\n\nBut when you run type checkers or linters on these scripts, they fail because the dependencies aren't installed:\n\n```bash\n$ mypy script.py\nscript.py:8: error: Cannot find implementation or library stub for module named \"requests\"\nscript.py:9: error: Cannot find implementation or library stub for module named \"rich\"\n```\n\n## The Solution\n\n`pep723-loader` wraps your linter and automatically installs the inline dependencies first:\n\n```bash\n$ pep723-loader mypy script.py\n# Dependencies installed, then mypy runs successfully\n```\n\n## Installation\n\n```bash\npip install pep723-loader\n```\n\nOr with uv:\n\n```bash\nuv tool install pep723-loader\n```\n\n## Usage\n\n### Command Line\n\n```bash\n# Wrap any linter or tool\npep723-loader mypy script.py\npep723-loader basedpyright script.py\npep723-loader ruff check script.py\npep723-loader bandit script.py\n\n# Pass any arguments through to the wrapped command\npep723-loader mypy --strict --warn-unreachable script.py\n\n# Works with directories too\npep723-loader mypy scripts/\n```\n\n### Pre-commit Integration\n\nThere are two ways to use `pep723-loader` with pre-commit:\n\n#### Simple: If tools are already installed\n\nFirst, add the tools to your project's dev dependencies:\n\n```bash\nuv add --dev pep723-loader mypy\n```\n\nThen configure the hook:\n\n```yaml\n- repo: local\n  hooks:\n    - id: mypy\n      name: mypy\n      entry: pep723-loader mypy\n      language: system\n      types: [python]\n      pass_filenames: true\n```\n\n#### Recommended: Self-contained with uv\n\nThis approach keeps tools out of your project's dependencies - uv provides them on-demand:\n\n```yaml\n- repo: local\n  hooks:\n    - id: mypy\n      name: mypy\n      entry: uv run -q --no-sync --with pep723-loader --with mypy pep723-loader mypy\n      language: system\n      types: [python]\n      pass_filenames: true\n\n    - id: basedpyright\n      name: basedpyright\n      entry: uv run -q --no-sync --with pep723-loader --with basedpyright pep723-loader basedpyright\n      language: system\n      types: [python]\n      pass_filenames: true\n```\n\n**What do these flags do?**\n\n| Flag           | Purpose                                                                  |\n| -------------- | ------------------------------------------------------------------------ |\n| `-q`           | Quiet mode - suppresses uv's output so only linter output is shown       |\n| `--no-sync`    | Skip syncing the project's dependencies - faster, we only need the tools |\n| `--with \u003cpkg\u003e` | Temporarily add a package for this invocation                            |\n\nThe `--with` packages are ephemeral - they're not installed into your project's virtualenv. However, they're cached by uv, so after the first run there's no download overhead.\n\n## How It Works\n\n1. Scans Python files passed as arguments for PEP 723 `# /// script` metadata blocks\n2. Extracts dependencies using `uv export --script`\n3. Installs dependencies via `uv pip install`\n4. Executes the wrapped command with all original arguments\n5. Propagates the wrapped command's exit code\n\n## Requirements\n\n- Python 3.10+\n- [uv](https://github.com/astral-sh/uv) (used for dependency extraction and installation)\n\n## Related Projects\n\n- **[pep723-uv-interpreter](https://github.com/nsarrazin/pep723-uv-interpreter)** - VS Code extension that automatically sets the Python interpreter for PEP 723 scripts, enabling auto-completion and intellisense in your editor.\n\nThese tools are complementary: `pep723-uv-interpreter` solves the IDE experience, while `pep723-loader` solves CI/pre-commit linting.\n\n## License\n\nApache License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitflight-devops%2Fpre-commit-pep723-linter-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitflight-devops%2Fpre-commit-pep723-linter-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitflight-devops%2Fpre-commit-pep723-linter-wrapper/lists"}