diff options
Diffstat (limited to '')
-rw-r--r-- | .pre-commit-config.yaml | 13 | ||||
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | pyproject.toml | 29 | ||||
-rw-r--r-- | setup.py | 101 | ||||
-rw-r--r-- | test-requirements.txt | 5 |
5 files changed, 93 insertions, 60 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a099e48 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,13 @@ +repos: +- repo: https://github.com/timothycrosley/isort + rev: 4.3.21 + hooks: + - id: isort + language_version: python3.6 + additional_dependencies: + - toml +- repo: https://github.com/python/black + rev: 19.10b0 + hooks: + - id: black + language_version: python3.6 diff --git a/.travis.yml b/.travis.yml index fe3eb6a..3f76cf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,15 +3,16 @@ dist: xenial language: python python: - - 3.5 - 3.6 - 3.7 - 3.8-dev install: - - pip install -r test-requirements.txt + - pip install .[dev] script: - py.test - python setup.py bdist_wheel - pip install ./dist/glucometerutils-*.whl + - pre-commit install + - pre-commit run --all-files diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d1898d8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +# NOTE: you have to use single-quoted strings in TOML for regular expressions. +# It's the equivalent of r-strings in Python. Multiline strings are treated as +# verbose regular expressions by Black. Use [ ] to denote a significant space +# character. + +[tool.black] +line-length = 88 +target-version = ['py35'] +exclude = ''' +/( + \.eggs + | \.git + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist +)/ +''' + +[tool.isort] +line_length = 88 +multi_line_output = 3 +include_trailing_comma = true +known_first_party = ['glucometerutils'] +known_third_party = ['construct', 'hidapi', 'pyserial', 'pyscsi'] @@ -4,74 +4,69 @@ import sys -from setuptools import setup, find_packages +from setuptools import find_packages, setup from setuptools.command.test import test as TestCommand - -with open('test-requirements.txt') as requirements: - test_required = requirements.read().splitlines() +test_required = [ + "absl-py", + "construct>=2.9", + "pytest>=3.6.0", + "pytest-timeout>=1.3.0", + "pyserial", +] class PyTestCommand(TestCommand): - def run_tests(self): # import here, cause outside the eggs aren't loaded import pytest + errno = pytest.main([]) sys.exit(errno) setup( - name = 'glucometerutils', - version = '1', - description = 'Glucometer access utilities', - author = 'Diego Elio Pettenò', - author_email = 'flameeyes@flameeyes.com', - url = 'https://www.flameeyes.com/p/glucometerutils', - download_url = 'https://www.flameeyes.com/files/glucometerutils.tgz', - keywords = ['glucometer', 'diabetes'], - python_requires = '~=3.5', - classifiers = [ - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Operating System :: OS Independent', - 'License :: OSI Approved :: MIT License', - 'Intended Audience :: End Users/Desktop', - 'Topic :: Scientific/Engineering :: Medical Science Apps.', - ], - packages = find_packages( - exclude=['test', 'udev']), - data_files = [ - ('lib/udev/rules', ['udev/69-glucometerutils.rules']), + name="glucometerutils", + version="1", + description="Glucometer access utilities", + author="Diego Elio Pettenò", + author_email="flameeyes@flameeyes.com", + url="https://www.flameeyes.com/p/glucometerutils", + download_url="https://www.flameeyes.com/files/glucometerutils.tgz", + keywords=["glucometer", "diabetes"], + python_requires="~=3.5", + classifiers=[ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Development Status :: 4 - Beta", + "Environment :: Console", + "Operating System :: OS Independent", + "License :: OSI Approved :: MIT License", + "Intended Audience :: End Users/Desktop", + "Topic :: Scientific/Engineering :: Medical Science Apps.", ], - install_requires = [ - 'attrs', - ], - tests_require = test_required, - extras_require = { + packages=find_packages(exclude=["test", "udev"]), + data_files=[("lib/udev/rules", ["udev/69-glucometerutils.rules"]),], + install_requires=["attrs",], + tests_require=test_required, + extras_require={ # These are all the drivers' dependencies. Optional dependencies are # listed as mandatory for the feature. - 'accucheck_reports': [], - 'contourusb': ['construct', 'hidapi'], - 'fsinsulinx': ['construct', 'hidapi'], - 'fslibre': ['construct', 'hidapi'], - 'fsoptium': ['pyserial'], - 'fsprecisionneo': ['construct', 'hidapi'], - 'otultra2': ['pyserial'], - 'otultraeasy': ['construct', 'pyserial'], - 'otverio2015': ['construct', 'python-scsi'], - 'otverioiq': ['construct', 'pyserial'], - 'sdcodefree': ['construct', 'pyserial'], - 'td4277': ['construct', 'pyserial', 'hidapi'], - }, - entry_points = { - 'console_scripts': [ - 'glucometer=glucometerutils.glucometer:main' - ] - }, - cmdclass = { - 'test': PyTestCommand, + "accucheck_reports": [], + "contourusb": ["construct", "hidapi"], + "fsinsulinx": ["construct", "hidapi"], + "fslibre": ["construct", "hidapi"], + "fsoptium": ["pyserial"], + "fsprecisionneo": ["construct", "hidapi"], + "otultra2": ["pyserial"], + "otultraeasy": ["construct", "pyserial"], + "otverio2015": ["construct", "python-scsi"], + "otverioiq": ["construct", "pyserial"], + "sdcodefree": ["construct", "pyserial"], + "td4277": ["construct", "pyserial", "hidapi"], + # Development and testing dependencies + "dev": test_required + ["pre-commit"], }, + entry_points={"console_scripts": ["glucometer=glucometerutils.glucometer:main"]}, + cmdclass={"test": PyTestCommand,}, ) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 9a9c847..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -absl-py -construct>=2.9 -pytest>=3.6.0 -pytest-timeout>=1.3.0 -pyserial |