Let's say I have the following __all__
already set:
from click import *
from cloup import *
__all__ = [
"Argument",
"argument",
"BOOL",
"Choice",
"clear",
"ClickException",
"color_option",
"ColorOption",
...
]
When running asort 0.1.3, I get the following results:
$ poetry run python -m pip install asort
Collecting asort
Downloading asort-0.1.3-py3-none-any.whl (9.8 kB)
Installing collected packages: asort
Successfully installed asort-0.1.3
$ poetry run asort ./__init__.py
$ cat ./__init__.py
from click import *
from cloup import *
__all__ = [
"Argument",
"BOOL",
"Choice",
"ClickException",
"ColorOption",
"argument",
"clear",
"color_option",
...
]
You can see above how all title-cased and upper-cased strings bubble up at the top of the list. This is normal as it is the natural order of sorted strings in Python.
What I would like to have is a parameter or a configuration option so I can instead have the elements of the __all__
list sorted regardless of the case. I.e., in the case I presented here, I expect the __all__
to look like this:
__all__ = [
"Argument",
"argument",
"BOOL",
"Choice",
"clear",
"ClickException",
"color_option",
"ColorOption",
...
]
My main motivation to have this flavour of sorting is so I can visually inspect that for each of my main classe (like Argument
), I have a corresponding decorator (the lower-cased argument
) publicly available at the root of my library.