Skip to main content

Just a wrapper around autopep8 which run _only_ on the changed (non commited

Project description

A wrapper around [autopep8] which rums it only on non commited lines. I.E run git-diff between the worktree and this index and apply autopep8 only to there.

Usage

Commandline:

$ friendlyautopep8
skip only deleted lines
autopep8 --in-place --line-range 23 38 ./friendlyautopep8/__init__.py
autopep8 --in-place --line-range 11 19 ./friendlyautopep8/__init__.py
$ friendlyautopep8 HEAD~13
autopep8 --in-place --line-range 12 78 ./friendlyautopep8/__init__.py
autopep8 --in-place --line-range 81 134 ./friendlyautopep8/__init__.py

progrmatic:

from friendlypep8 import run_on_cwd
run_on_cwd(commmitish_or_None):

Why ?

Because autopep8 is nice but “There must be a better way”. (Highly recommended to watch).

  • Applying autopep8 (or even fixing manually) can break tools like git blame.

  • Extra changes (in whitespace, indent….) can distract reviewer from their tasks.

The fix is simple, pep-8 (or should I say pycodestyle) only the lines that are actively changed.

This will allow project that are not pep-8 complaint to progressivley become compliant if they wish. And does not prevent you from running on your changes.

TODO.

  • Support applying on a commit range instead of non-comited

  • Support non-git.

Limitations

Number of whitelines between function/classes might be wrong. Probably other things.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

friendlyautopep8-0.0.3-py3-none-any.whl (96.9 kB view details)

Uploaded Python 3

File details

Details for the file friendlyautopep8-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for friendlyautopep8-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 922e862f85f9fae0f1e132de829cb951345ee8ddf353c4215e9f9f01ef7247c2
MD5 24b6457a6ef0b06310e61a6ee847dedc
BLAKE2b-256 f3fa7c228f535969e74e54aefb7c16c06ee58b45cbd88ff54a88ce52b4934bee

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page