Skip to main content

Coderedo

Python code reformater

Coderedo is a simple program that allow you to reformat your python code, after indention error for example 🤗️.

Installation

pip install coderedo
python -m coderedo -p file.py
# or apply on a directory
python -m coderedo -p projects/

Arguments:

  • -p or --path: the path to a python file or python project directory
  • -go or --get-old: set value on 1 to get the old version of the processed file. (optional)
  • -t or --tab-size: your tab size, default value: 4 (optional)

Example with a file

Take this file: test.py

def func():
  print("Hello Wolrd !")
  print("Your are awesome")

func()

Output after running test.py

File "test/test.py", line 4
  print("Your are awesome")
                           ^
TabError: inconsistent use of tabs and spaces in indentation

🤧️ There was a runtime error because, there are spaces for the indentation on line 2 and tabs on line 3.

Note: In python, there only must be indentions or spaces per code sub bloc

Fix this with coderedo

fix

python coderedo.py -p test/test.py

Run this now

python test/test.py

Output

Hello Wolrd !
Your are awesome

Ouff 🙂️...

Example with a directory

You can apply coderedo on all the files of a directory recursively

Example

project/
  utils/
    functions.py
    variables.py
  main.py  
python -m coderedo -d project

is equal to

python -m coderedo -d project/main.py
python -m coderedo -d project/utils/functions.py
python -m coderedo -d project/utils/variables.py

After applying coderedo, get old version of

a directory

Just add the -go argument with 1 as a value

python -m coderedo -d project -go 1

You will have the directory project-old.

a file

python -m coderedo -d test.py -go 1

You will have the file test-old.py.

Release files for coderedo 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coderedo 2.1.0
File Size Uploaded
coderedo-2.1.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coderedo 2.1.0
File Interpreter ABI Platform
coderedo-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / coderedo-2.1.0.tar.gz

Download URL coderedo-2.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
582ba3107f9e3673fb2c7ebb02f060d6768875cfd6c8bd1d468bd2089f5b934b
BLAKE2b-256 checksum
How to use checksums
c7a6dbfa6ef55c9e8e3dfb34d4e06d032783611f43ad27462648baf3c39a9fbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / coderedo-2.1.0-py3-none-any.whl

Download URL coderedo-2.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b67b00c3efc2036070542c6fbf383b8c117e233cc5234457420c03861f95587d
BLAKE2b-256 checksum
How to use checksums
4b9108cda24842cd3d491b186a763366e54dbb5eb46d00ab9f4189fce08b5451
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page