https://github.com/rec/simp
Simple include file sorting
https://github.com/rec/simp
Last synced: 12 months ago
JSON representation
Simple include file sorting
- Host: GitHub
- URL: https://github.com/rec/simp
- Owner: rec
- License: mit
- Created: 2020-05-15T16:55:53.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-11T16:37:24.000Z (about 5 years ago)
- Last Synced: 2025-02-13T18:53:00.880Z (over 1 year ago)
- Language: Python
- Size: 43.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
simp.py
-------
Usage
=====
.. code-block:: bash
simp.py [-h] [--commit] [--dry_run] [--fail] [targets [targets ...]]
Description
===========
Sort the import directives in Python files, excluding __future__.
Positional arguments
====================
``targets``
One or more Python files or directories with Python files.
Without arguments, runs simp on the current directory.
Optional arguments
==================
``-h``, ``--help``
Show this help message and exit
``--commit``, ``-c``
Git commit the changes
``--dry_run``, ``-d``
If set, do not make the changes to the Python files, but just
list the diffs.
``--fail``, ``-f``
If set, the program fails if any changes need to be made. This
is useful for a commit hook to check if all imports are sorted.
Comments
========
I wanted to sort my Python includes with no fuss. ``simp`` finds the first block
of unindented import statements, and sorts them. Any comments between import
lines bubble up to the top in their original order.
(automatically generated by `doks `_ on 2020-11-01T14:22:18.849238)