Pyink is a Python code formatter, forked from Black, that offers slightly different formatting behaviors compared to upstream Black. It is actively maintained and regularly rebased on the latest Black releases to serve as an adoption helper for large monorepos with specific formatting requirements. The current stable version is 25.12.0.
pip install pyinkNo compatibility data collected yet for this library.
Pyink is primarily a command-line interface tool. To use it, simply invoke `pyink` followed by the file or directory you wish to format. All Black command-line options are supported, in addition to Pyink-specific options.
Replace `--pyink-lines START-END` with Black's built-in `--line-ranges START-END` option (e.g., `pyink --line-ranges 10-20 my_file.py`).
Review Pyink's README for a full list of divergences, including handling of imports (not wrapped in parentheses), class statement spacing, two-space indentation (`--pyink-indentation`), and majority-based quote style (`--pyink-use-majority-quotes`).
Upgrade to Pyink 24.10.1 or a newer version to ensure correct internal Black version alignment.
Be aware that specific Black features may be selectively enabled or disabled in Pyink. Refer to the release notes for detailed information on such divergences.
Use `--line-ranges` instead. For example, change `pyink --pyink-lines 10-20 my_file.py` to `pyink --line-ranges 10-20 my_file.py`.
These are expected differences. Consult the Pyink README for a list of these divergences. Utilize Pyink-specific options like `--pyink-indentation 2` or `--pyink-use-majority-quotes` to customize behavior.
Use Pyink's specific options for notebooks: `--pyink-ipynb-indentation` to control JSON indentation (available from 24.10.0) and `--pyink-ipynb-unicode-escape` for Unicode escaping (available from 24.10.1).