From 38cdc4276907da7d6e7887cb5c69c7f72ab66b35 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 17 Sep 2022 19:53:51 +0200 Subject: [PATCH] Migrate to pyproject.toml --- .flake8 | 3 +++ .github/workflows/main.yaml | 4 ++- .pre-commit-config.yaml | 6 ++--- pyproject.toml | 50 +++++++++++++++++++++++++++++++++++++ setup.cfg | 38 ---------------------------- setup.py | 4 --- 6 files changed, 59 insertions(+), 46 deletions(-) create mode 100644 .flake8 create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..0174b89 --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +ignore = E203,W503 +max-line-length = 88 diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a1128a6..8fe9ffa 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -33,8 +33,10 @@ jobs: - run: pip install . + - run: pip install pytest + - name: run tests - run: python setup.py test + run: pytest lint: name: pre-commit diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0db2628..fea5242 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: hooks: - id: black - - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.0.0 + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.10.1 hooks: - - id: setup-cfg-fmt + - id: validate-pyproject diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b5a11f3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,50 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "autoflake" +description = "Removes unused imports and unused variables" +license = {text = "MIT"} +classifiers = [ + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Software Development :: Quality Assurance", +] +keywords = ["clean", "fix", "automatic", "unused", "import"] +urls = {Homepage = "https://www.github.com/PyCQA/autoflake"} +requires-python = ">=3.7" +dependencies = [ + "pyflakes>=1.1.0", + "tomli>=2.0.1;python_version<'3.11'", +] +dynamic = ["version"] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.scripts] +autoflake = "autoflake:main" + +[tool.setuptools] +py-modules = ["autoflake"] +# test-suite = "test_autoflake" # Deprecated since setuptools v41.5.0 +license-files = ["LICENSE"] +include-package-data = false + +[tool.setuptools.packages] +find = {namespaces = false} + +[tool.setuptools.dynamic] +version = {attr = "autoflake.__version__"} + +[tool.distutils.bdist_wheel] +universal = 1 + +[tool.flake8] +ignore = "E203,W503" +max-line-length = "88" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 1a31da5..0000000 --- a/setup.cfg +++ /dev/null @@ -1,38 +0,0 @@ -[metadata] -name = autoflake -version = attr:autoflake.__version__ -description = Removes unused imports and unused variables -long_description = file: README.md -long_description_content_type = text/markdown -url = https://www.github.com/PyCQA/autoflake -license = MIT -license_file = LICENSE -classifiers = - Environment :: Console - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Topic :: Software Development :: Quality Assurance -kewords = clean, fix, automatic, unused, import - -[options] -packages = find: -py_modules = - autoflake -install_requires = - pyflakes>=1.1.0 - tomli>=2.0.1;python_version<'3.11' -python_requires = >=3.7 -test_suite = test_autoflake - -[options.entry_points] -console_scripts = - autoflake = autoflake:main - -[bdist_wheel] -universal = 1 - -[flake8] -ignore = E203,W503 -max-line-length = 88 diff --git a/setup.py b/setup.py deleted file mode 100755 index 61cc244..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python -import setuptools - -setuptools.setup()