{"id":7572,"library":"pyink","title":"Pyink Python Formatter","description":"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.","status":"active","version":"25.12.0","language":"en","source_language":"en","source_url":"https://github.com/google/pyink","tags":["formatter","code-style","black","linting","development-tools"],"install":[{"cmd":"pip install pyink","lang":"bash","label":"Install Pyink"}],"dependencies":[{"reason":"Requires Python 3.10 or newer for execution.","package":"python","optional":false}],"imports":[],"quickstart":{"code":"# To format a single file:\npyink my_python_script.py\n\n# To format all Python files in the current directory and subdirectories:\npyink .\n\n# To check for formatting issues without applying changes:\npyink --check --diff .","lang":"bash","description":"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."},"warnings":[{"fix":"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`).","message":"The `--pyink-lines` CLI option was deprecated in Pyink 23.12.1 and completely removed in 24.3.0. Using this option in newer versions will result in an error.","severity":"breaking","affected_versions":">=24.3.0"},{"fix":"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`).","message":"Pyink intentionally implements several formatting differences compared to upstream Black, even when based on the same Black version. Code formatted by Pyink may not be identical to code formatted by Black.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to Pyink 24.10.1 or a newer version to ensure correct internal Black version alignment.","message":"Pyink 24.10.0 had a dependency to the wrong Black version in its `pyproject.toml`, which was fixed in 24.10.1. This could lead to unexpected formatting behavior or internal inconsistencies.","severity":"gotcha","affected_versions":"24.10.0"},{"fix":"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.","message":"Certain Black features, such as Black v23.9.9's concise formatting for dummy implementations, have been temporarily disabled in specific Pyink releases to maintain Pyink's unique formatting style.","severity":"gotcha","affected_versions":"23.9.1"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Use `--line-ranges` instead. For example, change `pyink --pyink-lines 10-20 my_file.py` to `pyink --line-ranges 10-20 my_file.py`.","cause":"The `--pyink-lines` option was removed in Pyink 24.3.0 after being deprecated.","error":"Error: No such option: --pyink-lines"},{"fix":"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.","cause":"Pyink has intentional formatting divergences from Black, such as handling of imports, class/method spacing, and support for 2-space indentation or majority quote styles.","error":"My code is formatted differently by Pyink than by Black, even when they're supposed to be based on the same version."},{"fix":"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).","cause":"Jupyter notebook formatting (especially `ipynb` files) has specific considerations for JSON content indentation and Unicode escaping that require dedicated options.","error":"Jupyter notebooks are not formatted correctly or show unexpected changes when using Pyink."}]}