Skip to main content

Fixes missing imports using Ruff and RipGrep (CLI and import)

Project description

Fixes missing imports using Ruff and RipGrep (CLI and import)

Tested against Windows / Python 3.11 / Anaconda

pip install ruffrgimportfixer

A Python script for adding missing import statements in your Python code. The script utilizes ruff and ripgrep to identify missing imports and organizes them based on various criteria, including the number of errors, the total number of imports, and the length of the import line.

Usage:
    from ruffrgimportfixer import fix_imports
	fix_imports('some_pythonfile.py')
	# or from the commandline ('some_pythonfile.py' as the only arg)

    # or a simple bat file: 
    python -c "from ruffrgimportfixer import fix_imports;fix_imports(r'''%*''')"

    
Dependencies:
    - ruff (https://github.com/astral-sh/ruff)
    - ripgrep (https://github.com/BurntSushi/ripgrep)
	# Both must be in sys.path

Project details


Download files

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

Source Distribution

ruffrgimportfixer-0.11.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

ruffrgimportfixer-0.11-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file ruffrgimportfixer-0.11.tar.gz.

File metadata

  • Download URL: ruffrgimportfixer-0.11.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for ruffrgimportfixer-0.11.tar.gz
Algorithm Hash digest
SHA256 0630747225c31d2641f7709618251a3a70ac3e798edece3c1623aba4b6e896f0
MD5 36abc059b754e2d31119897d0fd9de61
BLAKE2b-256 5041acf3827cd66035c148f726a5c2f63f28d53123ed09d28b9ba1d875b88f70

See more details on using hashes here.

File details

Details for the file ruffrgimportfixer-0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for ruffrgimportfixer-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 39f8d0024f04f2e37aad422f2d5abbf06d06eda0c1968b0fe4b2b8ca59ca4760
MD5 1268909c5bb9c53396ceda0161dc6ed4
BLAKE2b-256 2f6c2f51c1d57d69496fde519699f5113cc4c6b1ebeb223f004e7245e436d4a8

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