Skip to content

Commit f61f316

Browse files
author
Carl Crowder
committed
Converting to poetry for packaging instead of legacy setup.py method
1 parent eb8ec65 commit f61f316

11 files changed

+1069
-48
lines changed

MANIFEST.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

poetry.lock

Lines changed: 997 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

poke-pre-commit-ci

Whitespace-only changes.

pylint_plugin_utils/__init__.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ def augment_visit(linter: PyLinter, checker_method, augmentation):
4343
try:
4444
checker = get_checker(linter, checker_method.__self__.__class__)
4545
except AttributeError:
46-
checker = get_checker(
47-
linter, get_class(checker_method.__module__, checker_method.__qualname__)
48-
)
46+
checker = get_checker(linter, get_class(checker_method.__module__, checker_method.__qualname__))
4947

5048
old_method = getattr(checker, checker_method.__name__)
5149
setattr(checker, checker_method.__name__, AugmentFunc(old_method, augmentation))
@@ -101,9 +99,7 @@ def suppress_message(linter: PyLinter, checker_method, message_id_or_symbol, tes
10199
returns True. It is useful to prevent one particular message from being raised
102100
in one particular case, while leaving the rest of the messages intact.
103101
"""
104-
augment_visit(
105-
linter, checker_method, DoSuppress(linter, message_id_or_symbol, test_func)
106-
)
102+
augment_visit(linter, checker_method, DoSuppress(linter, message_id_or_symbol, test_func))
107103

108104

109105
class DoSuppress:
@@ -161,8 +157,5 @@ def get_message_definitions(self, message_id_or_symbol):
161157
elif hasattr(msgs_store, "get_message_definitions"):
162158
return msgs_store.get_message_definitions(message_id_or_symbol)
163159
else:
164-
msg = (
165-
"pylint.utils.MessagesStore does not have a "
166-
"get_message_definition(s) method"
167-
)
160+
msg = "pylint.utils.MessagesStore does not have a " "get_message_definition(s) method"
168161
raise ValueError(msg)

pyproject.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[tool.poetry]
2+
name = "pylint-plugin-utils"
3+
version = "0.8"
4+
readme = "README.md"
5+
description = "Utilities and helpers for writing Pylint plugins"
6+
repository = "https://github.com/PyCQA/pylint-plugin-utils"
7+
authors = ["Carl Crowder <[email protected]>"]
8+
license="GPLv2"
9+
keywords=["pylint","plugin","helpers"]
10+
packages = [
11+
{include = "pylint_plugin_utils/"}
12+
]
13+
include = [
14+
"LICENSE",
15+
"*.rst",
16+
"*.md"
17+
]
18+
19+
[tool.poetry.dependencies]
20+
python = ">=3.7,<4.0"
21+
pylint = ">=1.7"
22+
23+
[tool.poetry.group.dev.dependencies]
24+
pytest = "~6.2"
25+
pre-commit = "~2.16"
26+
pytest-cov = "~3.0"
27+
coveralls = "~3.3"
28+
tox = "^4.5.1"
29+
30+
[build-system]
31+
requires = ["poetry-core>=1.0.0"]
32+
build-backend = "poetry.core.masonry.api"
33+
34+
[tool.pytest.ini_options]
35+
python_files = ["tests.py","test_*.py","*_tests.py","tests/*.py"]
36+
37+
[tool.black]
38+
line-length = 120
39+
exclude = '''
40+
/(
41+
tests/
42+
)/
43+
'''
44+
45+
[tool.isort]
46+
multi_line_output = 3
47+
include_trailing_comma = true
48+
force_grid_wrap = 0
49+
use_parentheses = true
50+
line_length = 120

requirements_test.txt

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

requirements_test_min.txt

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

requirements_test_pre_commit.txt

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

setup.cfg

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

tests/test_linter_pickle.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ def test_linter_should_be_pickleable(linter):
1717
# Setup
1818
linter.register_checker(TypeChecker())
1919
augment_visit(linter, TypeChecker.visit_attribute, fake_augmentation_func)
20-
suppress_message(
21-
linter, TypeChecker.visit_attribute, "no-member", fake_suppress_func
22-
)
20+
suppress_message(linter, TypeChecker.visit_attribute, "no-member", fake_suppress_func)
2321

2422
# Act and Assert
25-
pickle.dumps(linter)
23+
try:
24+
pickle.dumps(linter)
25+
except TypeError:
26+
# this can happen for newer versions of pylint (>2.12) which now use dill for pickling
27+
import dill
28+
29+
# this import will fail for earlier versions which do not have dill as a dependency,
30+
# in which case this is an old version which also does not pickle
31+
dill.dumps(linter)

0 commit comments

Comments
 (0)