From bee1d7cd7bab6aa7b6ec7d00931fa25cd425c47a Mon Sep 17 00:00:00 2001 From: anshengme Date: Mon, 11 Dec 2017 23:53:00 +0800 Subject: [PATCH] v0.0.3 --- README.rst | 15 ++++++++++++--- docs/source/conf.py | 4 ++-- requirements-dev.txt | 1 + setup.py | 35 ++++++++++++----------------------- tests/test_utils.py | 12 ++++++------ tox.ini | 2 +- turbotools/__init__.py | 2 +- turbotools/utils.py | 8 ++++++++ 8 files changed, 43 insertions(+), 36 deletions(-) create mode 100644 requirements-dev.txt diff --git a/README.rst b/README.rst index 6ab5d62..9ff38a5 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ Turbotools -================== +^^^^^^^^^^^^^^^^ .. image:: https://travis-ci.org/anshengme/turbotools.svg?branch=master :target: https://travis-ci.org/anshengme/turbotools @@ -10,8 +10,17 @@ Turbotools .. image:: https://img.shields.io/pypi/v/turbotools.svg? :target: http://badge.fury.io/py/turbotools -.. image:: https://img.shields.io/pypi/pyversions/Django.svg +.. image:: https://img.shields.io/pypi/pyversions/turbotools.svg :target: https://github.com/anshengme/turbotools .. image:: https://img.shields.io/github/license/mashape/apistatus.svg - :target: https://github.com/anshengme/turbotools/blob/master/LICENSE \ No newline at end of file + :target: https://github.com/anshengme/turbotools/blob/master/LICENSE + + +发布PyPi +---------------- + +:: + + python setup.py sdist + twine upload dist/* \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 65d3ef6..6307cff 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -55,9 +55,9 @@ # built documents. # # The short X.Y version. -version = '0.0.1' +version = '0.0.3' # The full version, including alpha/beta/rc tags. -release = '0.0.1' +release = '0.0.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..bcb4a6a --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1 @@ +twine==1.9.1 \ No newline at end of file diff --git a/setup.py b/setup.py index 14f3fe9..fd7463d 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import codecs import os @@ -9,7 +6,6 @@ from turbotools import __author__ from turbotools import __email__ -# from distutils.core import setup from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) @@ -17,23 +13,16 @@ long_description = '\n' + f.read() setup( - name=__title__, - version=__version__, - author=__author__, - author_email=__email__, - description='My short description for my project. ', - long_description=long_description, - url='https://github.com/anshengme/turbotools', - packages=find_packages(exclude=('tests',)), - install_requires=['requests'], - entry_points=''' - [console_scripts] - turbotools-cli=turbotools.cli:main - ''', - classifiers=[ - # Trove classifiers - # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers - # 'License :: OSI Approved :: ISC License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3.6'] + name=__title__, + version=__version__, + author=__author__, + author_email=__email__, + description='Toolset. ', + long_description=long_description, + url='https://github.com/anshengme/turbotools', + license='LICENSE.txt', + packages=find_packages(exclude=['tests*']), + classifiers=[ + 'Programming Language :: Python :: 3.6' + ] ) diff --git a/tests/test_utils.py b/tests/test_utils.py index c2f4bf8..bf9806c 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,10 +1,10 @@ import unittest - -class UtilsTest(unittest.TestCase): - def test_random(self): - pass +from turbotools.utils import get_random_str -if __name__ == '__main__': - unittest.main() +class UtilsTest(unittest.TestCase): + def test_get_random_str(self): + random_str = get_random_str(length=4, chars='0123456789') + self.assertEqual(isinstance(int(random_str), int), True) + self.assertEqual(len(random_str), 4) diff --git a/tox.ini b/tox.ini index 2e7590f..56cd090 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,7 @@ commands = sphinx-build -W -b html source build [testenv:pep8] deps = flake8 flake8-import-order -commands = flake8 turbotools tests +commands = flake8 --max-line-length 120 turbotools tests [testenv:unit] deps = nose diff --git a/turbotools/__init__.py b/turbotools/__init__.py index 01f43b8..b2894d8 100644 --- a/turbotools/__init__.py +++ b/turbotools/__init__.py @@ -1,4 +1,4 @@ __title__ = 'turbotools' -__version__ = '0.0.1' +__version__ = '0.0.3' __author__ = 'ansheng' __email__ = 'ianshengme@gmail.com' diff --git a/turbotools/utils.py b/turbotools/utils.py index e69de29..95e1ac9 100644 --- a/turbotools/utils.py +++ b/turbotools/utils.py @@ -0,0 +1,8 @@ +import random +import string + + +def get_random_str(length=32, chars=string.ascii_uppercase + string.digits + string.ascii_lowercase): + """在chars中生成length长度的字符串 + """ + return ''.join(random.SystemRandom().choice(chars) for _ in range(length))