Pyupgrade wrapper to supply configuration via pyproject.toml
Project description
pyproject pyupgrade
pyproject.toml configuration wrapper for pyupgrade
Installation
Via pip
pip install pyproject-pyupgrade
Via poetry
poetry add --group dev pyproject-pyupgrade
Via pipx
pipx install -f pyproject-pyupgrade
Usage
Make sure you have a desired version of pyupgrade
installed in your python environment.
Add the following section in your pyproject.toml
:
[tool.pyupgrade]
# for example, if you're using python 3.10
py310-plus = true
And then just execute it via CLI
pyproject-pyupgrade [filename [filenames...]]
or shorter version
ppyupgrade [filename [filenames...]]
So, basically you specify flags that you want to add to pyupgrade
CLI arguments specifying them without leading two dashes (--
).
This is the way how you can supply any option that your version of pyupgrade
receives
There is also one additional parameter provided exclusively by pyproject-pyupgrade
wrapper:
[tool.pyupgrade]
pyproject-pyupgrade-debug = true
Or directly via CLI
ppyupgrade --pyproject-pyupgrade-debug ...
This option is going to output debug information about pyproject-pyupgrade
.
Info about parsed configuration from pyproject.toml (if there is one) and all the flags
As a pre-commit hook
See pre-commit for instructions.
Sample .pre-commit-config.yaml
:
repos:
- repo: https://github.com/venomlab/pyproject-pyupgrade
rev: v0.1.0a2
hooks:
- id: ppyupgrade
ToDo
- Add tests and
tox
config to run them for all supported python versions - Add option to specify custom
pyupgrade
command. It allows in case if you want to chain pyupgrade wrappers (for instance, with pyupgrade-directories) - Add better parser for TOML. Right now the parser is ultra primitive and might lead to errors if used improperly
- If
python
version >=3.11
use tomllib forpyproject.toml
parsing - Support adding custom options or key-value arguments to
pyupgrade
CLI - Support storing configuration in
pyupgrade.ini
- Support storing configuration in
tox.ini
- Support storing configuration in
setup.cfg
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pyproject_pyupgrade-0.1.0a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e41517f833b4bb51dc5a6a9065f345f289adbbd959a5084fe73f62ed85a5c16b |
|
MD5 | 8a5eeebb78b260c1ed43d661a82493af |
|
BLAKE2b-256 | d889130e3c7afb444a8def2c3c242135000e9eaed5540d939b7048995988359a |
Hashes for pyproject_pyupgrade-0.1.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fb50e8a0a522ebe8f0c1c6cc67b7f8a90a04fe094252a2c5e6ace67f8257656 |
|
MD5 | 947ee279a931e7977ab2287b0b6f7a06 |
|
BLAKE2b-256 | 59f6ca4decaa6e6b7810ab288f30b1dc42e843aa86fad6b9fe362b49566725cb |