Light Talks
Code tricks.
This code would be useful for the rest of my team but i will show it for the next sprint, right?
This code is not part of the functionality that I am testing...
I will add it to my "Utils" library.
(Just 3 steps)
#!/usr/bin/env python
from setuptools import setup
setup(
name='commonUtils',
version='0.0.1',
description='common Utilities',
url='https://github.com/XavierVal/commonUtils',
install_requires=[
'requests==1.2.3',
'nose==1.3.4'
],
py_modules=[
'commonUtils.time_utils',
],
packages=[
'commonUtils',
'commonUtils.templates',
],
)
from datetime import datetime
class TimeUtils(object):
def time_now(self):
current_time = datetime.now().time()
print "Current Time is: {}".format(current_time)
return current_time$ pip install git+https://github.com/XavierVal/commonUtils@master
Downloading/unpacking git+https://github.com/XavierVal/commonUtils@master
Cloning https://github.com/XavierVal/commonUtils (to master) to c:\users\x\appdata\local\temp\pip-8iwi5h-build
Running setup.py (path:c:\users\x\appdata\local\temp\pip-8iwi5h-build\setup.py) egg_info for package from git+https://github.com/XavierVal/commonUtils@master
Requirement already satisfied (use --upgrade to upgrade): requests==1.2.3 in c:\python27\lib\site-packages (from commonUtils==0.0.1)
Requirement already satisfied (use --upgrade to upgrade): nose==1.3.4 in c:\python27\lib\site-packages (from commonUtils==0.0.1)
Installing collected packages: commonUtils
Running setup.py install for commonUtils
Successfully installed commonUtils
Cleaning up...
$ pip list | grep common
commonUtils (0.0.1)$ python
>>> from commonUtils import time_utils
>>> time_obj = time_utils.TimeUtils()
>>> time_obj.time_now()
Current Time is: 09:44:14.066000