diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000000..9074cb33d4 --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +exclude = build, ci-helpers +ignore = diff --git a/.github/workflows/codespell-private.yml b/.github/workflows/codespell-private.yml index ff73f2560d..0d773307b6 100644 --- a/.github/workflows/codespell-private.yml +++ b/.github/workflows/codespell-private.yml @@ -35,7 +35,7 @@ jobs: pip install codecov chardet "setuptools!=47.2.0" docutils pip install aspell-python-py3 pip install -e ".[dev]" # install the codespell dev packages - - run: python setup.py install + - run: pip install . - run: codespell --help - run: make check - run: codespell --check-filenames --skip="./.git/*,*.pyc,./codespell_lib/tests/test_basic.py,./codespell_lib/data/*,./example/code.c,./build/lib/codespell_lib/tests/test_basic.py,./build/lib/codespell_lib/data/*,README.rst,*.egg-info/*" diff --git a/MANIFEST.in b/MANIFEST.in index e467a2b242..f3042ac65b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,7 @@ include COPYING include bin/codespell exclude *.yml *.yaml exclude .coveragerc +exclude .flake8 exclude example example/* snap snap/* tools tools/* exclude Makefile exclude codespell.1.include diff --git a/Makefile b/Makefile index c297fb0d46..a3bb219f70 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,11 @@ SORT_ARGS := -f -b DICTIONARIES := codespell_lib/data/dictionary*.txt -PHONY := all check check-dictionaries sort-dictionaries trim-dictionaries check-dictionary sort-dictionary trim-dictionary check-manifest check-distutils flake8 pytest pypi clean +PHONY := all check check-dictionaries sort-dictionaries trim-dictionaries check-dictionary sort-dictionary trim-dictionary check-manifest check-pyproject flake8 pytest pypi clean all: check-dictionaries codespell.1 -check: check-dictionaries check-manifest check-distutils flake8 pytest +check: check-dictionaries check-manifest check-pyproject flake8 pytest check-dictionary: check-dictionaries sort-dictionary: sort-dictionaries @@ -47,8 +47,8 @@ trim-dictionaries: check-manifest: check-manifest -check-distutils: - python setup.py check --restructuredtext --strict +check-pyproject: + validate-pyproject flake8: flake8 @@ -57,7 +57,7 @@ pytest: pytest codespell_lib pypi: - python setup.py sdist register upload + sdist register upload clean: rm -rf codespell.1 diff --git a/appveyor.yml b/appveyor.yml index 79740cac8c..bf7e8e4c2d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,9 +13,10 @@ cache: install: - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + - '%PYTHON%\python.exe -m pip install --upgrade pip' - "pip install codecov chardet setuptools" - "pip install -e \".[dev]\"" # install the codespell dev packages - - "python setup.py develop" + - "pip install ." build: false # Not a C# project, build stuff at the test step instead. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..3b9502fbd5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,67 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "codespell" +dynamic = ["version"] +maintainers = [{name = "Lucas De Marchi", email = "lucas.de.marchi@gmail.com"}] +license = {text = "GPL v2"} +description = "Codespell" +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved", + "Programming Language :: Python", + "Topic :: Software Development", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Operating System :: Unix", + "Operating System :: MacOS", +] +requires-python = ">=3.7" + +[project.readme] +file = "README.rst" +content-type = "text/x-rst" + +[project.urls] +Homepage = "https://github.com/codespell-project/codespell/" +Download = "https://github.com/codespell-project/codespell/releases" + +[project.optional-dependencies] +dev = [ + "check-manifest", + "flake8", + "pytest", + "pytest-cov", + "pytest-dependency", + "tomli", + "validate-pyproject", +] +hard-encoding-detection = ["chardet"] +toml = ["tomli"] + +[project.scripts] +codespell = "codespell_lib:_script_main" + +[tool.setuptools] +packages = [ + "codespell_lib", + "codespell_lib.tests", + "codespell_lib.data", +] +zip-safe = false +include-package-data = true +platforms = ["any"] + +[tool.setuptools.dynamic] +version = {attr = "codespell_lib.__version__"} + +[tool.setuptools.package-data] +codespell_lib = [ + "data/dictionary*.txt", + "data/linux-kernel.exclude", +] + +[tool.pytest.ini_options] +addopts = "--cov=codespell_lib -rs --cov-report= --tb=short" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index fe05ee4f73..0000000000 --- a/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[tool:pytest] -addopts = --cov=codespell_lib -rs --cov-report= --tb=short - -[flake8] -exclude = build, ci-helpers -ignore = diff --git a/setup.py b/setup.py deleted file mode 100755 index 1971123436..0000000000 --- a/setup.py +++ /dev/null @@ -1,69 +0,0 @@ -#! /usr/bin/env python - -# adapted from mne-python - -import os - -from setuptools import setup - -from codespell_lib import __version__ - -DISTNAME = 'codespell' -DESCRIPTION = """Codespell""" -MAINTAINER = 'Lucas De Marchi' -MAINTAINER_EMAIL = 'lucas.de.marchi@gmail.com' -URL = 'https://github.com/codespell-project/codespell/' -LICENSE = 'GPL v2' -DOWNLOAD_URL = 'https://github.com/codespell-project/codespell/' -with open('README.rst', 'r') as f: - LONG_DESCRIPTION = f.read() - -if __name__ == "__main__": - if os.path.exists('MANIFEST'): - os.remove('MANIFEST') - - setup(name=DISTNAME, - maintainer=MAINTAINER, - include_package_data=True, - maintainer_email=MAINTAINER_EMAIL, - description=DESCRIPTION, - license=LICENSE, - url=URL, - version=__version__, - download_url=DOWNLOAD_URL, - long_description=LONG_DESCRIPTION, - long_description_content_type='text/x-rst', - zip_safe=False, - classifiers=['Intended Audience :: Developers', - 'License :: OSI Approved', - 'Programming Language :: Python', - 'Topic :: Software Development', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: POSIX', - 'Operating System :: Unix', - 'Operating System :: MacOS'], - platforms='any', - python_requires='>=3.7', - packages=[ - 'codespell_lib', - 'codespell_lib.tests', - 'codespell_lib.data', - ], - package_data={'codespell_lib': [ - os.path.join('data', 'dictionary*.txt'), - os.path.join('data', 'linux-kernel.exclude'), - ]}, - entry_points={ - 'console_scripts': [ - 'codespell = codespell_lib:_script_main' - ], - }, - # TODO: toml will need to be updated when 3.11 comes out as it's a - # CPython module there - extras_require={ - "dev": ["check-manifest", "flake8", "pytest", "pytest-cov", - "pytest-dependency", "tomli"], - "hard-encoding-detection": ["chardet"], - "toml": ["tomli"], - } - )