Skip to content

PEP 621: Migrate from setup.{py, cfg} to pyproject.toml #315

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

Merged
merged 2 commits into from
Mar 7, 2025
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
17 changes: 8 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ jobs:
build-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Python 3.8 is the last non-EOL version. Also adapt tox.ini
python-version: ['3.8', 'pypy3.10', '3.12']
os: [ubuntu-latest, windows-latest]
fail-fast: false
matrix:
# Python 3.8 is EOL. Also adapt tox.ini
python-version: ['3.8', 'pypy3.11', '3.x']
# macOS on ARM, Ubuntu on x86, Windows on X86
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -32,13 +33,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
cache-dependency-path: '**/test-requirements'
cache-dependency-path: 'pyproject.toml'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
python -m pip install 'tox-gh-actions<4.0.0'
python -m pip install --editable .[dev]
- name: Test with tox
run: tox
run: tox -e py
2 changes: 1 addition & 1 deletion cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import codecs
import collections
import copy
import getopt
import getopt # pylint: disable=deprecated-module
import glob
import itertools
import math # for log
Expand Down
5 changes: 0 additions & 5 deletions dev-requirements

This file was deleted.

77 changes: 74 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,77 @@
[build-system]
build-backend = "setuptools.build_meta:__legacy__"
requires = [
build-backend = "setuptools.build_meta"
requires = [ "setuptools>=61.2" ]

[project]
name = "cpplint"
version = "2.0.0"
description = "Automated checker to ensure C++ files follow Google's style guide"
readme = "README.rst"
keywords = [ "c++", "lint", "python" ]
license = { text = "BSD-3-Clause" }
maintainers = [ { name = "cpplint Developers" } ]
requires-python = ">=3.8"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: End Users/Desktop",
"License :: Freely Distributable",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: C++",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Quality Assurance",
]
dependencies = [ ]

optional-dependencies.dev = [
"flake8>=4.0.1",
"parameterized",
"pylint>=2.11",
"pytest",
"pytest-cov",
"pytest-timeout",
"setuptools",
"wheel",
"testfixtures",
"tox<5",
]
optional-dependencies.test = [
"parameterized",
"pytest",
"pytest-cov",
"pytest-timeout",
"testfixtures",
"tox<5",
]
optional-dependencies.testing = [
"parameterized",
"pytest",
"pytest-cov",
"pytest-timeout",
"testfixtures",
"tox<5",
]
Comment on lines +44 to 59
Copy link
Member

Choose a reason for hiding this comment

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

Rebasing rn, is there a reason the text extra was duplicated lol

Copy link
Member Author

@cclauss cclauss Mar 7, 2025

Choose a reason for hiding this comment

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

.test, .testing, and .dev all existed in setup.py so I replicated them in pyproject.toml (plus requirements files) to be sure I did not break anything.

Once we merge the open pre-commit PRs the only tools we will need in .dev will be pytest-related. At that point, we can drop .test and .testing and just have dev.

The other issue is that the version is hard coded in both pyproject.toml and in Python code. That should be fixed by making version dynamic in pyproject.toml and read out of the Python code.

urls.Download = "https://github.com/cpplint/cpplint"
urls.Homepage = "https://github.com/cpplint/cpplint"
scripts.cpplint = "cpplint:main"

[tool.setuptools]
py-modules = [ "cpplint" ]
include-package-data = false

[tool.pytest.ini_options]
python_files = [ "*test.py" ]
testpaths = [ "." ]
required_plugins = [ "pytest-cov", "pytest-timeout" ]
timeout = 60
# fail if coverage is under 90%
addopts = "--color=yes --cov-fail-under=90 --cov=cpplint"

[tool.aliases]
test = "pytest"
10 changes: 0 additions & 10 deletions setup.cfg

This file was deleted.

48 changes: 0 additions & 48 deletions setup.py

This file was deleted.

8 changes: 0 additions & 8 deletions test-requirements

This file was deleted.

11 changes: 1 addition & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
[tox]
envlist = py38, py39, py3.10, py311, py312, pypy3
envlist = py38, py39, py3.10, py311, py312, py313, pypy3
skip_missing_interpreters = true

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
pypy3.10: pypy3

[testenv]
extras = dev

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy