From e47919a2b357bd4e088abf3518b22cd15083f24b Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Mon, 15 Feb 2016 19:34:48 -0500 Subject: [PATCH 1/9] Add initial setup files for pip --- setup.cfg | 2 ++ setup.py | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..b88034e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..697a7b3 --- /dev/null +++ b/setup.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from setuptools import setup + +setup( + name = 'tespeed', + + # Since this package is simple, just reference the .py file + # directly instead of specifying a particular package + py_modules = ['tespeed'], + + # TODO: Make this dynamically retrieved from a source file for easier maintenance + version = '1.1.0', + description = 'Terminal network speed test that uses servers from Speedtest.net. It uses nearest test server but can also use one manually specified by the user', + + license = 'MIT', + + author = 'Janis Jansons', + author_email = 'janis.jansons@janhouse.lv', + url = 'https://github.com/gauthamchandra/tespeed', + + download_url = 'https://github.com/Janhouse/tespeed/tarball/1.1', + keywords = 'speedtest.net network speed', + + # dependencies + # TODO: Add upper and lower bound versions of compatibility so bleeding edge dependency doesn't break + # the app + install_requires = ['lxml', 'argparse'], + + entry_points = { + 'console_scripts': [ + 'tespeed=tespeed.tespeed:init' + ] + }, + + # Full list here: https://pypi.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + # Lifecycle of this version + 'Development Status :: 5 - Production/Stable', + + # The license the software is under + 'License :: OSI Approved :: MIT License', + + # What category and audience it may fall under + 'Programming Language :: Python', + 'Environment :: Console', + 'Operating System :: OS Independent', + 'Topic :: System :: Networking', + 'Topic :: Utilities', + 'Intended Audience :: System Administrators', + + # Supported versions + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 2 :: Only', + ], +) From 3a17cf90140f55e20d4cc84fbcff7cad9ee1290f Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Mon, 15 Feb 2016 19:36:21 -0500 Subject: [PATCH 2/9] Update gitignore --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 2bc1b44..c1abeda 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,10 @@ old/ *~ ~ *.pyc + +# Autogenerated stuff from build +*.egg +*.egg-info +build +dist +eggs From c734e6e75fb46156ec5bf518a14b54a5ce57ca56 Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Mon, 15 Feb 2016 20:10:01 -0500 Subject: [PATCH 3/9] Wrap main init code in a function * This is necessary for pip to be able to reference it as the entry point --- tespeed.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/tespeed.py b/tespeed.py index f7290d5..f586f47 100755 --- a/tespeed.py +++ b/tespeed.py @@ -684,27 +684,29 @@ def main(args): print_debug("\nTesting stopped.\n") #raise -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='TeSpeed, CLI SpeedTest.net') +# TODO: This should be offloaded to a man page +def init(): + if __name__ == '__main__': + parser = argparse.ArgumentParser(description='TeSpeed, CLI SpeedTest.net') - parser.add_argument('server', nargs='?', type=str, default='', help='Use the specified server for testing (skip checking for location and closest server).') - parser.add_argument('-ls', '--list-servers', dest='listservers', nargs='?', default=0, const=10, help='List the servers sorted by distance, nearest first. Optionally specify number of servers to show.') - parser.add_argument('-w', '--csv', dest='store', action='store_const', const=True, help='Print CSV formated output to STDOUT.') - parser.add_argument('-s', '--suppress', dest='suppress', action='store_const', const=True, help='Suppress debugging (STDERR) output.') - parser.add_argument('-mib', '--mebibit', dest='unit', action='store_const', const=True, help='Show results in mebibits.') - parser.add_argument('-n', '--server-count', dest='servercount', nargs='?', default=1, const=1, help='Specify how many different servers should be used in paralel. (Default: 1) (Increase it for >100Mbit testing.)') + parser.add_argument('server', nargs='?', type=str, default='', help='Use the specified server for testing (skip checking for location and closest server).') + parser.add_argument('-ls', '--list-servers', dest='listservers', nargs='?', default=0, const=10, help='List the servers sorted by distance, nearest first. Optionally specify number of servers to show.') + parser.add_argument('-w', '--csv', dest='store', action='store_const', const=True, help='Print CSV formated output to STDOUT.') + parser.add_argument('-s', '--suppress', dest='suppress', action='store_const', const=True, help='Suppress debugging (STDERR) output.') + parser.add_argument('-mib', '--mebibit', dest='unit', action='store_const', const=True, help='Show results in mebibits.') + parser.add_argument('-n', '--server-count', dest='servercount', nargs='?', default=1, const=1, help='Specify how many different servers should be used in paralel. (Default: 1) (Increase it for >100Mbit testing.)') - parser.add_argument('-p', '--proxy', dest='use_proxy', type=int, nargs='?', const=4, help='Specify 4 or 5 to use SOCKS4 or SOCKS5 proxy.') - parser.add_argument('-ph', '--proxy-host', dest='proxy_host', type=str, nargs='?', default='127.0.0.1', help='Specify socks proxy host. (Default: 127.0.0.1)') - parser.add_argument('-pp', '--proxy-port', dest='proxy_port', type=int, nargs='?', default=9050, help='Specify socks proxy port. (Default: 9050)') + parser.add_argument('-p', '--proxy', dest='use_proxy', type=int, nargs='?', const=4, help='Specify 4 or 5 to use SOCKS4 or SOCKS5 proxy.') + parser.add_argument('-ph', '--proxy-host', dest='proxy_host', type=str, nargs='?', default='127.0.0.1', help='Specify socks proxy host. (Default: 127.0.0.1)') + parser.add_argument('-pp', '--proxy-port', dest='proxy_port', type=int, nargs='?', default=9050, help='Specify socks proxy port. (Default: 9050)') - parser.add_argument('-cs', '--chunk-size', dest='chunksize', nargs='?', type=int, default=10240, help='Specify chunk size after wich tespeed calculates speed. Increase this number 4 or 5 times if you use weak hardware like RaspberryPi. (Default: 10240)') - parser.add_argument('-dt', '--max-download-tests', dest='downloadtests', nargs='?', type=int, default=15, help='Specify maximum number of download tests to be performed. (Default: 15)') - parser.add_argument('-ut', '--max-upload-tests', dest='uploadtests', nargs='?', type=int, default=10, help='Specify maximum number of upload tests to be performed. (Default: 10)') + parser.add_argument('-cs', '--chunk-size', dest='chunksize', nargs='?', type=int, default=10240, help='Specify chunk size after wich tespeed calculates speed. Increase this number 4 or 5 times if you use weak hardware like RaspberryPi. (Default: 10240)') + parser.add_argument('-dt', '--max-download-tests', dest='downloadtests', nargs='?', type=int, default=15, help='Specify maximum number of download tests to be performed. (Default: 15)') + parser.add_argument('-ut', '--max-upload-tests', dest='uploadtests', nargs='?', type=int, default=10, help='Specify maximum number of upload tests to be performed. (Default: 10)') - #parser.add_argument('-i', '--interface', dest='interface', nargs='?', help='If specified, measures speed from data for the whole network interface.') + #parser.add_argument('-i', '--interface', dest='interface', nargs='?', help='If specified, measures speed from data for the whole network interface.') - parser.add_argument('-v', '--version', dest='version', nargs='?', const=True, help='Show Tespeed version.') + parser.add_argument('-v', '--version', dest='version', nargs='?', const=True, help='Show Tespeed version.') - args = parser.parse_args() - main(args) + args = parser.parse_args() + main(args) From 6c4c4271cd1632c66eefc6dfe1ca9bd5a5acd671 Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Mon, 15 Feb 2016 20:10:51 -0500 Subject: [PATCH 4/9] Added the custom socksipy dependency --- setup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup.py b/setup.py index 697a7b3..1567d23 100644 --- a/setup.py +++ b/setup.py @@ -27,6 +27,10 @@ # the app install_requires = ['lxml', 'argparse'], + dependency_links = [ + 'git+https://github.com/Janhouse/SocksiPy#egg=SocksiPy' + ], + entry_points = { 'console_scripts': [ 'tespeed=tespeed.tespeed:init' From 5e601de2c07b315820488c5a29fddfebab60baa9 Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Tue, 16 Feb 2016 19:34:52 -0500 Subject: [PATCH 5/9] Add hack to install from requirements.txt * Now installing tespeed via `pip install` will also kick off a manual read of the requirements.txt to install any external deps * The custom SocksiPy module no longer needs to be bundled with tespeed source as it can be just installed directly to the env/virtualenv via `pip install -r requirements.txt` --- requirements.txt | 1 + setup.py | 10 ++++++++++ tespeed.py | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..74d4305 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +-e git+https://github.com/Janhouse/SocksiPy#egg=SocksiPy-digsby diff --git a/setup.py b/setup.py index 1567d23..d611c85 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,16 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup +from subprocess import call + +# A bit hacky but this needs to be done to install +# any dependency in VCS and non PyPi location as part of +# one `pip install` command +with open('./requirements.txt') as f: + deps = f.read().splitlines() + + for dep in deps: + call(['pip', 'install'] + dep.split(' ')) setup( name = 'tespeed', diff --git a/tespeed.py b/tespeed.py index f586f47..21087e6 100755 --- a/tespeed.py +++ b/tespeed.py @@ -8,7 +8,7 @@ args.suppress=None args.store=None -from SocksiPy import socks +import socks import socket # Magic! From 8092e73ef03c41d3c5c8456ce81833bf1ece3b6c Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Tue, 16 Feb 2016 19:39:15 -0500 Subject: [PATCH 6/9] Removed __name__ check * Since the main kickoff code is wrapped in an `init` function and called via a wrapper (due to pip install), this check is no longer needed * Also did some indentation cleanup to match existing codebase --- setup.py | 85 +++++++++++++++++++++++++++--------------------------- tespeed.py | 37 ++++++++++++------------ 2 files changed, 61 insertions(+), 61 deletions(-) mode change 100644 => 100755 setup.py diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index d611c85..4dc4745 --- a/setup.py +++ b/setup.py @@ -13,58 +13,59 @@ call(['pip', 'install'] + dep.split(' ')) setup( - name = 'tespeed', + name = 'tespeed', - # Since this package is simple, just reference the .py file - # directly instead of specifying a particular package - py_modules = ['tespeed'], + # Since this package is simple, just reference the .py file + # directly instead of specifying a particular package + py_modules = ['tespeed'], - # TODO: Make this dynamically retrieved from a source file for easier maintenance - version = '1.1.0', - description = 'Terminal network speed test that uses servers from Speedtest.net. It uses nearest test server but can also use one manually specified by the user', + # TODO: Make this dynamically retrieved from a source file for easier maintenance + version = '1.1.0', + description = 'Terminal network speed test that uses servers from Speedtest.net. It uses nearest test server but can also use one manually specified by the user', - license = 'MIT', + license = 'MIT', - author = 'Janis Jansons', - author_email = 'janis.jansons@janhouse.lv', - url = 'https://github.com/gauthamchandra/tespeed', + author = 'Janis Jansons', + author_email = 'janis.jansons@janhouse.lv', + url = 'https://github.com/gauthamchandra/tespeed', - download_url = 'https://github.com/Janhouse/tespeed/tarball/1.1', - keywords = 'speedtest.net network speed', + download_url = 'https://github.com/Janhouse/tespeed/tarball/1.1', + keywords = 'speedtest.net network speed', - # dependencies - # TODO: Add upper and lower bound versions of compatibility so bleeding edge dependency doesn't break - # the app - install_requires = ['lxml', 'argparse'], + # dependencies + # TODO: Add upper and lower bound versions of compatibility so bleeding edge dependency doesn't break + # the app + install_requires = ['lxml', 'argparse'], - dependency_links = [ - 'git+https://github.com/Janhouse/SocksiPy#egg=SocksiPy' - ], + # More for easy_install than pip + dependency_links = [ + 'https://github.com/Janhouse/SocksiPy/tarball/master#egg=SocksiPy-digsby' + ], - entry_points = { - 'console_scripts': [ - 'tespeed=tespeed.tespeed:init' - ] - }, + entry_points = { + 'console_scripts': [ + 'tespeed=tespeed:init' + ] + }, - # Full list here: https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers = [ - # Lifecycle of this version - 'Development Status :: 5 - Production/Stable', + # Full list here: https://pypi.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + # Lifecycle of this version + 'Development Status :: 5 - Production/Stable', - # The license the software is under - 'License :: OSI Approved :: MIT License', + # The license the software is under + 'License :: OSI Approved :: MIT License', - # What category and audience it may fall under - 'Programming Language :: Python', - 'Environment :: Console', - 'Operating System :: OS Independent', - 'Topic :: System :: Networking', - 'Topic :: Utilities', - 'Intended Audience :: System Administrators', + # What category and audience it may fall under + 'Programming Language :: Python', + 'Environment :: Console', + 'Operating System :: OS Independent', + 'Topic :: System :: Networking', + 'Topic :: Utilities', + 'Intended Audience :: System Administrators', - # Supported versions - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 2 :: Only', - ], + # Supported versions + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 2 :: Only', + ], ) diff --git a/tespeed.py b/tespeed.py index 21087e6..6dc99ad 100755 --- a/tespeed.py +++ b/tespeed.py @@ -684,29 +684,28 @@ def main(args): print_debug("\nTesting stopped.\n") #raise -# TODO: This should be offloaded to a man page +# TODO: The help text should be offloaded to a man page def init(): - if __name__ == '__main__': - parser = argparse.ArgumentParser(description='TeSpeed, CLI SpeedTest.net') + parser = argparse.ArgumentParser(description='TeSpeed, CLI SpeedTest.net') - parser.add_argument('server', nargs='?', type=str, default='', help='Use the specified server for testing (skip checking for location and closest server).') - parser.add_argument('-ls', '--list-servers', dest='listservers', nargs='?', default=0, const=10, help='List the servers sorted by distance, nearest first. Optionally specify number of servers to show.') - parser.add_argument('-w', '--csv', dest='store', action='store_const', const=True, help='Print CSV formated output to STDOUT.') - parser.add_argument('-s', '--suppress', dest='suppress', action='store_const', const=True, help='Suppress debugging (STDERR) output.') - parser.add_argument('-mib', '--mebibit', dest='unit', action='store_const', const=True, help='Show results in mebibits.') - parser.add_argument('-n', '--server-count', dest='servercount', nargs='?', default=1, const=1, help='Specify how many different servers should be used in paralel. (Default: 1) (Increase it for >100Mbit testing.)') + parser.add_argument('server', nargs='?', type=str, default='', help='Use the specified server for testing (skip checking for location and closest server).') + parser.add_argument('-ls', '--list-servers', dest='listservers', nargs='?', default=0, const=10, help='List the servers sorted by distance, nearest first. Optionally specify number of servers to show.') + parser.add_argument('-w', '--csv', dest='store', action='store_const', const=True, help='Print CSV formated output to STDOUT.') + parser.add_argument('-s', '--suppress', dest='suppress', action='store_const', const=True, help='Suppress debugging (STDERR) output.') + parser.add_argument('-mib', '--mebibit', dest='unit', action='store_const', const=True, help='Show results in mebibits.') + parser.add_argument('-n', '--server-count', dest='servercount', nargs='?', default=1, const=1, help='Specify how many different servers should be used in paralel. (Default: 1) (Increase it for >100Mbit testing.)') - parser.add_argument('-p', '--proxy', dest='use_proxy', type=int, nargs='?', const=4, help='Specify 4 or 5 to use SOCKS4 or SOCKS5 proxy.') - parser.add_argument('-ph', '--proxy-host', dest='proxy_host', type=str, nargs='?', default='127.0.0.1', help='Specify socks proxy host. (Default: 127.0.0.1)') - parser.add_argument('-pp', '--proxy-port', dest='proxy_port', type=int, nargs='?', default=9050, help='Specify socks proxy port. (Default: 9050)') + parser.add_argument('-p', '--proxy', dest='use_proxy', type=int, nargs='?', const=4, help='Specify 4 or 5 to use SOCKS4 or SOCKS5 proxy.') + parser.add_argument('-ph', '--proxy-host', dest='proxy_host', type=str, nargs='?', default='127.0.0.1', help='Specify socks proxy host. (Default: 127.0.0.1)') + parser.add_argument('-pp', '--proxy-port', dest='proxy_port', type=int, nargs='?', default=9050, help='Specify socks proxy port. (Default: 9050)') - parser.add_argument('-cs', '--chunk-size', dest='chunksize', nargs='?', type=int, default=10240, help='Specify chunk size after wich tespeed calculates speed. Increase this number 4 or 5 times if you use weak hardware like RaspberryPi. (Default: 10240)') - parser.add_argument('-dt', '--max-download-tests', dest='downloadtests', nargs='?', type=int, default=15, help='Specify maximum number of download tests to be performed. (Default: 15)') - parser.add_argument('-ut', '--max-upload-tests', dest='uploadtests', nargs='?', type=int, default=10, help='Specify maximum number of upload tests to be performed. (Default: 10)') + parser.add_argument('-cs', '--chunk-size', dest='chunksize', nargs='?', type=int, default=10240, help='Specify chunk size after wich tespeed calculates speed. Increase this number 4 or 5 times if you use weak hardware like RaspberryPi. (Default: 10240)') + parser.add_argument('-dt', '--max-download-tests', dest='downloadtests', nargs='?', type=int, default=15, help='Specify maximum number of download tests to be performed. (Default: 15)') + parser.add_argument('-ut', '--max-upload-tests', dest='uploadtests', nargs='?', type=int, default=10, help='Specify maximum number of upload tests to be performed. (Default: 10)') - #parser.add_argument('-i', '--interface', dest='interface', nargs='?', help='If specified, measures speed from data for the whole network interface.') + #parser.add_argument('-i', '--interface', dest='interface', nargs='?', help='If specified, measures speed from data for the whole network interface.') - parser.add_argument('-v', '--version', dest='version', nargs='?', const=True, help='Show Tespeed version.') + parser.add_argument('-v', '--version', dest='version', nargs='?', const=True, help='Show Tespeed version.') - args = parser.parse_args() - main(args) + args = parser.parse_args() + main(args) From 4ef76285af53639ca3232d7f724c3c91a19e4223 Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Tue, 16 Feb 2016 19:41:19 -0500 Subject: [PATCH 7/9] Rename license file to be more simple * Also added a manifest file to make sure the license is bundled with the install --- MIT-LICENSE.txt => LICENSE.txt | 0 MANIFEST.in | 1 + 2 files changed, 1 insertion(+) rename MIT-LICENSE.txt => LICENSE.txt (100%) create mode 100644 MANIFEST.in diff --git a/MIT-LICENSE.txt b/LICENSE.txt similarity index 100% rename from MIT-LICENSE.txt rename to LICENSE.txt diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..f2b6663 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include LICENSE.txt From 7a7e41e67d19e003a2a049dc3d3c234b33d7077d Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Tue, 16 Feb 2016 20:31:20 -0500 Subject: [PATCH 8/9] Updated README with new details --- README.md | 100 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 4ed132f..a010842 100644 --- a/README.md +++ b/README.md @@ -25,42 +25,59 @@ Tespeed (terminal speedtest) - Copyright 2012 Janis Jansons (janis.jansons@janho If you don't need testing through socks proxy, go check it out. :) -Requirements: +##Requirements: - This script requires recent Python (preferably 2.7 or newer) and Python2 - modules lxml and argparse. - Install python-lxml and python-argparse (Debian) - $ sudo apt-get install python-lxml python-argparse +##Installation: - or python2-lxml (Archlinux). +###Via Pip (**Coming Soon**) -Installation: +If you have pip installed, just do `pip install tespeed` - If you have Debian, you might have to change the python executable in tuper.py - or create a symlink for your existing python2.x executable by doing: - - sudo ln -s /usr/bin/python2.7 /usr/bin/python2 - - If you have python2.6 then replace python2.7 with python2.6. - - +###Manually via git - When doing the checkout, remember to pull submodules. - - If you have a decent git version (1.6.5 and up), get everything by doing: +###Requirements - git clone --recursive git://github.com/Janhouse/tespeed.git +Since this is a manual installation, the script requires recent Python +(preferably 2.7 or newer) and Python2 modules `lxml` and `argparse`. +Install python-lxml and python-argparse (Debian) - Otherwise do: +``` +$ sudo apt-get install python-lxml python-argparse +``` + +or python2-lxml (Archlinux). + + +If you have Debian, you might have to change the python executable in tuper.py +or create a symlink for your existing python2.x executable by doing: + +``` +sudo ln -s /usr/bin/python2.7 /usr/bin/python2 +``` - git clone git://github.com/Janhouse/tespeed.git - cd tespeed - git submodule init - git submodule update +If you have python2.6 then replace python2.7 with python2.6. + +###Grabbing Source +When doing the checkout, remember to pull submodules. -Usage: +If you have a decent git version (1.6.5 and up), get everything by doing: + +``` +git clone --recursive git://github.com/Janhouse/tespeed.git +``` + +Otherwise do: + +``` +git clone git://github.com/Janhouse/tespeed.git +cd tespeed +git submodule init +git submodule update +``` + +##Usage: usage: tespeed.py [-h] [-ls [LISTSERVERS]] [-w] [-s] [-mib] [-n [SERVERCOUNT]] [-p [USE_PROXY]] [-ph [PROXY_HOST]] [-pp [PROXY_PORT]] @@ -96,7 +113,7 @@ Usage: weak hardware like RaspberryPi. (Default: 10240) -What the script does: +##What the script does: * Loads config from speedtest.net (http://speedtest.net/speedtest-config.php). @@ -116,14 +133,15 @@ What the script does: * Can measure through SOCKS proxy. -Logging to file +###Logging to file - Execute manually or add to crontab: - - echo $(date +"%Y-%m-%d,%H:%M"),$(./tespeed.py -w) >> speedtest-log.txt +Execute manually or add to crontab: +``` +echo $(date +"%Y-%m-%d,%H:%M"),$(./tespeed.py -w) >> speedtest-log.txt +``` -TODO (ideas): +##TODO (ideas): * Make it less messy. * Send found results to speedtest.net API (needs some hash?) and get the link @@ -135,4 +153,24 @@ TODO (ideas): actively sendong/receiving data at the same time. (Should provide more precise test results.) +##Contributing and Testing + +_**Warning:** Section incomplete_ + +####Initial Steps: +1. To develop, package and upload, you need: [twine](https://github.com/pypa/twine) +2. You also need to have an account with PyPi setup +3. Setup your `.pypirc` file. [See here on how](https://docs.python.org/2/distutils/packageindex.html#pypirc) + +####Testing +To run and test locally, feel free to just install from local source via: `pip install -e ` + +####Uploading: +* Create the `PKG-INFO` that is used to describe your package to pypi registry with `python setup.py egg_info` +* Upload `tespeed.egg-info/PKG-INFO` via the [PyPi form on the website](https://pypi.python.org/pypi?%3Aaction=submit_form) +* To package, run: `python setup.py sdist bdist_wheel` +* To upload, run: `twine upload dist/*` (please upload and test with `-r pypitest` first before uploading directly to pypi) + +If you want to test if everything worked (assuming you uploaded to _pypitest_ first): +* Just run `pip install -i https://testpypi.python.org/pypi tespeed` From cd2f2bceb2ef38ab556d9e7fc0d48f7d78ee8537 Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Tue, 16 Feb 2016 20:39:34 -0500 Subject: [PATCH 9/9] Added back the __name__ check * This will now allow the app to support both configurations: running from source and running from pip install --- README.md | 11 +++++++++++ tespeed.py | 3 +++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index a010842..a8b8cda 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,17 @@ sudo ln -s /usr/bin/python2.7 /usr/bin/python2 If you have python2.6 then replace python2.7 with python2.6. +#####Grabbing the custom SocksiPy-digsby dependency + +Finally, _IF you are doing the manual step_, the app needs a custom version of the `SocksiPy-digsby` library +that needs to be installed for tespeed to work and so the following should be run: + +``` +pip install -r requirements.txt +``` + +This will grab the custom dependency and install it in the path + ###Grabbing Source When doing the checkout, remember to pull submodules. diff --git a/tespeed.py b/tespeed.py index 6dc99ad..6f74793 100755 --- a/tespeed.py +++ b/tespeed.py @@ -709,3 +709,6 @@ def init(): args = parser.parse_args() main(args) + +if __name__ == '__main__': + init()