Skip to content

Commit 0d36a63

Browse files
authored
Improve packaging [PEP 517 + 621] (#7076)
* Use isolated build environments * Update release ci job to use build * Use new project metadata format * Cleanup MANIFEST.in * Remove setup.py
1 parent c74493b commit 0d36a63

File tree

9 files changed

+102
-98
lines changed

9 files changed

+102
-98
lines changed

.flake8

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

.github/workflows/release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ jobs:
2222
python-version: ${{ env.DEFAULT_PYTHON }}
2323
- name: Install requirements
2424
run: |
25-
python -m pip install -U pip twine wheel
26-
python -m pip install -U "setuptools>=56.0.0"
25+
# Remove dist, build, and pylint.egg-info
26+
# when building locally for testing!
27+
python -m pip install twine build
2728
- name: Build distributions
2829
run: |
29-
python setup.py sdist bdist_wheel
30+
python -m build
3031
- name: Upload to PyPI
3132
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
3233
env:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
hooks:
3131
- id: copyright-notice
3232
args: ["--notice=script/copyright.txt", "--enforce-all"]
33-
exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|setup.py|tests(/\w*)*data/
33+
exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|tests(/\w*)*data/
3434
types: [python]
3535
- repo: https://github.com/asottile/pyupgrade
3636
rev: v2.34.0

.pyenchant_pylint_custom_dict.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ deepcopy
7676
defframe
7777
defstmts
7878
deleter
79+
dependabot
7980
deque
8081
destructured
8182
destructuring

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ FROM python:3.10.0-alpine3.15
22

33
COPY ./ /tmp/build
44
WORKDIR /tmp/build
5-
RUN python setup.py install && rm -rf /tmp/build
5+
RUN python -m pip install . && rm -rf /tmp/build
66

77
ENTRYPOINT ["pylint"]

MANIFEST.in

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
1-
recursive-exclude pylint *.rst
2-
prune .github
3-
prune doc
4-
prune elisp
5-
prune examples
6-
prune tests
7-
prune script
8-
exclude .*
9-
exclude Dockerfile
10-
exclude README.rst
11-
exclude pylintrc
12-
exclude requirements_*.txt
13-
exclude tox.ini
1+
include README.rst

pyproject.toml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
[build-system]
2+
requires = ["setuptools~=62.6", "wheel~=0.37.1"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pylint"
7+
license = {text = "GPL-2.0-or-later"}
8+
description = "python code static checker"
9+
readme = "README.rst"
10+
authors = [
11+
{name = "Python Code Quality Authority", email = "code-quality@python.org"}
12+
]
13+
keywords = ["static code analysis", "linter", "python", "lint"]
14+
classifiers = [
15+
"Development Status :: 6 - Mature",
16+
"Environment :: Console",
17+
"Intended Audience :: Developers",
18+
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
19+
"Operating System :: OS Independent",
20+
"Programming Language :: Python",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3 :: Only",
23+
"Programming Language :: Python :: 3.7",
24+
"Programming Language :: Python :: 3.8",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: Implementation :: CPython",
28+
"Programming Language :: Python :: Implementation :: PyPy",
29+
"Topic :: Software Development :: Debuggers",
30+
"Topic :: Software Development :: Quality Assurance",
31+
"Topic :: Software Development :: Testing",
32+
]
33+
requires-python = ">=3.7.2"
34+
dependencies = [
35+
"dill>=0.2",
36+
"platformdirs>=2.2.0",
37+
# Also upgrade requirements_test_min.txt if you are bumping astroid.
38+
# Pinned to dev of next minor update to allow editable installs,
39+
# see https://github.com/PyCQA/astroid/issues/1341
40+
"astroid>=2.11.6,<=2.12.0-dev0",
41+
"isort>=4.2.5,<6",
42+
"mccabe>=0.6,<0.8",
43+
"tomli>=1.1.0;python_version<'3.11'",
44+
"tomlkit>=0.10.1",
45+
"colorama>=0.4.5;sys_platform=='win32'",
46+
"typing-extensions>=3.10.0;python_version<'3.10'",
47+
]
48+
dynamic = ["version"]
49+
50+
[project.optional-dependencies]
51+
testutils = ["gitpython>3"]
52+
spelling = ["pyenchant~=3.2"]
53+
54+
[project.urls]
55+
"Docs: User Guide" = "https://pylint.pycqa.org/en/latest/"
56+
"Source Code" = "https://github.com/PyCQA/pylint"
57+
"What's New" = "https://pylint.pycqa.org/en/latest/whatsnew/2/"
58+
"Bug Tracker" = "https://github.com/PyCQA/pylint/issues"
59+
"Discord Server" = "https://discord.com/invite/Egy6P8AMB5"
60+
"Docs: Contributer Guide" = "https://pylint.pycqa.org/en/latest/development_guide/contributor_guide/index.html"
61+
62+
[project.scripts]
63+
pylint = "pylint:run_pylint"
64+
pylint-config = "pylint:_run_pylint_config"
65+
epylint = "pylint:run_epylint"
66+
pyreverse = "pylint:run_pyreverse"
67+
symilar = "pylint:run_symilar"
68+
69+
[tool.setuptools]
70+
license-files = ["LICENSE", "CONTRIBUTORS.txt"] # Keep in sync with setup.cfg
71+
72+
[tool.setuptools.packages.find]
73+
include = ["pylint*"]
74+
75+
[tool.setuptools.package-data]
76+
pylint = ["testutils/testing_pylintrc"]
77+
78+
[tool.setuptools.dynamic]
79+
version = {attr = "pylint.__pkginfo__.__version__"}

setup.cfg

Lines changed: 15 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,12 @@
1+
# Setuptools v62.6 doesn't support editable installs with just 'pyproject.toml' (PEP 660).
2+
# Keep this file until it does!
3+
14
[metadata]
2-
name = pylint
3-
version = attr: pylint.__pkginfo__.__version__
4-
description = python code static checker
5-
long_description = file: README.rst
6-
long_description_content_type = text/x-rst
7-
author = Python Code Quality Authority
8-
author_email = code-quality@python.org
9-
license = GPL-2.0-or-later
5+
# wheel doesn't yet read license_files from pyproject.toml - tools.setuptools
6+
# Keep it here until it does!
107
license_files =
118
LICENSE
129
CONTRIBUTORS.txt
13-
classifiers =
14-
Development Status :: 6 - Mature
15-
Environment :: Console
16-
Intended Audience :: Developers
17-
License :: OSI Approved :: GNU General Public License v2 (GPLv2)
18-
Operating System :: OS Independent
19-
Programming Language :: Python
20-
Programming Language :: Python :: 3
21-
Programming Language :: Python :: 3 :: Only
22-
Programming Language :: Python :: 3.7
23-
Programming Language :: Python :: 3.8
24-
Programming Language :: Python :: 3.9
25-
Programming Language :: Python :: 3.10
26-
Programming Language :: Python :: Implementation :: CPython
27-
Programming Language :: Python :: Implementation :: PyPy
28-
Topic :: Software Development :: Debuggers
29-
Topic :: Software Development :: Quality Assurance
30-
Topic :: Software Development :: Testing
31-
keywords = static code analysis linter python lint
32-
project_urls =
33-
Docs: User Guide = https://pylint.pycqa.org/en/latest/
34-
Source Code = https://github.com/PyCQA/pylint
35-
What's New = https://pylint.pycqa.org/en/latest/whatsnew/2/
36-
Bug Tracker = https://github.com/PyCQA/pylint/issues
37-
Discord Server = https://discord.com/invite/Egy6P8AMB5
38-
Docs: Contributer Guide = https://pylint.pycqa.org/en/latest/development_guide/contributor_guide/index.html
39-
40-
[options]
41-
packages = find:
42-
install_requires =
43-
dill>=0.2
44-
platformdirs>=2.2.0
45-
# Also upgrade requirements_test_min.txt if you are bumping astroid.
46-
# Pinned to dev of next minor update to allow editable installs,
47-
# see https://github.com/PyCQA/astroid/issues/1341
48-
astroid>=2.11.6,<=2.12.0-dev0
49-
isort>=4.2.5,<6
50-
mccabe>=0.6,<0.8
51-
tomli>=1.1.0;python_version<"3.11"
52-
tomlkit>=0.10.1
53-
colorama>=0.4.5;sys_platform=="win32"
54-
typing-extensions>=3.10.0;python_version<"3.10"
55-
python_requires = >=3.7.2
56-
57-
[options.extras_require]
58-
testutils=gitpython>3
59-
spelling=pyenchant~=3.2
60-
61-
[options.packages.find]
62-
include =
63-
pylint*
64-
65-
[options.entry_points]
66-
console_scripts =
67-
pylint = pylint:run_pylint
68-
pylint-config = pylint:_run_pylint_config
69-
epylint = pylint:run_epylint
70-
pyreverse = pylint:run_pyreverse
71-
symilar = pylint:run_symilar
72-
73-
[options.package_data]
74-
pylint = testutils/testing_pylintrc
7510

7611
[aliases]
7712
test = pytest
@@ -93,6 +28,16 @@ known_third_party = platformdirs, astroid, sphinx, isort, pytest, mccabe, six, t
9328
skip_glob = tests/functional/**,tests/input/**,tests/extensions/data/**,tests/regrtest_data/**,tests/data/**,astroid/**,venv/**
9429
src_paths = pylint
9530

31+
[flake8]
32+
ignore =
33+
E203, W503, # Incompatible with black see https://github.com/ambv/black/issues/315
34+
E501, # Lot of lines too long right now
35+
max-line-length=88
36+
max-complexity=39
37+
# Required for flake8-typing-imports (v1.12.0)
38+
# The plugin doesn't yet read the value from pyproject.toml
39+
min_python_version = 3.7.2
40+
9641
[mypy]
9742
no_implicit_optional = True
9843
scripts_are_modules = True

setup.py

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

0 commit comments

Comments
 (0)