Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve packaging [PEP 517 + 621] #7076

Merged
merged 13 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
13 changes: 0 additions & 13 deletions MANIFEST.in

This file was deleted.

79 changes: 79 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +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__"}
80 changes: 10 additions & 70 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,77 +1,12 @@
# 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
Expand All @@ -93,6 +28,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]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this go in .flake8?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it the other way round and move the whole flake8 config into setup.cfg. In the past, we have also removed .isort. At some point we can move most / all of these configs into pyproject.toml.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas Jun 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strong agree. I don't think .flake8 support pyproject.toml right now though . But there's other tool we could move already, tox and black probably.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strong agree. I don't think .flake8 support pyproject.toml right now though . But there's other tool we could move already, tox and black probably.

I would recommend to keep tox (and pylint) separate. Both have quite complex configurations. It's much easier to have them in their individual files. We could however move isort, pytest, and mypy.

# 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
Expand Down
3 changes: 0 additions & 3 deletions setup.py

This file was deleted.