Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove explicit isort dependency

Roland Geider77f35431476c
diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml
index a4a633b26..f6e119822 100644
--- a/.github/workflows/formatter.yml
+++ b/.github/workflows/formatter.yml
@@ -20,16 +20,14 @@ jobs:
uses: actions/checkout@v7
- name: Get dependencies
- run: pip install ruff isort
+ run: pip install ruff
+
+ - name: Sort the imports
+ run: ruff check --select I --fix
- name: Format the code
run: ruff format
- # While ruff can also do some sorting, isort can still be configured to do more,
- # like grouping imports, etc.
- - name: Sort the imports
- run: isort .
-
- name: Push a commit with the changed files
# Needed if no files were changed
diff --git a/pyproject.toml b/pyproject.toml
index 7066c32d9..407760b7c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -76,7 +76,6 @@ dev = [
"django-extensions~=4.1",
"faker~=40.36.0",
"hatchling~=1.31.0",
- "isort~=8.0.1",
"ruff~=0.16.2",
"tblib~=3.2.0",
]
@@ -153,69 +152,39 @@ select = [
"F", # Pyflakes
"E", # Pycodestyle
"W",
+ "I", # isort
]
+[tool.ruff.lint.per-file-ignores]
+# Import sorting was historically skipped for these (isort's "skip" list)
+"**/migrations/*.py" = ["I"]
+"settings/*.py" = ["I"]
+"extras/**/*.py" = ["I"]
+"**/apps.py" = ["I"]
+
+#
+# TODO: ruff doesn't understand force_grid_wrap=2 yet, if that is ever implemented,
+# we should add the appropriate configurations
+[tool.ruff.lint.isort]
+known-first-party = ["wger"]
+section-order = ["future", "standard-library", "django", "third-party", "first-party", "local-folder"]
+combine-as-imports = true
+order-by-type = true
+lines-after-imports = 2
+
+[tool.ruff.lint.isort.sections]
+django = ["django"]
+
+[tool.ruff.lint.isort.import-heading]
+future = "Future"
+standard-library = "Standard Library"
+django = "Django"
+third-party = "Third Party"
+first-party = "wger"
+local-folder = "Local"
+
[tool.ruff.format]
quote-style = "single"
indent-style = "space"
skip-magic-trailing-comma = false # Like Black, respect magic trailing commas.
line-ending = "auto"
-
-[tool.isort]
-src_paths = ["wger", "extras"]
-
-sections = ["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
-skip = ["extras", "build", "dist", "node_modules", "migrations", "docs", "settings", "apps.py", "venv", ".venv", ]
-# If set to true - ensures that if a star import is present, nothing else is
-# imported from that namespace.
-combine_star = false
-# If set to true - imports will be sorted by their length instead of
-# alphabetically.
-length_sort = false
-# An integer that represents the longest line-length you want a single import to
-# take. Defaults to 80.
-line_length = 119
-# A comment to consistently place directly above future imports.
-import_heading_future = "Future"
-# A comment to consistently place directly above django imports.
-import_heading_django = "Django"
-# A comment to consistently place directly above imports from the standard library.
-import_heading_stdlib = "Standard Library"
-# A comment to consistently place directly above third-party imports.
-import_heading_thirdparty = "Third Party"
-# A comment to consistently place directly above wger imports.
-import_heading_firstparty = "wger"
-# A comment to consistently place directly above imports that start with '.'.
-import_heading_localfolder = "Local"
-# An integer that represents the number of spaces you would like to indent by or
-# Tab to indent by a single tab.
-indent = "' '"
-# A list of imports that will be forced to display within the first party
-# category.
-known_first_party = ["wger"]
-known_django = ["django"]
-# An integer that represents how you want imports to be displayed if they're long
-# enough to span multiple lines. A full definition of all possible modes can be
-# found in isort's README.
-multi_line_output = 3
-force_grid_wrap = 2
-# If set to true - isort will create separate sections within "from" imports
-# for CONSTANTS, Classes, and modules/functions.
-order_by_type = true
-# Forces a certain number of lines after the imports and before the first line
-# of functional code. By default, this is 2 lines if the first line of code is a
-# class or function. Otherwise, it's 1.
-lines_after_imports = 2
-
-# If set to true - isort will combine as imports on the same line within for
-# import statements. By default, isort forces all as imports to display on their
-# own lines.
-combine_as_imports = true
-
-# If set to true - isort will add imports even if the file specified is
-# currently completely empty.
-force_adds = false
-# Include a trailing comma after the imports. This ensures that yapf doesn't
-# reformat the code
-include_trailing_comma = true
-
diff --git a/uv.lock b/uv.lock
index 54f710f57..418675c5d 100644
--- a/uv.lock
+++ b/uv.lock
@@ -1060,15 +1060,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/5a/de/bbc12563bbf979618d17625a4e753ff7a078523e28d870d3626daa97261a/invoke-3.0.3-py3-none-any.whl", hash = "sha256:f11327165e5cbb89b2ad1d88d3292b5113332c43b8553b494da435d6ec6f5053", size = 160958, upload-time = "2026-04-07T15:17:46.875Z" },
]
-[[package]]
-name = "isort"
-version = "8.0.1"
-source = { registry = "https://pypi.org/simple" }
-sdist = { url = "https://files.pythonhosted.org/packages/ef/7c/ec4ab396d31b3b395e2e999c8f46dec78c5e29209fac49d1f4dace04041d/isort-8.0.1.tar.gz", hash = "sha256:171ac4ff559cdc060bcfff550bc8404a486fee0caab245679c2abe7cb253c78d", size = 769592, upload-time = "2026-02-28T10:08:20.685Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/3e/95/c7c34aa53c16353c56d0b802fba48d5f5caa2cdee7958acbcb795c830416/isort-8.0.1-py3-none-any.whl", hash = "sha256:28b89bc70f751b559aeca209e6120393d43fbe2490de0559662be7a9787e3d75", size = 89733, upload-time = "2026-02-28T10:08:19.466Z" },
-]
-
[[package]]
name = "jmespath"
version = "1.1.0"
@@ -2014,7 +2005,6 @@ dev = [
{ name = "django-extensions" },
{ name = "faker" },
{ name = "hatchling" },
- { name = "isort" },
{ name = "ruff" },
{ name = "tblib" },
]
@@ -2073,7 +2063,6 @@ dev = [
{ name = "django-extensions", specifier = "~=4.1" },
{ name = "faker", specifier = "~=40.36.0" },
{ name = "hatchling", specifier = "~=1.31.0" },
- { name = "isort", specifier = "~=8.0.1" },
{ name = "ruff", specifier = "~=0.16.2" },
{ name = "tblib", specifier = "~=3.2.0" },
]