diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f78f4ac..74a9157 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.10 + rev: v0.5.0 hooks: - id: ruff args: [--exit-non-zero-on-fix] @@ -27,7 +27,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.5 + rev: 0.28.6 hooks: - id: check-github-workflows - id: check-renovate @@ -38,10 +38,9 @@ repos: - id: actionlint - repo: https://github.com/tox-dev/pyproject-fmt - rev: 1.8.0 + rev: 2.1.3 hooks: - id: pyproject-fmt - additional_dependencies: [tox] - repo: https://github.com/abravalheri/validate-pyproject rev: v0.18 diff --git a/pyproject.toml b/pyproject.toml index 24b212d..d783d04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,9 +15,13 @@ keywords = [ "keyboard", "search", ] -license = {text = "ISC"} -maintainers = [{name = "Hugo van Kemenade"}] -authors = [{name = "Kenneth Reitz", email = "me@kennethreitz.org"}] +license = { text = "ISC" } +maintainers = [ + { name = "Hugo van Kemenade" }, +] +authors = [ + { name = "Kenneth Reitz", email = "me@kennethreitz.org" }, +] requires-python = ">=3.8" classifiers = [ "Development Status :: 5 - Production/Stable", @@ -39,20 +43,16 @@ dynamic = [ "version", ] dependencies = [ - 'pyperclip; platform_system == "Darwin"', - 'pyperclip; platform_system == "Windows"', + "pyperclip; platform_system=='Windows'", ] -[project.optional-dependencies] -tests = [ +optional-dependencies.tests = [ "pytest", "pytest-cov", ] -[project.urls] -Changelog = "https://github.com/hugovk/em-keyboard/releases" -Homepage = "https://github.com/hugovk/em-keyboard" -Source = "https://github.com/hugovk/em-keyboard" -[project.scripts] -em = "em_keyboard:cli" +urls.Changelog = "https://github.com/hugovk/em-keyboard/releases" +urls.Homepage = "https://github.com/hugovk/em-keyboard" +urls.Source = "https://github.com/hugovk/em-keyboard" +scripts.em = "em_keyboard:cli" [tool.hatch] version.source = "vcs" @@ -63,8 +63,7 @@ local_scheme = "no-local-version" [tool.ruff] fix = true -[tool.ruff.lint] -select = [ +lint.select = [ "C4", # flake8-comprehensions "E", # pycodestyle errors "EM", # flake8-errmsg @@ -74,19 +73,24 @@ select = [ "LOG", # flake8-logging "PGH", # pygrep-hooks "PYI", # flake8-pyi - "RUF100", # unused noqa (yesqa) "RUF022", # unsorted-dunder-all + "RUF100", # unused noqa (yesqa) "UP", # pyupgrade "W", # pycodestyle warnings "YTT", # flake8-2020 ] -ignore = [ +lint.ignore = [ "E203", # Whitespace before ':' "E221", # Multiple spaces before operator "E226", # Missing whitespace around arithmetic operator "E241", # Multiple spaces after ',' ] +lint.isort.known-first-party = [ + "em_keyboard", +] +lint.isort.required-imports = [ + "from __future__ import annotations", +] -[tool.ruff.lint.isort] -known-first-party = ["em_keyboard"] -required-imports = ["from __future__ import annotations"] +[tool.pyproject-fmt] +max_supported_python = "3.13" diff --git a/tests/test_em.py b/tests/test_em.py index d4cee9d..6127114 100644 --- a/tests/test_em.py +++ b/tests/test_em.py @@ -35,7 +35,7 @@ def test_star(mock_print: MagicMock, mock_argparse: MagicMock, test_name: str) - mock_print.assert_called_once_with("Copied! ⭐") else: mock_print.assert_called_once_with("⭐") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -52,7 +52,7 @@ def test_not_found(mock_print: MagicMock, mock_argparse: MagicMock) -> None: # Assert mock_print.assert_called_once_with("") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 1 @@ -70,7 +70,7 @@ def test_no_copy(mock_print: MagicMock, mock_argparse: MagicMock) -> None: # Assert mock_print.assert_called_once_with("⭐") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -94,7 +94,7 @@ def test_search_star(mock_print: MagicMock, mock_argparse: MagicMock) -> None: # Assert for arg in expected: assert call(arg) in mock_print.call_args_list - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -117,7 +117,7 @@ def test_search_single_result_is_copied( mock_print.assert_called_once_with("Copied! πŸ‡ΊπŸ‡¦ flag_ukraine") else: mock_print.assert_called_once_with("πŸ‡ΊπŸ‡¦ flag_ukraine") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -135,7 +135,7 @@ def test_search_not_found(mock_print: MagicMock, mock_argparse: MagicMock) -> No # Assert mock_print.assert_not_called() - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 1 @@ -157,7 +157,7 @@ def test_random(mock_print: MagicMock, mock_argparse: MagicMock) -> None: mock_print.assert_called_once_with("Copied! 😽 kissing_cat") else: mock_print.assert_called_once_with("😽 kissing_cat") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -176,7 +176,7 @@ def test_random_no_copy(mock_print: MagicMock, mock_argparse: MagicMock) -> None # Assert mock_print.assert_called_once_with("😽 kissing_cat") - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == 0 @@ -194,5 +194,5 @@ def test_no_name(mock_print: MagicMock, mock_argparse: MagicMock) -> None: # Assert mock_print.assert_not_called() - assert e.type == SystemExit + assert e.type is SystemExit assert e.value.code == "Error: the 'name' argument is required"