Welcome to asort’s documentation!

asort is a Python library and command line utility for ensuring all __all__ lists in python are kept sorted

Check out the Usage section for further information, including how to Installation the project.

Contents

Usage

Installation

To use asort, first install it using pip:

(.venv) $ pip install asort

Running asort

asort can be run directly from the command line

(.venv) $ asort __init__.py directory/1
Fixing directory/1/__init__.py
Fixing directory/1/2/__init__.py

or it can be used as a python library

>>> from asort import ASort
>>> ASort().process_path("directory/1")
['directory/1/__init__.py', 'directory/1/2/__init__.py']

API

class asort.api.ASort
static process_path(path: str) list[Path]

given a path, recursively sort the __all__lists of all found python files if the path is a directory, otherwise, just sort the given file at the path

Parameters

path – the path to sort from

Returns

the files that were fixed