Skip to content

Commit ccdbf12

Browse files
authored
Merge pull request #107 from timkpaine/tkp/ruff
update ruff usage
2 parents 3be11c9 + c6a49b7 commit ccdbf12

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ tests: testpy testjs ## run the tests
2727
###########
2828
# Linting #
2929
###########
30-
lintpy: ## Black/flake8 python
31-
python -m ruff jupyterlab_commands setup.py
32-
python -m black --check jupyterlab_commands setup.py
30+
lintpy: ## lint python with ruff
31+
python -m ruff check jupyterlab_commands
32+
python -m ruff format --check jupyterlab_commands
3333

3434
lintjs: ## ESlint javascript
3535
cd js; yarn lint
3636

3737
lint: lintpy lintjs ## run linter
3838

39-
fixpy: ## Black python
40-
python -m ruff jupyterlab_commands setup.py --fix
41-
python -m black jupyterlab_commands/ setup.py
39+
fixpy: ## autoformat python with ruff
40+
python -m ruff check --fix jupyterlab_commands
41+
python -m ruff format jupyterlab_commands
4242

4343
fixjs: ## ESlint Autofix JS
4444
cd js; yarn fix

jupyterlab_commands/extension.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ def load_jupyter_server_extension(nb_server_app):
4949
base_url = web_app.settings["base_url"]
5050

5151
host_pattern = ".*$"
52-
nb_server_app.log.info(
53-
"Installing jupyterlab_commands handler on path %s"
54-
% url_path_join(base_url, "commands")
55-
)
52+
nb_server_app.log.info("Installing jupyterlab_commands handler on path %s" % url_path_join(base_url, "commands"))
5653

5754
nb_server_app.log.info("Available commands: %s" % ",".join(k for k in commands))
5855
web_app.add_handlers(

jupyterlab_commands/tests/test_init.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33

44
class TestInit:
55
def test__jupyter_server_extension_paths(self):
6-
assert _jupyter_server_extension_paths() == [
7-
{"module": "jupyterlab_commands.extension"}
8-
]
6+
assert _jupyter_server_extension_paths() == [{"module": "jupyterlab_commands.extension"}]

pyproject.toml

+14-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ dependencies = [
3838

3939
[project.optional-dependencies]
4040
develop = [
41-
"black>=23",
4241
"check-manifest",
4342
"ruff",
4443
"pytest",
@@ -96,5 +95,17 @@ build_cmd = "build"
9695
[tool.ruff]
9796
line-length = 120
9897

99-
[tool.ruff.per-file-ignores]
100-
"__init__.py" = ["F401"]
98+
[tool.ruff.lint.isort]
99+
combine-as-imports = true
100+
default-section = "third-party"
101+
known-first-party = ["jupyterlab_commands"]
102+
section-order = [
103+
"future",
104+
"standard-library",
105+
"third-party",
106+
"first-party",
107+
"local-folder",
108+
]
109+
110+
[tool.ruff.lint.per-file-ignores]
111+
"__init__.py" = ["F401", "F403"]

0 commit comments

Comments
 (0)