From 6cb713196eb6bc35f74bcc11d3a70f4af6c9a993 Mon Sep 17 00:00:00 2001 From: Blair Azzopardi Date: Sat, 30 Dec 2017 18:01:12 +0000 Subject: [PATCH] Restructure to allow pip install from git update readme with install instructions --- .gitignore | 28 ++++++++++++++++++++++++++++ MANIFEST.in | 1 + README.md | 23 ++++++++++++++++++++++- __init__.py | 1 - setup.py | 13 +++++++++++++ tests.py | 18 +++++++++++++++--- 6 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 MANIFEST.in delete mode 100644 __init__.py create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05407d9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +test.txt diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..2baa498 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include micropyGPS.py diff --git a/README.md b/README.md index ea815d5..aaf6fa0 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,27 @@ Features: - Parser written with a serial UART data source in mind; works on a single character at a time with robust error handling for noisy embedded environments - Modeled after the great [TinyGPS] Arduino library + +## Install / uninstall + +Install by cloning from git and running install via setuptools. + +```sh +git clone https://github.com/bsdz/micropyGPS.git +python setup.py install +``` + +Or install directly from github using pip. + +```sh +pip install git+https://github.com/bsdz/micropyGPS.git +``` + +To uninstall use the following pip command. + +```sh +pip uninstall micropyGPS +``` ## Basic Usage @@ -208,4 +229,4 @@ Beyond the pyBoard, micropyGPS should run on other embedded platforms that have [TinyGPS]:http://arduiniana.org/libraries/tinygps/ [pyboard]:http://docs.micropython.org/en/latest/pyboard/pyboard/quickref.html [MTK_command]:https://github.com/inmcm/MTK_commands -[Ultimate GPS Breakout]:http://www.adafruit.com/product/746 \ No newline at end of file +[Ultimate GPS Breakout]:http://www.adafruit.com/product/746 diff --git a/__init__.py b/__init__.py deleted file mode 100644 index 0dd9ea0..0000000 --- a/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__author__ = 'inmcm' diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f433d88 --- /dev/null +++ b/setup.py @@ -0,0 +1,13 @@ +from setuptools import setup, find_packages + +setup(name='micropyGPS', + version='1.0', + description='GPS NMEA sentence parser', + author='Calvin McCoy', + author_email='calvin.mccoy@gmail.com', + url='https://github.com/inmcm/micropyGPS', + py_modules = ['micropyGPS'], + include_package_data=True, + test_suite="tests.py", + +) diff --git a/tests.py b/tests.py index 3d7e93d..f1215ea 100644 --- a/tests.py +++ b/tests.py @@ -7,8 +7,7 @@ Tests for micropyGPS module from micropyGPS import MicropyGPS -if __name__ == "__main__": - +def run_tests(): sentence_count = 0 test_RMC = ['$GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62\n', @@ -148,4 +147,17 @@ if __name__ == "__main__": print('Sentences Attempted:', sentence_count) print('Sentences Found:', my_gps.clean_sentences) print('Sentences Parsed:', my_gps.parsed_sentences) - print('CRC_Fails:', my_gps.crc_fails) \ No newline at end of file + print('CRC_Fails:', my_gps.crc_fails) + +import unittest + +class TestMicroPyGPS(unittest.TestCase): + + def test_smoke(self): + try: + run_tests() + except: + self.fail("smoke test raised exception") + +if __name__ == "__main__": + run_tests()