From 6c6e3aea6f9a26b2827e5987a4e1c47602a73b4d Mon Sep 17 00:00:00 2001 From: Dominik Kozaczko Date: Fri, 7 Feb 2020 22:38:04 +0100 Subject: [PATCH] Add simple documentation --- .pre-commit-hooks.yaml | 1 + README.rst | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index ea5abd63..dd8d0d65 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -10,5 +10,6 @@ name: pasteurize description: Pasteurize your Py3 code to ensure it is runnable on Py2. language: python + language_version: python3 types: [python] entry: pasteurize -w -n --no-diffs diff --git a/README.rst b/README.rst index ea806538..c0c69905 100644 --- a/README.rst +++ b/README.rst @@ -57,6 +57,8 @@ Features decoding the backported ``str`` and ``bytes`` objects. [This feature is currently in alpha.] +- support for pre-commit hooks + .. _code-examples: Code examples @@ -261,6 +263,39 @@ development, and will likely never be perfect. For more info, see :ref:`translation`. +Pre-commit hooks +---------------- + +`Pre-commit `_ is a framework for managing and maintaining +multi-language pre-commit hooks. + +In case you need to port your project from Python 2 to Python 3, you might consider +using such hook during the transition period. + +First: + +.. code-block:: bash + + $ pip install pre-commit + +and then in your project's directory: + +.. code-block:: bash + + $ pre-commit install + +Next, you need to add this entry to your ``.pre-commit-config.yaml`` + +.. code-block:: yaml + + - repo: https://github.com/PythonCharmers/python-future + rev: feature/pre-commit + hooks: + - id: futurize + args: [--both-stages] + +The ``args`` part is optional, by default only stage1 is applied. + Licensing ---------