Giter Club home page Giter Club logo

pyproject-pyupgrade's Introduction

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.1
    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 for pyproject.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

pyproject-pyupgrade's People

Contributors

zibertscrem avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.