pyproject-pre-commit


Namepyproject-pre-commit JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/rcmdnk/pyproject-pre-commit
Summarypre-commit hooks for python projects using pyproject.toml.
upload_time2024-03-30 01:56:20
maintainerNone
docs_urlNone
authorrcmdnk
requires_python<4.0.0,>=3.8.1
licenseApache-2.0
keywords pre-commit pyproject.toml poetry
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyproject-pre-commit

[![test](https://github.com/rcmdnk/pyproject-pre-commit/actions/workflows/test.yml/badge.svg)](https://github.com/rcmdnk/pyproject-pre-commit/actions/workflows/test.yml)
[![test coverage](https://img.shields.io/badge/coverage-check%20here-blue.svg)](https://github.com/rcmdnk/pyproject-pre-commit/tree/coverage)

pre-commit hooks for python projects using pyproject.toml.

**.pre-commit-hooks.yaml** provides pre-defined ids which you just need to add these ids to your **.pre-commit-config.yaml**.

## Requirement

- Python 3.11, 3.10, 3.9, 3.8
- Poetry (For development)

## Installation

If your project uses poetry, do:

```
$ poetry add --group dev pyproject-pre-commit
```

Otherwise, install by pip:

```
$ pip install pyproject-pre-commit
```

## The repository features

If you install this package, several linters/formatters will be installed, too.

This repository has following hooks for [pre-commit](https://pre-commit.com/):

- For Python
  - black-diff: Just show Black result.
  - [black](https://black.readthedocs.io/en/stable): Black: The uncompromising Python code formatter.
  - [blacken-docs](https://github.com/adamchainz/blacken-docs): Run `black` on python code blocks in documentation files.
  - autoflake-diff: Just show autoflake result.
  - [autoflake](https://github.com/PyCQA/autoflake): autoflake removes unused imports and unused variables from Python code.
  - autopep8-diff: Just show autopep8.
  - [autopep8](https://github.com/hhatto/autopep8): autopep8 automatically formats Python code to conform to the PEP 8 style guide.
  - isort-diff: Just show isort result.
  - [isort](https://github.com/PyCQA/isort): isort your imports, so you don't have to.
  - [flake8](https://github.com/PyCQA/flake8): `flake8` is a command-line utility for enforcing style consistency across Python projects.
    - With following plugins:
      - [flake8-pyproject](https://github.com/csachs/pyproject-flake8)
      - [flake8-annotations-complexity](https://github.com/best-doctor/flake8-annotations-complexity)
      - [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear)
      - [flake8-builtins](https://github.com/gforcada/flake8-builtins)
      - [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions)
      - [flake8-debugger](https://github.com/jbkahn/flake8-debugger)
      - [flake8-docstrings](https://github.com/pycqa/flake8-docstrings)
      - [flake8-executable](https://github.com/xuhdev/flake8-executable)
      - [flake8-pep3101](https://github.com/gforcada/flake8-pep3101)
      - [flake8-print](https://github.com/jbkahn/flake8-print)
      - [flake8-rst-docstrings](https://github.com/peterjc/flake8-rst-docstrings)
      - [flake8-string-format](https://github.com/xZise/flake8-string-format)
      - [pep8-naming](https://github.com/PyCQA/pep8-naming)
      - [pycodestyle](https://pycodestyle.pycqa.org/en/latest/)
  - [bandit](https://github.com/PyCQA/bandit): Bandit is a tool for finding common security issues in Python code.
  - [mypy](https://www.mypy-lang.org/): Mypy is a static type checker for Python.
- For Shell script
  - [shellcheck](https://www.shellcheck.net/): ShellCheck - A shell script static analysis tool
- For Markdown
  - mdformat-check: Just show mdformat result.
  - [mdformat](https://mdformat.readthedocs.io/en/stable/): CommonMark compliant Markdown formatter.
    - with following plugins:
      - [mdformat-gfm](https://github.com/hukkin/mdformat-gfm)
      - [mdformat-frontmatter](https://github.com/butler54/mdformat-frontmatter)
      - [mdformat-footnote](https://github.com/executablebooks/mdformat-footnote)

All tools are installed as dependencies of this package.

shellcheck and mdformat are given in addition to python tools
as they can be managed by pip and most projects have README.md
and some have shell scripts.

For tools which can format files, there are additional ids ids with `-diff` or `--check`
which just show the results and not modify files.
You can see the difference after formatting if you place these ids before ids w/o `--diff` or `--check`.

You can set options in pyproject.toml for all tools above:

- flake8: flake8-pyproject allows to read options from pyproject.toml
- bandit: There is a plugin for the flake8, but plugin version does not read options from pyproject.toml even with pyproject.toml. Therefore, use bandit directly and give `-c pyproject.toml` option in the hooks.

## .pre-commit-config.yaml

Prepare **.pre-commit-config.yaml** like:

```yaml
repos:
- repo: https://github.com/rcmdnk/pyproject-pre-commit
  rev: v0.1.1
  hooks:
  - id: black-diff
  - id: black
  - id: blacken-docs
  - id: autoflake-diff
  - id: autoflake
  - id: autopep8-diff
  - id: autopep8
  - id: isort-diff
  - id: isort
  - id: flake8
  - id: bandit
  - id: mypy
  - id: shellcheck
  - id: mdformat-check
  - id: mdformat
```

This can be made by `ppc` command:

```
$ ppc --pre-commit > .pre-commit-config.yaml
```

If you already have it, add hooks w/o `repos:` by

```
$ ppc --pre-commit |grep -v "^repos:" >> .pre-commit-config.yaml
```

You may want to modify after adding these configurations.

## pyproject.toml

You can set options in pyproject.toml for all tools.

Example options can be made by `ppc` command:

```
$ ppc --pyproject >> pyproject.toml
```

You may want to modify after adding these configurations.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rcmdnk/pyproject-pre-commit",
    "name": "pyproject-pre-commit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.8.1",
    "maintainer_email": null,
    "keywords": "pre-commit, pyproject.toml, poetry",
    "author": "rcmdnk",
    "author_email": "rcmdnk@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/eb/b2/6e2738a7265b83baf7ac30e6cae998ca1157687ae4dfa3999960442e0a46/pyproject_pre_commit-0.1.8.tar.gz",
    "platform": null,
    "description": "# pyproject-pre-commit\n\n[![test](https://github.com/rcmdnk/pyproject-pre-commit/actions/workflows/test.yml/badge.svg)](https://github.com/rcmdnk/pyproject-pre-commit/actions/workflows/test.yml)\n[![test coverage](https://img.shields.io/badge/coverage-check%20here-blue.svg)](https://github.com/rcmdnk/pyproject-pre-commit/tree/coverage)\n\npre-commit hooks for python projects using pyproject.toml.\n\n**.pre-commit-hooks.yaml** provides pre-defined ids which you just need to add these ids to your **.pre-commit-config.yaml**.\n\n## Requirement\n\n- Python 3.11, 3.10, 3.9, 3.8\n- Poetry (For development)\n\n## Installation\n\nIf your project uses poetry, do:\n\n```\n$ poetry add --group dev pyproject-pre-commit\n```\n\nOtherwise, install by pip:\n\n```\n$ pip install pyproject-pre-commit\n```\n\n## The repository features\n\nIf you install this package, several linters/formatters will be installed, too.\n\nThis repository has following hooks for [pre-commit](https://pre-commit.com/):\n\n- For Python\n  - black-diff: Just show Black result.\n  - [black](https://black.readthedocs.io/en/stable): Black: The uncompromising Python code formatter.\n  - [blacken-docs](https://github.com/adamchainz/blacken-docs): Run `black` on python code blocks in documentation files.\n  - autoflake-diff: Just show autoflake result.\n  - [autoflake](https://github.com/PyCQA/autoflake): autoflake removes unused imports and unused variables from Python code.\n  - autopep8-diff: Just show autopep8.\n  - [autopep8](https://github.com/hhatto/autopep8): autopep8 automatically formats Python code to conform to the PEP 8 style guide.\n  - isort-diff: Just show isort result.\n  - [isort](https://github.com/PyCQA/isort): isort your imports, so you don't have to.\n  - [flake8](https://github.com/PyCQA/flake8): `flake8` is a command-line utility for enforcing style consistency across Python projects.\n    - With following plugins:\n      - [flake8-pyproject](https://github.com/csachs/pyproject-flake8)\n      - [flake8-annotations-complexity](https://github.com/best-doctor/flake8-annotations-complexity)\n      - [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear)\n      - [flake8-builtins](https://github.com/gforcada/flake8-builtins)\n      - [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions)\n      - [flake8-debugger](https://github.com/jbkahn/flake8-debugger)\n      - [flake8-docstrings](https://github.com/pycqa/flake8-docstrings)\n      - [flake8-executable](https://github.com/xuhdev/flake8-executable)\n      - [flake8-pep3101](https://github.com/gforcada/flake8-pep3101)\n      - [flake8-print](https://github.com/jbkahn/flake8-print)\n      - [flake8-rst-docstrings](https://github.com/peterjc/flake8-rst-docstrings)\n      - [flake8-string-format](https://github.com/xZise/flake8-string-format)\n      - [pep8-naming](https://github.com/PyCQA/pep8-naming)\n      - [pycodestyle](https://pycodestyle.pycqa.org/en/latest/)\n  - [bandit](https://github.com/PyCQA/bandit): Bandit is a tool for finding common security issues in Python code.\n  - [mypy](https://www.mypy-lang.org/): Mypy is a static type checker for Python.\n- For Shell script\n  - [shellcheck](https://www.shellcheck.net/): ShellCheck - A shell script static analysis tool\n- For Markdown\n  - mdformat-check: Just show mdformat result.\n  - [mdformat](https://mdformat.readthedocs.io/en/stable/): CommonMark compliant Markdown formatter.\n    - with following plugins:\n      - [mdformat-gfm](https://github.com/hukkin/mdformat-gfm)\n      - [mdformat-frontmatter](https://github.com/butler54/mdformat-frontmatter)\n      - [mdformat-footnote](https://github.com/executablebooks/mdformat-footnote)\n\nAll tools are installed as dependencies of this package.\n\nshellcheck and mdformat are given in addition to python tools\nas they can be managed by pip and most projects have README.md\nand some have shell scripts.\n\nFor tools which can format files, there are additional ids ids with `-diff` or `--check`\nwhich just show the results and not modify files.\nYou can see the difference after formatting if you place these ids before ids w/o `--diff` or `--check`.\n\nYou can set options in pyproject.toml for all tools above:\n\n- flake8: flake8-pyproject allows to read options from pyproject.toml\n- bandit: There is a plugin for the flake8, but plugin version does not read options from pyproject.toml even with pyproject.toml. Therefore, use bandit directly and give `-c pyproject.toml` option in the hooks.\n\n## .pre-commit-config.yaml\n\nPrepare **.pre-commit-config.yaml** like:\n\n```yaml\nrepos:\n- repo: https://github.com/rcmdnk/pyproject-pre-commit\n  rev: v0.1.1\n  hooks:\n  - id: black-diff\n  - id: black\n  - id: blacken-docs\n  - id: autoflake-diff\n  - id: autoflake\n  - id: autopep8-diff\n  - id: autopep8\n  - id: isort-diff\n  - id: isort\n  - id: flake8\n  - id: bandit\n  - id: mypy\n  - id: shellcheck\n  - id: mdformat-check\n  - id: mdformat\n```\n\nThis can be made by `ppc` command:\n\n```\n$ ppc --pre-commit > .pre-commit-config.yaml\n```\n\nIf you already have it, add hooks w/o `repos:` by\n\n```\n$ ppc --pre-commit |grep -v \"^repos:\" >> .pre-commit-config.yaml\n```\n\nYou may want to modify after adding these configurations.\n\n## pyproject.toml\n\nYou can set options in pyproject.toml for all tools.\n\nExample options can be made by `ppc` command:\n\n```\n$ ppc --pyproject >> pyproject.toml\n```\n\nYou may want to modify after adding these configurations.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "pre-commit hooks for python projects using pyproject.toml.",
    "version": "0.1.8",
    "project_urls": {
        "Homepage": "https://github.com/rcmdnk/pyproject-pre-commit",
        "Repository": "https://github.com/rcmdnk/pyproject-pre-commit"
    },
    "split_keywords": [
        "pre-commit",
        " pyproject.toml",
        " poetry"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8b9b5c2d8661a86b8aa6ba71295ddf2e01bb2b0df9bc4bf21592c60a245a8e6",
                "md5": "ece2ca50a9171022f1c9c26175220055",
                "sha256": "732ce6bf4fec32d194872a0922c66b9a3b74e34a731709a2177a4f073c72ff00"
            },
            "downloads": -1,
            "filename": "pyproject_pre_commit-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ece2ca50a9171022f1c9c26175220055",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.8.1",
            "size": 9132,
            "upload_time": "2024-03-30T01:56:17",
            "upload_time_iso_8601": "2024-03-30T01:56:17.991651Z",
            "url": "https://files.pythonhosted.org/packages/d8/b9/b5c2d8661a86b8aa6ba71295ddf2e01bb2b0df9bc4bf21592c60a245a8e6/pyproject_pre_commit-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebb26e2738a7265b83baf7ac30e6cae998ca1157687ae4dfa3999960442e0a46",
                "md5": "988815007b9d37fdc44ecca7302b47ca",
                "sha256": "83b0cb5353cd6ea4cf4e42a8b300897cae8932d24c0379f320d9e474ded12918"
            },
            "downloads": -1,
            "filename": "pyproject_pre_commit-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "988815007b9d37fdc44ecca7302b47ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0.0,>=3.8.1",
            "size": 8683,
            "upload_time": "2024-03-30T01:56:20",
            "upload_time_iso_8601": "2024-03-30T01:56:20.127008Z",
            "url": "https://files.pythonhosted.org/packages/eb/b2/6e2738a7265b83baf7ac30e6cae998ca1157687ae4dfa3999960442e0a46/pyproject_pre_commit-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-30 01:56:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rcmdnk",
    "github_project": "pyproject-pre-commit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyproject-pre-commit"
}
        
Elapsed time: 0.24089s