Skip to content

Commit 79a2511

Browse files
committed
Remove black, isort and flake8 in favour of ruff
1 parent af5e623 commit 79a2511

File tree

7 files changed

+34
-33
lines changed

7 files changed

+34
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pip-selfcheck.json
2222
*djlsp.log
2323
.DS_Store
2424
.mypy_cache
25+
.ruff_cache
2526
.template-version
2627
.vscode
2728
.pytest_cache/

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ $(ENV):
1919
develop: $(ENV)
2020

2121
fix-codestyle:
22-
$(BIN)/black $(CODE_LOCATIONS)
23-
$(BIN)/isort $(CODE_LOCATIONS)
22+
$(BIN)/ruff check --fix $(CODE_LOCATIONS)
23+
$(BIN)/ruff format $(CODE_LOCATIONS)
2424

2525
lint:
26-
$(BIN)/black --check $(CODE_LOCATIONS)
27-
$(BIN)/isort --check-only $(CODE_LOCATIONS)
28-
$(BIN)/flake8 $(CODE_LOCATIONS)
26+
$(BIN)/ruff check $(CODE_LOCATIONS)
27+
$(BIN)/ruff format --check $(CODE_LOCATIONS)
2928

3029
test: lint
3130
$(BIN)/tox run

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ This LSP supports:
3030

3131
## Support (tested)
3232

33-
- Python: 3.10, 3.11, 3.12, 3.13
34-
- Django: 4.2, 5.0, 5.1, 5.2
33+
- Python: 3.10, 3.11, 3.12, 3.13, 3.14
34+
- Django: 4.2, 5.0, 5.1, 5.2, 6.0
3535

3636

3737
## Installation
@@ -121,6 +121,12 @@ To use the Django template LSP with VSCode read the following [readme](vscode/RE
121121

122122
## Development
123123

124+
Install development dependencies:
125+
126+
```bash
127+
make develop
128+
```
129+
124130
For local development, using [Helix](https://helix-editor.com) is the easiest approach.
125131
The configuration for using the source Django template language server, with logging enabled, is already set up.
126132

djlsp/parser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def clear_completions_cache():
3333

3434

3535
class TemplateParser:
36-
3736
def __init__(
3837
self,
3938
workspace_index: WorkspaceIndex,
@@ -170,7 +169,8 @@ def create_jedi_script(
170169

171170
script_lines = []
172171
if re.search(r"{% ?for ", self.document.source):
173-
script_lines.append(dedent('''
172+
script_lines.append(
173+
dedent('''
174174
class _DjangoForLoop:
175175
"""Django for loop context"""
176176
counter: int
@@ -180,7 +180,8 @@ class _DjangoForLoop:
180180
first: bool
181181
last: bool
182182
parentloop: "_DjangoForLoop"
183-
'''))
183+
''')
184+
)
184185

185186
for variable_name, variable in context.items():
186187
if variable.type:

djlsp/scripts/django-collector.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def collect_for_wagtail(self):
573573
if model.context_object_name:
574574
self.templates[model.template]["context"][
575575
model.context_object_name
576-
] = (model.__module__ + "." + model.__name__)
576+
] = model.__module__ + "." + model.__name__
577577

578578

579579
#######################################################################################
@@ -596,10 +596,12 @@ def get_default_django_settings_module():
596596

597597

598598
if __name__ == "__main__":
599-
parser = argparse.ArgumentParser(description="""
599+
parser = argparse.ArgumentParser(
600+
description="""
600601
Collect django project information for LSP.
601602
pure python script that is runned in project environment for using django.
602-
""")
603+
"""
604+
)
603605
parser.add_argument("--django-settings-module", action="store", type=str)
604606
parser.add_argument("--project-src", action="store", type=str)
605607
args = parser.parse_args()

pyproject.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ django-template-lsp = "djlsp.cli:main"
3030
[project.optional-dependencies]
3131
dev = [
3232
"tox",
33-
"black",
34-
"isort",
35-
"flake8",
36-
"flake8-pyproject",
33+
"ruff",
3734
"pytest",
3835
"pytest-check",
3936
"pytest-cov",
@@ -52,12 +49,15 @@ include-package-data = false
5249
[tool.setuptools.packages.find]
5350
include = ["djlsp*"]
5451

55-
[tool.isort]
56-
profile = "black"
57-
known_first_party = "djlsp"
58-
skip_glob = ["tests/django_test/env/*"]
52+
[tool.ruff]
53+
line-length = 88
54+
exclude = [
55+
"tests/django_test/env",
56+
".venv",
57+
]
58+
59+
[tool.ruff.lint]
60+
select = ["E", "F", "W", "I"]
5961

60-
[tool.flake8]
61-
max-line-length = 88
62-
extend-ignore = "W503"
63-
exclude = "tests/django_test/env/"
62+
[tool.ruff.lint.isort]
63+
known-first-party = ["djlsp"]

setup.cfg

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

0 commit comments

Comments
 (0)