Skip to content

Commit

Permalink
use pre-commit (#42)
Browse files Browse the repository at this point in the history
* feat: use pre-commit tool and central requirements-dev.txt

* feat: scan all py files with yapf (setup.py) and also run pre-commit

* prometheus_speedtest: Merge updated packages in setup.py after #42.

Co-authored-by: Jan Stürtz <jan.stuertz@contact-software.com>
Co-authored-by: Jean-Ralph Aviles <jeanralph.aviles@gmail.com>
Co-authored-by: Jean-Ralph Aviles <jeanralphaviles@users.noreply.github.com>
  • Loading branch information
4 people committed May 6, 2021
1 parent ac985b5 commit 8d54872
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 41 deletions.
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.31.0
hooks:
- id: yapf
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
- id: pytype
name: pytype
entry: pytype
args: []
language: system
types: [python]
default_language_version:
python: python3
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ python:
services:
- docker
install:
- pip install pylint pytype yapf -r requirements.txt
- # TODO(jeanralphaviles): Remove when Travis' Ruby is updated.
- pip install -r requirements-dev.txt -r requirements.txt
# TODO(jeanralphaviles): Remove when Travis' Ruby is updated.
- gem install chef-utils -v 16.6.14
- gem install mdl
script:
Expand All @@ -17,5 +17,6 @@ script:
- pylint **/*.py
- pytest
- pytype
- yapf -d **/*.py
- yapf -d -r .
- pre-commit run -a
- mdl README.md
5 changes: 5 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pre-commit
pylint
pytest
pytype
yapf
79 changes: 41 additions & 38 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,44 @@ def read_file(rel_path):
return rel_file.read().strip()


setup(name='prometheus_speedtest',
author='Jean-Ralph Aviles',
author_email='jeanralph.aviles+pypi@gmail.com',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Topic :: System :: Monitoring',
'Topic :: System :: Networking :: Monitoring',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python',
],
description=('Performs speedtest-cli tests and pushes metrics to '
'Prometheus Pushgateway'),
entry_points={
'console_scripts': [
('prometheus_speedtest='
'prometheus_speedtest.prometheus_speedtest:init'),
],
},
include_package_data=True,
packages=find_packages(),
install_requires=[
'absl-py==0.12.0',
'mock==4.0.3',
'prometheus_client==0.10.1',
'speedtest-cli==2.1.3',
],
keywords=['prometheus', 'monitoring', 'speedtest', 'speedtest.net'],
license='Apache License, Version 2.0',
long_description=read_file('README.md'),
long_description_content_type='text/markdown',
py_modules=['prometheus_speedtest'],
setup_requires=['setuptools>=38.6.0'],
url='https://github.com/jeanralphaviles/prometheus_speedtest',
version=version.VERSION)
setup(
name="prometheus_speedtest",
author="Jean-Ralph Aviles",
author_email="jeanralph.aviles+pypi@gmail.com",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: System :: Monitoring",
"Topic :: System :: Networking :: Monitoring",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python",
],
description=("Performs speedtest-cli tests and pushes metrics to "
"Prometheus Pushgateway"),
entry_points={
"console_scripts": [
("prometheus_speedtest="
"prometheus_speedtest.prometheus_speedtest:init"),
],
},
include_package_data=True,
packages=find_packages(),
install_requires=[
"absl-py==0.12.0",
"mock==4.0.3",
"prometheus_client==0.10.1",
"speedtest-cli==2.1.3",
],
keywords=["prometheus", "monitoring", "speedtest", "speedtest.net"],
license="Apache License, Version 2.0",
long_description=read_file("README.md"),
long_description_content_type="text/markdown",
py_modules=["prometheus_speedtest"],
setup_requires=["setuptools>=38.6.0"],
extras_require={"dev": read_file("requirements-dev.txt")},
url="https://github.com/jeanralphaviles/prometheus_speedtest",
version=version.VERSION,
)

0 comments on commit 8d54872

Please sign in to comment.