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] #1670

Merged
merged 6 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,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 astroid.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
10 changes: 1 addition & 9 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
prune .github
prune doc
prune tests
exclude .*
exclude ChangeLog
exclude pylintrc
exclude README.rst
exclude requirements_*.txt
exclude tox.ini
include README.rst
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[build-system]
requires = ["setuptools~=62.6", "wheel~=0.37.1"]
build-backend = "setuptools.build_meta"

[project]
name = "astroid"
license = {text = "LGPL-2.1-or-later"}
description = "An abstract syntax tree for Python with inference support."
readme = "README.rst"
authors = [
{name = "Python Code Quality Authority", email = "code-quality@python.org"}
]
keywords = ["static code analysis", "python", "abstract syntax tree"]
classifiers = [
"Development Status :: 6 - Mature",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)",
"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",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we add 3.11 as well?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm nice catch, I think we forgot to add it in #1584

Suggested change
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we add 3.11 as well?

We don't support all 3.11 features yet. Especially support for TryStar is still missing. Tracking issue #1516
I should probably continue the work on #1389 soon. With that TryStar should be fairly strait forward.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should add the 3.11 metadata before supporting all 3.11 features, because we're supporting all the old features and if we don't do that, then there's no astroid at all for 3.11 which is a lot worse than having astroid without some 3.11 exclusive features.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should add the 3.11 metadata before supporting all 3.11 features, because we're supporting all the old features and if we don't do that, then there's no astroid at all for 3.11 which is a lot worse than having astroid without some 3.11 exclusive features.

We don't block anyone from installing astroid with Python 3.11.
However, the way I understand the classifier is "All of the features (or at least the major ones) for version x.xx are supported." That's why I would recommend to wait a bit longer before adding it.

Copy link
Member

Choose a reason for hiding this comment

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

We don't block anyone from installing astroid with Python 3.11.

Hmm right, my bad, pip is using install_require not the metadata.

"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
]
requires-python = ">=3.7.2"
dependencies = [
"lazy_object_proxy>=1.4.0",
"wrapt>=1.11,<2",
"typed-ast>=1.4.0,<2.0;implementation_name=='cpython' and python_version<'3.8'",
"typing-extensions>=3.10;python_version<'3.10'",
]
dynamic = ["version"]

[project.urls]
"Docs" = "https://pylint.pycqa.org/projects/astroid/en/latest/"
"Source Code" = "https://github.com/PyCQA/astroid"
"Bug tracker" = "https://github.com/PyCQA/astroid/issues"
"Discord server" = "https://discord.gg/Egy6P8AMB5"

[tool.setuptools]
license-files = ["LICENSE", "CONTRIBUTORS.txt"] # Keep in sync with setup.cfg

[tool.setuptools.packages.find]
include = ["astroid*"]

[tool.setuptools.dynamic]
version = {attr = "astroid.__pkginfo__.__version__"}
57 changes: 13 additions & 44 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,51 +1,12 @@
# Setuptools v62.6 doesn't support editable installs with just 'pyproject.toml' (PEP 660).
# Keep this file until it does!

[metadata]
name = astroid
description = An abstract syntax tree for Python with inference support.
version = attr: astroid.__pkginfo__.__version__
long_description = file: README.rst
long_description_content_type = text/x-rst
url = https://github.com/PyCQA/astroid
author = Python Code Quality Authority
author_email = code-quality@python.org
license = LGPL-2.1-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 Lesser General Public License v2 (LGPLv2)
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 :: Libraries :: Python Modules
Topic :: Software Development :: Quality Assurance
Topic :: Software Development :: Testing
keywords = static code analysis,python,abstract syntax tree
project_urls =
Bug tracker = https://github.com/PyCQA/astroid/issues
Discord server = https://discord.gg/Egy6P8AMB5

[options]
packages = find:
install_requires =
lazy_object_proxy>=1.4.0
wrapt>=1.11,<2
typed-ast>=1.4.0,<2.0;implementation_name=="cpython" and python_version<"3.8"
typing-extensions>=3.10;python_version<"3.10"
python_requires = >=3.7.2

[options.packages.find]
include =
astroid*

[aliases]
test = pytest
Expand All @@ -63,6 +24,14 @@ known_first_party = astroid
include_trailing_comma = True
skip_glob = tests/testdata

[flake8]
cdce8p marked this conversation as resolved.
Show resolved Hide resolved
extend-ignore = E203,E266,E501,C901,F401
max-complexity = 20
select = B,C,E,F,W,T4,B9
# 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]
scripts_are_modules = True
no_implicit_optional = True
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Keep file until dependabot issue is resolved
# https://github.com/dependabot/dependabot-core/issues/4483

from setuptools import setup

setup()