{"id":19264187,"url":"https://github.com/cphyc/pre-commit-all-the-way-down","last_synced_at":"2025-04-21T18:31:53.485Z","repository":{"id":37933364,"uuid":"359182395","full_name":"cphyc/pre-commit-all-the-way-down","owner":"cphyc","description":"Apply pre-commit hooks on chunks of file as a pre-commit hook","archived":true,"fork":false,"pushed_at":"2024-12-16T21:15:15.000Z","size":227,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T21:24:48.427Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cphyc.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2021-04-18T15:32:38.000Z","updated_at":"2024-12-18T10:56:59.000Z","dependencies_parsed_at":"2023-02-16T13:30:32.790Z","dependency_job_id":"72173f79-568d-4bbe-bdac-ea0aede842c1","html_url":"https://github.com/cphyc/pre-commit-all-the-way-down","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Fpre-commit-all-the-way-down","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Fpre-commit-all-the-way-down/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Fpre-commit-all-the-way-down/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Fpre-commit-all-the-way-down/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cphyc","download_url":"https://codeload.github.com/cphyc/pre-commit-all-the-way-down/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250111069,"owners_count":21376585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-09T19:40:11.158Z","updated_at":"2025-04-21T18:31:53.203Z","avatar_url":"https://github.com/cphyc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pre-commit all the way down\n\n[![Tests](https://github.com/cphyc/pre-commit-all-the-way-down/actions/workflows/python-package.yml/badge.svg)](https://github.com/cphyc/pre-commit-all-the-way-down/actions/workflows/python-package.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/cphyc/pre-commit-all-the-way-down/main.svg)](https://results.pre-commit.ci/latest/github/neutrinoceros/cphyc/pre-commit-all-the-way-down)\n\npre-commit hooks to run [`pre-commit`](https://pypi.org/project/pre-commit/) on\ncode snippets embeded in files that don't match the language used.\n\nThe primary (and currently only) application for this is to apply\nPython-targeted hooks to Python snippets included in documentation files.\n\nThis project is inspired by the great\n[`blacken-docs`](https://pypi.org/project/blacken-docs/).\n\n## Install\n\nThe package is not available on Pypi yet. In the meantime it can be installed as\n```shell\npip install git+https://github.com/cphyc/pre-commit-all-the-way-down.git#egg=pre_commit_all_the_way_down\n```\nor\n```shell\ngit clone https://github.com/cphyc/pre-commit-all-the-way-down.git\ncd pre-commit-all-the-way-down\npip install .\n```\n\n## Usage\n\n### python-doc\nThis hook applies pre-commit hooks to Python blocks in `.rst` files.\nIt does so in 4 steps\n1. extract Python code snippets\n2. write their content to temporary files\n3. run `pre-commit` hooks against these files\n4. write back to the original file.\n\nThe executable has a single option, `--whitelist` which allows to explicitly list which `pre-commit` hooks will be run.\nFor example\n```shell\n# will apply all pre-commit hooks to the file\npython-doc documentation.rst\n\n# will only apply black \u0026 isort\npython-doc documentation.rst --whitelist black --whitelist isort\n```\n\n## Usage with pre-commit\n\nThe package has been tailored to fit in the `pre-commit` machinery. To use it, add the following to your `.pre-commit-config.yaml` file\n```yaml\n-   repo: https://github.com/cphyc/pre-commit-all-the-way-down\n    rev: v0.0.2\n    hooks:\n    -   id: python-doc\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcphyc%2Fpre-commit-all-the-way-down","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcphyc%2Fpre-commit-all-the-way-down","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcphyc%2Fpre-commit-all-the-way-down/lists"}