From 5399d4194e14ad79247bc589cb777b5a547ac149 Mon Sep 17 00:00:00 2001 From: Eugenio Lacuesta Date: Wed, 23 Jun 2021 11:21:22 -0300 Subject: [PATCH] Add black check --- .github/workflows/checks.yml | 3 +++ pyproject.toml | 3 +++ setup.py | 50 +++++++++++++++++++----------------- tox.ini | 8 +++++- 4 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 2f38d19..bb50590 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -7,6 +7,9 @@ jobs: strategy: matrix: include: + - python-version: 3 + env: + TOXENV: black - python-version: 3 env: TOXENV: flake8 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b409f47 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.black] +line-length = 99 +exclude = 'cssselect/|tests/' diff --git a/setup.py b/setup.py index de7128d..3782534 100644 --- a/setup.py +++ b/setup.py @@ -2,45 +2,47 @@ import re import os.path + try: from setuptools import setup - extra_kwargs = {'test_suite': 'cssselect.tests'} + + extra_kwargs = {"test_suite": "cssselect.tests"} except ImportError: from distutils.core import setup + extra_kwargs = {} ROOT = os.path.dirname(__file__) -README = open(os.path.join(ROOT, 'README.rst')).read() -INIT_PY = open(os.path.join(ROOT, 'cssselect', '__init__.py')).read() +README = open(os.path.join(ROOT, "README.rst")).read() +INIT_PY = open(os.path.join(ROOT, "cssselect", "__init__.py")).read() VERSION = re.search("VERSION = '([^']+)'", INIT_PY).group(1) setup( - name='cssselect', + name="cssselect", version=VERSION, - author='Ian Bicking', - author_email='ianb@colorstudy.com', - maintainer='Paul Tremberth', - maintainer_email='paul.tremberth@gmail.com', - description= - 'cssselect parses CSS3 Selectors and translates them to XPath 1.0', + author="Ian Bicking", + author_email="ianb@colorstudy.com", + maintainer="Paul Tremberth", + maintainer_email="paul.tremberth@gmail.com", + description="cssselect parses CSS3 Selectors and translates them to XPath 1.0", long_description=README, - url='https://github.com/scrapy/cssselect', - license='BSD', - packages=['cssselect'], - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + url="https://github.com/scrapy/cssselect", + license="BSD", + packages=["cssselect"], + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7' + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", ], **extra_kwargs ) diff --git a/tox.ini b/tox.ini index 5ae98ce..1d94302 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = flake8,security,py +envlist = black,flake8,security,py [testenv] basepython = python3 @@ -8,6 +8,12 @@ deps= commands = py.test --cov-report term --cov=cssselect +[testenv:black] +deps = + black==21.6b0 +commands = + black --check {posargs: cssselect setup.py tests} + [testenv:flake8] deps = flake8==3.9.2