-
-
Notifications
You must be signed in to change notification settings - Fork 613
Open
Description
Info
isort
version:6.0.1
python
version:Python 3.13.3
I have the following configuration inside my pyproject.toml
:
[tool.isort]
skip = [".gitignore", "venv", "dev-venv"]
star_first = true
# Intentionally setting a low line length, so that isort will break
# lines when there is more than one binding to import.
line_length = 10
include_trailing_comma = true
split_on_trailing_comma = true
use_parentheses = true
order_by_type = true
lines_after_imports = 2
lines_between_sections = 1
lines_between_types = 1
force_grid_wrap = 2
# Imports, that are not recognized as belonging to one of the other
# sections are put in the default section.
default_section = "THIRDPARTY"
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
force_alphabetical_sort = true
force_alphabetical_sort_within_sections = true
import_heading_stdlib = "# standard library"
import_heading_firstparty = "# first party"
import_heading_thirdparty = "# third party"
import_heading_future = "# future"
import_heading_localfolder = "# local"
ensure_newline_before_comments = true
I run isort
as follows:
isort --settings-path pyproject.toml --verbose .
What I tried
I tested, that isort
reads the configuration in pyproject.toml
, by commenting out everything inside pyproject.toml
and running it, then uncommenting settings one by one and observing how import sorting and formatting changes in my source code files. That works.
What doesn't work is: isort
simply doesn't add any comments as import section headings at all. Even setting the heading strings as shown in above configuration has no effect regarding inserting comments. I am at a loss what more I can try.
Here is some example output of isort
run as shown above:
_ _
(_) ___ ___ _ __| |_
| |/ _/ / _ \/ '__ _/
| |\__ \/\_\/| | | |_
|_|\___/\___/\_/ \_/
isort your imports, so you don't have to.
VERSION 6.0.1
else-type place_module for os returned STDLIB
else-type place_module for sys returned STDLIB
from-type place_module for django.core.management returned THIRDPARTY
from-type place_module for django.core.asgi returned THIRDPARTY
else-type place_module for os returned STDLIB
from-type place_module for django.core.wsgi returned THIRDPARTY
else-type place_module for os returned STDLIB
from-type place_module for pathlib returned STDLIB
else-type place_module for os returned STDLIB
from-type place_module for django.contrib returned THIRDPARTY
from-type place_module for django.urls returned THIRDPARTY
from-type place_module for django.apps returned THIRDPARTY
from-type place_module for django.templatetags.static returned THIRDPARTY
from-type place_module for django.urls returned THIRDPARTY
from-type place_module for jinja2 returned THIRDPARTY
else-type place_module for logging returned STDLIB
from-type place_module for django returned THIRDPARTY
from-type place_module for django.contrib.auth.decorators returned THIRDPARTY
from-type place_module for django.contrib.auth.views returned THIRDPARTY
from-type place_module for django.http returned THIRDPARTY
from-type place_module for django.shortcuts returned THIRDPARTY
from-type place_module for django.urls returned THIRDPARTY
from-type place_module for django.views.decorators.cache returned THIRDPARTY
from-type place_module for django.views.generic.edit returned THIRDPARTY
from-type place_module for engine.forms returned THIRDPARTY
else-type place_module for logging returned STDLIB
from-type place_module for django.db returned THIRDPARTY
from-type place_module for django.contrib returned THIRDPARTY
from-type place_module for . returned LOCALFOLDER
from-type place_module for django.contrib.auth.views returned THIRDPARTY
from-type place_module for django.urls returned THIRDPARTY
from-type place_module for django.test returned THIRDPARTY
from-type place_module for datetime returned STDLIB
from-type place_module for markdown_pdf returned THIRDPARTY
else-type place_module for fitz returned THIRDPARTY
from-type place_module for flask returned THIRDPARTY
else-type place_module for anonymizer_context returned THIRDPARTY
else-type place_module for datetime returned STDLIB
else-type place_module for evaluator returned THIRDPARTY
else-type place_module for logging returned STDLIB
else-type place_module for os returned STDLIB
else-type place_module for pdf_creator returned THIRDPARTY
else-type place_module for threading returned STDLIB
else-type place_module for time returned STDLIB
from-type place_module for dataclasses returned STDLIB
from-type place_module for itertools returned STDLIB
from-type place_module for openai returned THIRDPARTY
from-type place_module for utils.list_utils returned THIRDPARTY
from-type place_module for utils.text_utils returned THIRDPARTY
else-type place_module for json returned STDLIB
else-type place_module for logging returned STDLIB
else-type place_module for os returned STDLIB
from-type place_module for collections returned STDLIB
from-type place_module for dataclasses returned STDLIB
from-type place_module for functools returned STDLIB
from-type place_module for mistralai returned THIRDPARTY
from-type place_module for pprint returned STDLIB
from-type place_module for utils.dict_utils returned THIRDPARTY
from-type place_module for utils.text_utils returned THIRDPARTY
else-type place_module for json returned STDLIB
else-type place_module for logging returned STDLIB
else-type place_module for os returned STDLIB
else-type place_module for re returned STDLIB
else-type place_module for textwrap returned STDLIB
else-type place_module for os returned STDLIB
from-type place_module for utils.list_utils returned THIRDPARTY
else-type place_module for logging returned STDLIB
else-type place_module for re returned STDLIB
else-type place_module for textwrap returned STDLIB
from-type place_module for functools returned STDLIB
from-type place_module for functools returned STDLIB
dev-venv was skipped as it's listed in 'skip' setting, matches a glob in 'skip_glob' setting, or is in a .gitignore file with --skip-gitignore enabled.
venv was skipped as it's listed in 'skip' setting, matches a glob in 'skip_glob' setting, or is in a .gitignore file with --skip-gitignore enabled.
Skipped 2 files
Metadata
Metadata
Assignees
Labels
No labels