From 2842e4fda52e6c5fc69b6c6ef55a79cea002d998 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 27 Jun 2022 14:12:58 +0200 Subject: [PATCH 01/13] Use isolated build environments * PEP 517 * Include readme in sdist to be able to build wheel from it * Update release ci job to use build --- .github/workflows/release.yml | 7 ++++--- MANIFEST.in | 2 +- pyproject.toml | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8834896711..7e6c457a91 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,11 +22,12 @@ jobs: python-version: ${{ env.DEFAULT_PYTHON }} - name: Install requirements run: | - python -m pip install -U pip twine wheel - python -m pip install -U "setuptools>=56.0.0" + # Remove dist, build, and pylint.egg-info + # when building locally for testing! + python -m pip install twine build - name: Build distributions run: | - python setup.py sdist bdist_wheel + python -m build - name: Upload to PyPI if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags') env: diff --git a/MANIFEST.in b/MANIFEST.in index d354668948..6b0c7e3c2a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ +include README.rst recursive-exclude pylint *.rst prune .github prune doc @@ -7,7 +8,6 @@ prune tests prune script exclude .* exclude Dockerfile -exclude README.rst exclude pylintrc exclude requirements_*.txt exclude tox.ini diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..ba30c39f16 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools~=62.6", "wheel~=0.37.1"] +build-backend = "setuptools.build_meta" From 74ae6dd55505bd1a46ed84b057ac6c74839bd700 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 27 Jun 2022 15:10:00 +0200 Subject: [PATCH 02/13] Use new project metadata format [PEP 621] --- pyproject.toml | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 74 +++--------------------------------------------- setup.py | 3 -- 3 files changed, 80 insertions(+), 73 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index ba30c39f16..5b37687ede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,79 @@ [build-system] requires = ["setuptools~=62.6", "wheel~=0.37.1"] build-backend = "setuptools.build_meta" + +[project] +name = "pylint" +license = {text = "GPL-2.0-or-later"} +description = "python code static checker" +readme = "README.rst" +authors = [ + {name = "Python Code Quality Authority", email = "code-quality@python.org"} +] +keywords = ["static", "code", "analysis", "linter", "python", "lint"] +classifiers = [ + "Development Status :: 6 - Mature", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development :: Debuggers", + "Topic :: Software Development :: Quality Assurance", + "Topic :: Software Development :: Testing", +] +requires-python = ">=3.7.2" +dependencies = [ + "dill>=0.2", + "platformdirs>=2.2.0", + # Also upgrade requirements_test_min.txt if you are bumping astroid. + # Pinned to dev of next minor update to allow editable installs, + # see https://github.com/PyCQA/astroid/issues/1341 + "astroid>=2.11.6,<=2.12.0-dev0", + "isort>=4.2.5,<6", + "mccabe>=0.6,<0.8", + "tomli>=1.1.0;python_version<'3.11'", + "tomlkit>=0.10.1", + "colorama>=0.4.5;sys_platform=='win32'", + "typing-extensions>=3.10.0;python_version<'3.10'", +] +dynamic = ["version"] + +[project.optional-dependencies] +testutils = ["gitpython>3"] +spelling = ["pyenchant~=3.2"] + +[project.urls] +"Docs: User Guide" = "https://pylint.pycqa.org/en/latest/" +"Source Code" = "https://github.com/PyCQA/pylint" +"What's New" = "https://pylint.pycqa.org/en/latest/whatsnew/2/" +"Bug Tracker" = "https://github.com/PyCQA/pylint/issues" +"Discord Server" = "https://discord.com/invite/Egy6P8AMB5" +"Docs: Contributer Guide" = "https://pylint.pycqa.org/en/latest/development_guide/contributor_guide/index.html" + +[project.scripts] +pylint = "pylint:run_pylint" +pylint-config = "pylint:_run_pylint_config" +epylint = "pylint:run_epylint" +pyreverse = "pylint:run_pyreverse" +symilar = "pylint:run_symilar" + +[tool.setuptools] +license-files = ["LICENSE", "CONTRIBUTORS.txt"] # Keep in sync with setup.cfg + +[tool.setuptools.packages.find] +include = ["pylint*"] + +[tool.setuptools.package-data] +pylint = ["testutils/testing_pylintrc"] + +[tool.setuptools.dynamic] +version = {attr = "pylint.__pkginfo__.__version__"} diff --git a/setup.cfg b/setup.cfg index e2b157d44e..556af2be75 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,77 +1,11 @@ +# Setuptools v62.6 doesn't support editable installs with just 'pyproject.toml' (PEP 660). +# Keep this file until it does! [metadata] -name = pylint -version = attr: pylint.__pkginfo__.__version__ -description = python code static checker -long_description = file: README.rst -long_description_content_type = text/x-rst -author = Python Code Quality Authority -author_email = code-quality@python.org -license = GPL-2.0-or-later +# wheel doesn't yet read license_files from pyproject.toml - tools.setuptools +# Keep it here until it does! license_files = LICENSE CONTRIBUTORS.txt -classifiers = - Development Status :: 6 - Mature - Environment :: Console - Intended Audience :: Developers - License :: OSI Approved :: GNU General Public License v2 (GPLv2) - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - Topic :: Software Development :: Debuggers - Topic :: Software Development :: Quality Assurance - Topic :: Software Development :: Testing -keywords = static code analysis linter python lint -project_urls = - Docs: User Guide = https://pylint.pycqa.org/en/latest/ - Source Code = https://github.com/PyCQA/pylint - What's New = https://pylint.pycqa.org/en/latest/whatsnew/2/ - Bug Tracker = https://github.com/PyCQA/pylint/issues - Discord Server = https://discord.com/invite/Egy6P8AMB5 - Docs: Contributer Guide = https://pylint.pycqa.org/en/latest/development_guide/contributor_guide/index.html - -[options] -packages = find: -install_requires = - dill>=0.2 - platformdirs>=2.2.0 - # Also upgrade requirements_test_min.txt if you are bumping astroid. - # Pinned to dev of next minor update to allow editable installs, - # see https://github.com/PyCQA/astroid/issues/1341 - astroid>=2.11.6,<=2.12.0-dev0 - isort>=4.2.5,<6 - mccabe>=0.6,<0.8 - tomli>=1.1.0;python_version<"3.11" - tomlkit>=0.10.1 - colorama>=0.4.5;sys_platform=="win32" - typing-extensions>=3.10.0;python_version<"3.10" -python_requires = >=3.7.2 - -[options.extras_require] -testutils=gitpython>3 -spelling=pyenchant~=3.2 - -[options.packages.find] -include = - pylint* - -[options.entry_points] -console_scripts = - pylint = pylint:run_pylint - pylint-config = pylint:_run_pylint_config - epylint = pylint:run_epylint - pyreverse = pylint:run_pyreverse - symilar = pylint:run_symilar - -[options.package_data] -pylint = testutils/testing_pylintrc [aliases] test = pytest diff --git a/setup.py b/setup.py deleted file mode 100644 index 606849326a..0000000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() From abd91799796bf8833a1eb9eaf57a907a250d5678 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 27 Jun 2022 15:15:39 +0200 Subject: [PATCH 03/13] Cleanup unused MANIFEST entries --- MANIFEST.in | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 6b0c7e3c2a..9561fb1061 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,13 +1 @@ include README.rst -recursive-exclude pylint *.rst -prune .github -prune doc -prune elisp -prune examples -prune tests -prune script -exclude .* -exclude Dockerfile -exclude pylintrc -exclude requirements_*.txt -exclude tox.ini From c19677252e7adfbe9b4239cc4299e1051a5cacca Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 27 Jun 2022 15:24:52 +0200 Subject: [PATCH 04/13] Update misc files --- .pre-commit-config.yaml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3e864bf527..e0a44baad6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: hooks: - id: copyright-notice args: ["--notice=script/copyright.txt", "--enforce-all"] - exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|setup.py|tests(/\w*)*data/ + exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|tests(/\w*)*data/ types: [python] - repo: https://github.com/asottile/pyupgrade rev: v2.34.0 diff --git a/Dockerfile b/Dockerfile index 2667145da8..7bde0a2921 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,6 @@ FROM python:3.10.0-alpine3.15 COPY ./ /tmp/build WORKDIR /tmp/build -RUN python setup.py install && rm -rf /tmp/build +RUN python -m pip install . && rm -rf /tmp/build ENTRYPOINT ["pylint"] From 7798d91a710c5b9490441ef4a24d27544dfd283a Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 27 Jun 2022 17:45:51 +0200 Subject: [PATCH 05/13] Remove MANIFEST.in --- MANIFEST.in | 1 - 1 file changed, 1 deletion(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 9561fb1061..0000000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include README.rst From 47b8c9071f2b9c87c42ebed4253422fb642e04a2 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 27 Jun 2022 17:52:17 +0200 Subject: [PATCH 06/13] Fix flake8 --- setup.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.cfg b/setup.cfg index 556af2be75..a315466f64 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,6 +27,11 @@ known_third_party = platformdirs, astroid, sphinx, isort, pytest, mccabe, six, t skip_glob = tests/functional/**,tests/input/**,tests/extensions/data/**,tests/regrtest_data/**,tests/data/**,astroid/**,venv/** src_paths = pylint +[flake8] +# Required for flake8-typing-imports (v1.12.0) +# The plugin doesn't yet read the value from pyproject.toml +min_python_version = 3.7.2 + [mypy] no_implicit_optional = True scripts_are_modules = True From 366d05b222b7215ef9a5a4d19f37a989725065f2 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 27 Jun 2022 18:19:54 +0200 Subject: [PATCH 07/13] Fix keywords --- pyproject.toml | 2 +- setup.cfg | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5b37687ede..c2f041cf30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.rst" authors = [ {name = "Python Code Quality Authority", email = "code-quality@python.org"} ] -keywords = ["static", "code", "analysis", "linter", "python", "lint"] +keywords = ["static code analysis", "linter", "python", "lint"] classifiers = [ "Development Status :: 6 - Mature", "Environment :: Console", diff --git a/setup.cfg b/setup.cfg index a315466f64..c2209c07e6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,6 @@ # Setuptools v62.6 doesn't support editable installs with just 'pyproject.toml' (PEP 660). # Keep this file until it does! + [metadata] # wheel doesn't yet read license_files from pyproject.toml - tools.setuptools # Keep it here until it does! From 3edc9f02699e029becbaa49f04287cee87b5c68d Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 28 Jun 2022 01:34:01 +0200 Subject: [PATCH 08/13] Revert "Remove MANIFEST.in" This reverts commit 7798d91a710c5b9490441ef4a24d27544dfd283a. --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000..9561fb1061 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include README.rst From ff074bfacd9bea7da2cb03ec984f1d5fab12a8a6 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 28 Jun 2022 01:36:41 +0200 Subject: [PATCH 09/13] Keep setup.py --- .pre-commit-config.yaml | 2 +- setup.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 setup.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0a44baad6..3e864bf527 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: hooks: - id: copyright-notice args: ["--notice=script/copyright.txt", "--enforce-all"] - exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|tests(/\w*)*data/ + exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|setup.py|tests(/\w*)*data/ types: [python] - repo: https://github.com/asottile/pyupgrade rev: v2.34.0 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000..917c2a0b2a --- /dev/null +++ b/setup.py @@ -0,0 +1,6 @@ +# Keep file until dependabot issue is resolved +# https://github.com/dependabot/dependabot-core/issues/4483 + +from setuptools import setup + +setup() From b089d4ab72e48af74a1649ef41d24bccdb163e6f Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 28 Jun 2022 01:53:00 +0200 Subject: [PATCH 10/13] Add dependabot to custom dictionary --- .pyenchant_pylint_custom_dict.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.pyenchant_pylint_custom_dict.txt b/.pyenchant_pylint_custom_dict.txt index 825ffe1f8c..ec4d4927bc 100644 --- a/.pyenchant_pylint_custom_dict.txt +++ b/.pyenchant_pylint_custom_dict.txt @@ -76,6 +76,7 @@ deepcopy defframe defstmts deleter +dependabot deque destructured destructuring From e047d4713a6397dc277ee6d8884c011b14940f9f Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 28 Jun 2022 13:41:18 +0200 Subject: [PATCH 11/13] Move remaining flake8 config to setup.cfg --- .flake8 | 7 ------- setup.cfg | 5 +++++ 2 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 9a701d7f09..0000000000 --- a/.flake8 +++ /dev/null @@ -1,7 +0,0 @@ -[flake8] -ignore = - E203, W503, # Incompatible with black see https://github.com/ambv/black/issues/315 - E501, # Lot of lines too long right now - -max-line-length=88 -max-complexity=39 diff --git a/setup.cfg b/setup.cfg index c2209c07e6..2c13527cba 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,6 +29,11 @@ skip_glob = tests/functional/**,tests/input/**,tests/extensions/data/**,tests/re src_paths = pylint [flake8] +ignore = + E203, W503, # Incompatible with black see https://github.com/ambv/black/issues/315 + E501, # Lot of lines too long right now +max-line-length=88 +max-complexity=39 # Required for flake8-typing-imports (v1.12.0) # The plugin doesn't yet read the value from pyproject.toml min_python_version = 3.7.2 From e86033888dcf5362792d353af62948f9b5fd839e Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 28 Jun 2022 15:20:24 +0200 Subject: [PATCH 12/13] Remove setup.py --- setup.py | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 917c2a0b2a..0000000000 --- a/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -# Keep file until dependabot issue is resolved -# https://github.com/dependabot/dependabot-core/issues/4483 - -from setuptools import setup - -setup() From d380aca5d3495a0f092163e194571857049e91b1 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 28 Jun 2022 15:24:51 +0200 Subject: [PATCH 13/13] Update pre-commit config --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3e864bf527..e0a44baad6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: hooks: - id: copyright-notice args: ["--notice=script/copyright.txt", "--enforce-all"] - exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|setup.py|tests(/\w*)*data/ + exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|tests(/\w*)*data/ types: [python] - repo: https://github.com/asottile/pyupgrade rev: v2.34.0