Skip to content

Automated Code Quality

You can check for code quality issues, fix and format your files automatically.

import practicuscore as prt

# Let's check for code quality issues in this folder
success = prt.quality.check()
# Some issues like 'unused imports' can be fixed automatically
if not success:
    prt.quality.check(fix=True)
# Let's also format code to improve quality and readability
prt.quality.format()
# Still errors? open bad_code.py and delete the wrong code
# Final check, this should pass
prt.quality.check()
# We can add a "No QA" tag to ignore checking a certain type of issue
# E.g. to ignore an unused imports for a line of code
import pandas  # noqa: F401
# To ignore all QA checks (not recommended)
import numpy  # noqa

Supplementary Files

bad_code.py

import pandas 

# this is an error
print(undefined_var)




print("Too many blank lines, which is a code formatting issue.")

Previous: Llms With DeepSpeed | Next: Automate Notebooks > Executing Notebooks