diff --git a/README.rst b/README.rst index 22960ef..17029b0 100644 --- a/README.rst +++ b/README.rst @@ -175,6 +175,7 @@ Version History ======= ============ =========================================================== Version Release date Changes ------- ------------ ----------------------------------------------------------- +v0.3.4 2022-11-17 - Replaces ``setup.py`` with ``pyproject.toml`` for build. v0.3.3 2022-05-16 - Cope with line-length as string in pyproject.toml config. v0.3.2 2022-02-25 - Use ``tomli`` library to match black, contribution from `Brian Helba `_. @@ -223,10 +224,15 @@ Developers This plugin is on GitHub at https://github.com/peterjc/flake8-black +Developers may install the plugin from the git repository with optional build +dependencies:: + + $ pip install -e .[develop] + To make a new release once tested locally and online:: $ git tag vX.Y.Z - $ python setup.py sdist --formats=gztar && python setup.py bdist_wheel + $ python -m build $ git push origin master --tags $ twine upload dist/flake8?black-X.Y.Z* diff --git a/flake8_black.py b/flake8_black.py index aaf762c..8d0b1d2 100644 --- a/flake8_black.py +++ b/flake8_black.py @@ -14,7 +14,7 @@ from flake8 import LOG -__version__ = "0.3.3" +__version__ = "0.3.4" black_prefix = "BLK" @@ -223,7 +223,7 @@ def run(self): except BadBlackConfig as err: msg = "997 Invalid TOML file: %s" % err except Exception as err: - msg = "999 Unexpected exception: %s" % err + msg = "999 Unexpected exception: %r" % err else: assert ( new_code != source diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ca698cb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,49 @@ +[build-system] +requires = ['pip>=21.3', 'setuptools>=61', 'wheel'] +build-backend = 'setuptools.build_meta' + +[project] +name = 'flake8-black' +description = 'flake8 plugin to call black as a code style validator' +keywords = ['black', 'formatting', 'style', 'flake8'] +license = {text = 'MIT'} +readme = 'README.rst' +authors = [ + {name = 'Peter J. A. Cock'} +] +maintainers = [ + {name = 'Peter J. A. Cock', email = 'p.j.a.cock@googlemail.com'} +] +classifiers = [ + 'Intended Audience :: Developers', + 'Framework :: Flake8', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Software Development :: Quality Assurance', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3 :: Only' +] +requires-python = '>=3.7' +dependencies = [ + 'flake8>=3', + 'black>=22.1.0', + 'tomli', +] +dynamic = ['version'] +[project.entry-points] +'flake8.extension' = {RST = 'flake8_black:BlackStyleChecker'} +[project.optional-dependencies] +develop = ['build', 'twine'] +[project.urls] +Homepage = 'https://github.com/peterjc/flake8-black' +'Source Code' = 'https://github.com/peterjc/flake8-black/' +'Bug Tracker' = 'https://github.com/peterjc/flake8-black/issues' +Documentation = 'https://github.com/peterjc/flake8-black/blob/master/README.rst' + +[tool.setuptools] +py-modules = ['flake8_black'] +zip-safe = true +[tool.setuptools.dynamic] +version = {attr = 'flake8_black.__version__'} diff --git a/setup.py b/setup.py deleted file mode 100644 index cf38ed2..0000000 --- a/setup.py +++ /dev/null @@ -1,47 +0,0 @@ -"""Setup file for building/installing flake8-black.""" - -from __future__ import with_statement - -from setuptools import setup - - -def get_version(fname="flake8_black.py"): - """Parse our source code to get the current version number.""" - with open(fname) as f: - for line in f: - if line.startswith("__version__"): - return eval(line.split("=")[-1]) - - -setup( - name="flake8-black", - version=get_version(), - description="flake8 plugin to call black as a code style validator", - long_description=open("README.rst").read(), - license="MIT", - author="Peter J. A. Cock", - author_email="p.j.a.cock@googlemail.com", - url="https://github.com/peterjc/flake8-black", - project_urls={ - "Documentation": ( - "https://github.com/peterjc/flake8-black/blob/master/README.rst" - ), - "Source": "https://github.com/peterjc/flake8-black/", - "Tracker": "https://github.com/peterjc/flake8-black/issues", - }, - classifiers=[ - "Intended Audience :: Developers", - "Framework :: Flake8", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Operating System :: OS Independent", - "License :: OSI Approved :: MIT License", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Software Development :: Quality Assurance", - ], - keywords="PEP8", - py_modules=["flake8_black"], - python_requires=">=3.7", - install_requires=["flake8 >= 3.0.0", "black >= 22.1.0", "tomli"], - entry_points={"flake8.extension": ["BLK = flake8_black:BlackStyleChecker"]}, -)