Skip to content

Commit 2335079

Browse files
committed
Update isort config
Signed-off-by: Mihai Criveti <[email protected]>
1 parent a0926a2 commit 2335079

File tree

2 files changed

+53
-52
lines changed

2 files changed

+53
-52
lines changed

.isort.cfg

Lines changed: 0 additions & 48 deletions
This file was deleted.

pyproject.toml

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,59 @@ line-length = 200
220220
target-version = ["py310", "py311", "py312"]
221221
include = "\\.pyi?$"
222222

223-
# Configured in .isort.cfg instead
224-
# [tool.isort]
225-
# profile = "black"
226-
# multi_line_output = 3
223+
# isort configuration
224+
[tool.isort]
225+
###############################################################################
226+
# Core behaviour
227+
###############################################################################
228+
profile = "black" # inherit Black's own import-sorting profile
229+
line_length = 200 # match Black's custom line length
230+
multi_line_output = 3 # vertical-hanging-indent style
231+
include_trailing_comma = true # keep trailing commas for Black
232+
from_first = true # place all "from ... import ..." before plain "import ..."
233+
234+
###############################################################################
235+
# Section ordering & headings
236+
###############################################################################
237+
sections = ["FUTURE", "STDLIB", "FIRSTPARTY", "THIRDPARTY", "LOCALFOLDER"]
238+
import_heading_future = "Future" # header above FUTURE imports (if headings enabled)
239+
import_heading_stdlib = "Standard" # header for built-in Stdlib imports
240+
import_heading_thirdparty = "Third-Party" # header for pip-installed packages
241+
import_heading_firstparty = "First-Party" # header for internal 'mcpgateway' code
242+
import_heading_localfolder = "Local" # header for ad-hoc scripts / tests
243+
244+
###############################################################################
245+
# What belongs where
246+
###############################################################################
247+
known_first_party = ["mcpgateway"] # treat "mcpgateway.*" as FIRSTPARTY
248+
known_local_folder = ["tests", "scripts"] # treat these folders as LOCALFOLDER
249+
# src_paths = ["src/mcpgateway"] # uncomment only if package moves under src/
250+
251+
###############################################################################
252+
# Style niceties
253+
###############################################################################
254+
force_sort_within_sections = true # always alphabetise names inside each block
255+
order_by_type = false # don't group imports by "type vs. straight name"
256+
balanced_wrapping = true # spread wrapped imports evenly between lines
257+
lines_between_sections = 1 # exactly one blank line between the five groups
258+
lines_between_types = 1 # one blank line between 'import X' and 'from X import ...'
259+
no_lines_before = ["LOCALFOLDER"] # suppress blank line *before* the LOCALFOLDER block
260+
ensure_newline_before_comments = true # newline before any inline # comment after an import
261+
262+
###############################################################################
263+
# Ignore junk we never want to touch
264+
###############################################################################
265+
extend_skip = [
266+
".md", ".json", ".yaml", ".yml",
267+
"dist", "build", ".venv", ".tox",
268+
"*.tmp", "*.bak",
269+
]
270+
skip_glob = ["**/__init__.py"] # leave namespace init files alone
271+
272+
# ---- Optional CI toggles ----------------------------------------------------
273+
# check_only = true # dry-run mode: non-zero exit if files would change
274+
# verbose = true # print every file name processed
275+
# case_sensitive = true # treat upper/lowercase differences as significant
227276

228277
[tool.mypy]
229278
# Target Python version

0 commit comments

Comments
 (0)