Switch to setup.py

This commit is contained in:
IamTheFij 2018-02-16 09:48:26 -08:00
parent 584b2b336e
commit b4dfa8d835
4 changed files with 87 additions and 3 deletions

View File

@ -14,7 +14,14 @@ I'm running a few small services and found Sensu, Consul, Nagios, etc. to all be
### Running ### Running
Eventually it will be installed as python package, but for now: Install and execute with:
```
pip install -e git+https://git.iamthefij.com/iamthefij/minitor.git#egg=minitor
minitor
```
If locally developing you can use:
``` ```
make run make run

View File

@ -1,3 +1,4 @@
import sys
from argparse import ArgumentParser from argparse import ArgumentParser
from datetime import datetime from datetime import datetime
from os import environ from os import environ
@ -223,5 +224,14 @@ class Minitor(object):
sleep(self.check_interval) sleep(self.check_interval)
def main():
try:
Minitor().run()
except KeyboardInterrupt:
pass
return 0
if __name__ == '__main__': if __name__ == '__main__':
Minitor().run() sys.exit(main())

View File

@ -1 +0,0 @@
yamlenv

68
setup.py Normal file
View File

@ -0,0 +1,68 @@
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
# Arguments marked as "Required" below must be included for upload to PyPI.
# Fields marked as "Optional" may be commented out.
setup(
name='minitor',
version='0.1.0',
description='A minimal monitoring tool',
long_description=long_description,
url='https://git.iamthefij.com/iamthefij/minitor',
author='Ian Fijolek',
author_email='ian@iamthefij.com',
# Classifiers help users find your project by categorizing it.
#
# For a list of valid classifiers, see
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Topic :: System :: Monitoring',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
keywords='minitor monitoring alerting',
packages=find_packages(exclude=['contrib', 'docs', 'tests']), # Required
install_requires=[
'yamlenv',
],
# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
# `pip` to create the appropriate form of executable for the target
# platform.
#
# For example, the following would provide a command called `sample` which
# executes the function `main` from this package when invoked:
entry_points={
'console_scripts': [
'minitor=minitor.main:main',
],
},
)