| 1 |
[project] |
| 2 |
name = "isort" |
| 3 |
dynamic = ["version"] |
| 4 |
description = "A Python utility / library to sort Python imports." |
| 5 |
authors = [{name = "Daniƫl van Noord", email = "[email protected]"}, {name = "Timothy Crosley", email = "[email protected]"}, {name = "staticdev", email = "[email protected]"}] |
| 6 |
license = "MIT" |
| 7 |
readme = "README.md" |
| 8 |
repository = "https://github.com/pycqa/isort" |
| 9 |
homepage = "https://isort.readthedocs.io//" |
| 10 |
documentation = "https://isort.readthedocs.io/" |
| 11 |
keywords = ["Refactor", "Lint", "Imports", "Sort", "Clean"] |
| 12 |
classifiers = [ |
| 13 |
"Development Status :: 6 - Mature", |
| 14 |
"Intended Audience :: Developers", |
| 15 |
"Natural Language :: English", |
| 16 |
"Environment :: Console", |
| 17 |
"License :: OSI Approved :: MIT License", |
| 18 |
"Programming Language :: Python", |
| 19 |
"Programming Language :: Python :: 3", |
| 20 |
"Programming Language :: Python :: 3.10", |
| 21 |
"Programming Language :: Python :: 3.11", |
| 22 |
"Programming Language :: Python :: 3.12", |
| 23 |
"Programming Language :: Python :: 3.13", |
| 24 |
"Programming Language :: Python :: 3.14", |
| 25 |
"Programming Language :: Python :: 3.15", |
| 26 |
"Programming Language :: Python :: 3 :: Only", |
| 27 |
"Programming Language :: Python :: Implementation :: CPython", |
| 28 |
"Programming Language :: Python :: Implementation :: PyPy", |
| 29 |
"Topic :: Software Development :: Libraries", |
| 30 |
"Topic :: Utilities", |
| 31 |
] |
| 32 |
include = [ |
| 33 |
{ path = "tests", format = "sdist" }, |
| 34 |
{ path = "ACKNOWLEDGEMENTS.md", format = "sdist" }, |
| 35 |
{ path = "LICENSE", format = "sdist" }, |
| 36 |
] |
| 37 |
requires-python = ">=3.10.0" |
| 38 |
|
| 39 |
dependencies = [ |
| 40 |
"mypy-extensions>=1.1.0", |
| 41 |
] |
| 42 |
|
| 43 |
[project.urls] |
| 44 |
Homepage = "https://isort.readthedocs.io/" |
| 45 |
Documentation = "https://isort.readthedocs.io/" |
| 46 |
Repository = "https://github.com/PyCQA/isort" |
| 47 |
Changelog = "https://github.com/PyCQA/isort/releases" |
| 48 |
|
| 49 |
[tool.hatch.version] |
| 50 |
source = "vcs" |
| 51 |
|
| 52 |
[tool.hatch.version.raw-options] |
| 53 |
local_scheme = "no-local-version" |
| 54 |
|
| 55 |
[project.scripts] |
| 56 |
isort = "isort.main:main" |
| 57 |
isort-identify-imports = "isort.main:identify_imports_main" |
| 58 |
|
| 59 |
[project.optional-dependencies] |
| 60 |
colors = ["colorama"] |
| 61 |
|
| 62 |
[tool.coverage.paths] |
| 63 |
source = [ |
| 64 |
"isort/", |
| 65 |
".tox/*/lib/python*/site-packages/isort/", |
| 66 |
".tox/*/lib/site-packages/isort/" |
| 67 |
] |
| 68 |
tests = ["tests", "*/tests"] |
| 69 |
|
| 70 |
[tool.coverage.run] |
| 71 |
branch = true |
| 72 |
parallel = true |
| 73 |
source = ["isort", "tests"] |
| 74 |
omit = [ |
| 75 |
"isort/_vendored/*", |
| 76 |
"tests/*", |
| 77 |
] |
| 78 |
|
| 79 |
[tool.coverage.report] |
| 80 |
show_missing = true |
| 81 |
fail_under = 99 |
| 82 |
exclude_lines = [ |
| 83 |
"pragma: no cover", |
| 84 |
"except ImportError:", |
| 85 |
"if TYPE_CHECKING:", |
| 86 |
"if __name__ == .__main__.:", |
| 87 |
"raise NotImplementedError", |
| 88 |
] |
| 89 |
|
| 90 |
[build-system] |
| 91 |
requires = ["hatchling", "hatch-vcs", "hatch-mypyc"] |
| 92 |
build-backend = "hatchling.build" |
| 93 |
|
| 94 |
[tool.hatch.build.targets.wheel.hooks.mypyc] |
| 95 |
# To allow local development without compilation after each change. Force compilation with: |
| 96 |
# `HATCH_BUILD_HOOK_ENABLE_MYPYC=true uv sync --reinstall` |
| 97 |
enable-by-default = false |
| 98 |
dependencies = [ |
| 99 |
"hatch-mypyc", |
| 100 |
"mypy", |
| 101 |
"types-colorama>=0.4.2", |
| 102 |
] |
| 103 |
exclude = [ |
| 104 |
# Keep `python -m isort` working in mypyc wheels. |
| 105 |
"isort/__main__.py", |
| 106 |
# We rely on `__dict__` to make Exceptions pickable, mypyc removes this attribute. |
| 107 |
"isort/exceptions.py" |
| 108 |
] |
| 109 |
|
| 110 |
[dependency-groups] |
| 111 |
dev = [ |
| 112 |
"bandit>=1.8.6", |
| 113 |
"black>=25.9.0", |
| 114 |
"colorama>=0.4.6", |
| 115 |
"coverage[toml]>=7.10.7", |
| 116 |
"example-isort-sorting-plugin>=0.1.0", |
| 117 |
"example-shared-isort-profile>=0.1.0", |
| 118 |
"flake8>=7.3.0", |
| 119 |
"flake8-bugbear>=24.12.12", |
| 120 |
"flake8-pyproject>=1.2.3", |
| 121 |
"hatch>=1.14.0", |
| 122 |
"hypothesis>=6.140.3", |
| 123 |
"hypothesmith>=0.3.3", |
| 124 |
"libcst>=1.9.0", |
| 125 |
"mypy>=2.3.1", |
| 126 |
"pep8-naming>=0.15.1", |
| 127 |
"pytest>=8.4.2", |
| 128 |
"pytest-benchmark>=5.1.0", |
| 129 |
"ruff>=0.13.3", |
| 130 |
"stdlibs>=2026.2.26", |
| 131 |
"tox>=4.30.3", |
| 132 |
"tox-uv>=1.28.0", |
| 133 |
"types-colorama>=0.4.2", |
| 134 |
"uv>=0.8.23", |
| 135 |
] |
| 136 |
docs = [ |
| 137 |
"myst-parser>=4.0.1", |
| 138 |
"sphinx>=7.4.7", |
| 139 |
"sphinx-immaterial>=0.13.9", |
| 140 |
] |
| 141 |
|
| 142 |
[tool.flake8] |
| 143 |
max-line-length = 100 |
| 144 |
# Ignore non PEP 8 compliant rules as suggested by black |
| 145 |
# E203: https://github.com/psf/black/blob/3fab5ade71bccf80ae0a5af76729099869adea56/docs/the_black_code_style/current_style.md#slices |
| 146 |
# B042: Weird rule that requires random arguments to be passed, without clear benefit |
| 147 |
extend-ignore = [ "E203", "B042" ] |
| 148 |
exclude = "_vendored" |
| 149 |
per-file-ignores = [ |
| 150 |
"tests/unit/example_crlf_file.py:F401", |
| 151 |
"tests/unit/profiles/test_black.py:E501", |
| 152 |
"tests/unit/test_regressions.py:E501", |
| 153 |
] |
| 154 |
|
| 155 |
[tool.mypy] |
| 156 |
python_version = "3.10" |
| 157 |
strict = true |
| 158 |
follow_imports = "silent" |
| 159 |
packages = ["isort", "tests"] |
| 160 |
exclude = "isort/_vendored|tests/unit/example_projects|tests/unit/example_crlf_file.py" |
| 161 |
|
| 162 |
[tool.ruff] |
| 163 |
target-version = "py310" |
| 164 |
line-length = 100 |
| 165 |
lint.select = [ |
| 166 |
"ASYNC", |
| 167 |
"B", |
| 168 |
"C4", |
| 169 |
"C90", |
| 170 |
"E", |
| 171 |
"F", |
| 172 |
"FLY", |
| 173 |
"PERF", |
| 174 |
"PIE", |
| 175 |
"PLC", |
| 176 |
"PLE", |
| 177 |
"PT", |
| 178 |
"RUF", |
| 179 |
"S", |
| 180 |
"UP", |
| 181 |
"W", |
| 182 |
] |
| 183 |
lint.ignore = [ |
| 184 |
"B904", |
| 185 |
"E501", |
| 186 |
"PERF203", |
| 187 |
"PT030", # Too much work to turn on for now |
| 188 |
"RUF100", |
| 189 |
] |
| 190 |
lint.exclude = [ "isort/_vendored/*" ] |
| 191 |
lint.mccabe.max-complexity = 91 # Default is 10 |
| 192 |
format.exclude = [ "README.md", "docs/configuration/multi_line_output_modes.md"] |
| 193 |
|
| 194 |
[tool.ruff.lint.per-file-ignores] |
| 195 |
"isort/hooks.py" = [ "S603" ] |
| 196 |
"isort/output.py" = [ "PLC0206" ] |
| 197 |
"isort/settings.py" = [ "PLC0414", "S603", "S607" ] |
| 198 |
"tests/*" = [ "RUF001", "S" ] |
| 199 |
"tests/unit/example_crlf_file.py" = [ "F401" ] |
| 200 |
|
| 201 |
[tool.isort] |
| 202 |
profile = "hug" |
| 203 |
src_paths = ["isort", "tests"] |
| 204 |
skip = [ |
| 205 |
"tests/unit/example_crlf_file.py" |
| 206 |
] |
| 207 |
|
| 208 |
[tool.pytest.ini_options] |
| 209 |
filterwarnings = [ |
| 210 |
"error", |
| 211 |
# isort raies many UserWarnings itself, ignore these globally as it is too much work to disable |
| 212 |
# these per warning for now. |
| 213 |
"ignore::UserWarning", |
| 214 |
# We don't really care about randomizing paths and don't want to add another hypothesis dependency |
| 215 |
"ignore:.*from_type\\(thing=Path\\).*:hypothesis.errors.SmallSearchSpaceWarning", |
| 216 |
] |