diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 947b7f0..599fe90 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,19 +3,12 @@ repos: rev: v4.3.0 hooks: - id: trailing-whitespace - exclude: \.output - id: end-of-file-fixer - exclude: \.(cp?p?$|output) - id: check-docstring-first - id: check-added-large-files - id: check-yaml - - id: debug-statements + - id: check-toml - id: requirements-txt-fixer - - repo: https://github.com/asottile/reorder_python_imports - rev: v3.7.0 - hooks: - - id: reorder-python-imports - language_version: python3 - repo: https://github.com/asottile/pyupgrade rev: v2.36.0 hooks: diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..feac611 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,54 @@ +[build-system] +requires = ["setuptools>=45", "setuptools-scm", "clang-tools>=0.2.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "cpp_linter_hooks" +description = "Automatically check c/c++ with clang-format and clang-tidy" +readme = "README.md" +keywords = ["clang", "clang-format", "clang-tidy", "pre-commit", "pre-commit-hooks"] +license = {text = "MIT License"} +authors = [ + { name = "Peter Shen", email = "xianpeng.shen@gmail.com" }, +] +classifiers = [ + # https://pypi.org/pypi?%3Aaction=list_classifiers + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Intended Audience :: Information Technology", + "Natural Language :: English", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS", + "Programming Language :: Python :: 3", + "Topic :: Software Development :: Build Tools", +] +dynamic = ["version"] + +[project.scripts] +clang-format-hook = "cpp_linter_hooks.clang_format:main" +clang-tidy-hook = "cpp_linter_hooks.clang_tidy:main" + +[project.urls] +source = "https://github.com/cpp-linter/cpp-linter-hooks" +tracker = "https://github.com/cpp-linter/cpp-linter-hooks/issues" + +# ... other project metadata fields as specified in: +# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ + +[tool.setuptools] +zip-safe = false +packages = ["cpp_linter_hooks"] + +[tool.setuptools_scm] +# It would be nice to include the commit hash in the version, but that +# can't be done in a PEP 440-compatible way. +version_scheme= "no-guess-dev" +# Test PyPI does not support local versions. +local_scheme = "no-local-version" +fallback_version = "0.0.0" + +[tool.mypy] +show_error_codes = true +show_column_numbers = true diff --git a/setup.py b/setup.py index 0cf2fde..b8181a8 100644 --- a/setup.py +++ b/setup.py @@ -1,21 +1,10 @@ -from setuptools import find_packages -from setuptools import setup +#!/usr/bin/env python +"""Info used for installing the cpp-linter-hooks package. +Since using setup.py is no longer std convention, +all install information is located in pyproject.toml +""" -setup( - name='cpp_linter_hooks', - description='Automatically check c/c++ with clang-format and clang-tidy', - url='https://github.com/cpp-linter/cpp-linter-hooks', - version='0.2.1', - author="Peter Shen", - author_email="xianpeng.shen@gmail.com", - license="MIT", - keywords="clang clang-tidy clang-format pre-commit pre-commit-hooks", - packages=find_packages(), - install_requires=['clang-tools>=0.2.2'], - entry_points={ - "console_scripts": [ - "clang-format-hook=cpp_linter_hooks.clang_format:main", - "clang-tidy-hook=cpp_linter_hooks.clang_tidy:main", - ] - }, -) +import setuptools + + +setuptools.setup()