From e93026b6f0d58568142528efc221653ad9637d85 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Fri, 26 May 2017 17:51:13 +0100 Subject: [PATCH 1/4] Update tox targets --- tox.ini | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tox.ini b/tox.ini index 2112a1e..c636740 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] -minversion=1.3 -envlist = py27,py26,py34,docs -addopts = --ignore=setup.py +minversion = 2.3.1 +envlist = {py27,py35,py36}-{win,linux,darwin} +skip_missing_interpreters = true +#addopts = --ignore=setup.py [testenv:docs] -downloadcache={toxworkdir}/downloadcache basepython=python changedir=docs deps= @@ -16,14 +16,13 @@ commands= [testenv] sitepackages=False -downloadcache={toxworkdir}/downloadcache +platform = + win: windows + linux: linux + darwin: darwin deps= - yanc - pytest>=2.4.2 - pytest-cov - pytest-pep8 - pytest-xdist - six>=1.9.0 + -rrequirements.txt + -rrequirements-dev.txt commands= python -m pytest --cov-report xml --cov tendo --pyargs tendo @@ -31,7 +30,6 @@ commands= [testenv:py26] sitepackages=False -downloadcache={toxworkdir}/downloadcache deps= {[testenv]deps} unittest2 From 2e9cadbc2a69a63108c33d5c39e4a3c3ea429e10 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Fri, 26 May 2017 17:45:51 +0100 Subject: [PATCH 2/4] Adopted pbr packaging --- .gitignore | 2 + requirements.txt | 1 + setup.cfg | 40 +++++++++++- setup.py | 161 ++--------------------------------------------- 4 files changed, 47 insertions(+), 157 deletions(-) mode change 100755 => 100644 setup.py diff --git a/.gitignore b/.gitignore index 8c5d1c1..b0d89a3 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ pytestdebug.log test-distribute.sh .idea/misc.xml .idea/tendo.iml +/ChangeLog +/AUTHORS diff --git a/requirements.txt b/requirements.txt index 1f55e22..8cb5de9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +pbr pip six>=1.7.2 setuptools \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index e4b8e36..3da82a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,44 @@ [metadata] -description-file = README +name = tendo +author = Sorin Sbarnea +author-email = sorin.sbarnea@gmail.com +maintainer = Sorin Sbarnea +maintainer-email = sorin.sbarnea@gmail.com +summary = A Python library that extends some core functionality +description-file = README.rst +home-page = https://github.com/pycontribs/tendo +license = BSD +classifier = + Development Status :: 5 - Production/Stable + Environment :: Other Environment + Intended Audience :: Developers + Intended Audience :: Information Technology + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 2.6 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Topic :: Software Development :: Libraries :: Python Modules + Topic :: Internet :: WWW/HTTP + +keywords = + tendo + tee + unicode + colorer + singleton + +[files] +packages = + tendo + +[entry_points] +pbr.config.drivers = + plain = pbr.cfg.driver:Plain [bdist_wheel] universal = 1 diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 index d156e38..ce14d42 --- a/setup.py +++ b/setup.py @@ -1,159 +1,8 @@ #!/usr/bin/env python -# Setuptools is required for the use_2to3 option below. You should install it -# from the Distribute home page, http://packages.python.org/distribute/ -from __future__ import absolute_import -import logging -import os -import sys +from setuptools import setup -from setuptools import setup, Command -from setuptools.command.test import test as TestCommand - -from tendo.version import __version__ # noqa - - -NAME = "tendo" - -# Hack to prevent stupid "TypeError: 'NoneType' object is not callable" error -# in multiprocessing/util.py _exit_function when running `python -# setup.py test` (see -# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html) -try: - import multiprocessing # noqa -except ImportError: - pass - - -class PyTest(TestCommand): - user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = [] - - FORMAT = '%(levelname)-10s %(message)s' - logging.basicConfig(format=FORMAT) - logging.getLogger().setLevel(logging.INFO) - - # if we have pytest-cache module we enable the test failures first mode - try: - import pytest_cache # noqa - self.pytest_args.append("--ff") - except ImportError: - pass - - # try: - # import pytest_instafail - # self.pytest_args.append("--instafail") - # except ImportError: - # pass - self.pytest_args.append("-s") - - if sys.stdout.isatty(): - # when run manually we enable fail fast - self.pytest_args.append("--maxfail=2") - - try: - import coveralls # noqa - self.pytest_args.append("--cov=%s" % NAME) - self.pytest_args.extend(["--cov-report", "xml"]) - - except ImportError: - pass - - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = [] - self.test_suite = True - - def run_tests(self): - # before running tests we need to run autopep8 - r = os.system( - "python -m autopep8 -r --in-place %s/ examples/" % NAME) - if r: - raise Exception("autopep8 failed") - - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(self.pytest_args) - sys.exit(errno) - - -class Release(Command): - user_options = [] - - def initialize_options(self): - # Command.initialize_options(self) - pass - - def finalize_options(self): - # Command.finalize_options(self) - pass - - def run(self): - import json - try: - from urllib.request import urlopen - except ImportError: - from urllib2 import urlopen - response = urlopen( - "http://pypi.python.org/pypi/%s/json" % NAME).read().decode('utf-8') - data = json.loads(response) - released_version = data['info']['version'] - if released_version == __version__: - raise RuntimeError( - "This version was already released, remove it from PyPi if you want to release it again or increase the version number. http://pypi.python.org/pypi/%s/" % NAME) - elif released_version > __version__: - raise RuntimeError("Cannot release a version (%s) smaller than the PyPI current release (%s)." % ( - __version__, released_version)) - - sys.exit() - - -if __name__ == '__main__': - setup( - name=NAME, - py_modules=['tendo.colorer', 'tendo.execfile2', 'tendo.singleton', - 'tendo.tee', 'tendo.unicode', 'tendo.version'], - version=__version__, - cmdclass={'test': PyTest, 'release': Release}, - packages=[NAME], - - zip_safe=False, - setup_requires=['six'], - tests_require=['pep8>=0.6', 'py>=1.4.15', 'pytest', 'six', 'sphinx'], - test_suite="py.test", - maintainer='Sorin Sbarnea', - maintainer_email='sorin.sbarnea@gmail.com', - license='Python', - description='A Python library that extends some core functionality', - - long_description=open("README.rst").read(), - author='Sorin Sbarnea', - author_email='sorin.sbarnea@gmail.com', - platforms=['any'], - url='https://github.com/pycontribs/tendo', - download_url='https://github.com/pycontribs/tendo/archives/master', - bugtrack_url='https://github.com/pycontribs/tendo/issues', - home_page='https://github.com/pycontribs/tendo', - keywords=['tendo', 'tee', 'unicode', 'colorer', 'singleton'], - classifiers=[ - 'Programming Language :: Python', - 'Programming Language :: Python :: 2.5', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Development Status :: 4 - Beta', - 'Environment :: Other Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Topic :: Internet', - ], - ) +setup( + setup_requires=['pbr>=1.9', 'setuptools>=17.1'], + pbr=True, +) From c93ce12790dc67711d5f0372e295e9262218a189 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 20 Jun 2017 19:09:40 +0100 Subject: [PATCH 3/4] dropped py26 and fixed linting Change-Id: I50c69a22f220a84d4d2a365d616a5f90351a037e --- .travis.yml | 3 +-- setup.cfg | 9 ++++++--- tendo/colorer.py | 2 +- tox.ini | 7 ------- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 46b30bd..a74fc92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,9 @@ language: python os: - linux python: -- '2.6' - '2.7' -- '3.4' - '3.5' +- '3.6' install: - pip -q install -r requirements.txt - pip -q install -r requirements-dev.txt diff --git a/setup.cfg b/setup.cfg index 3da82a0..ae4a8d8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,11 +17,10 @@ classifier = License :: OSI Approved :: BSD License Operating System :: OS Independent Programming Language :: Python - Programming Language :: Python :: 2.6 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 Topic :: Software Development :: Libraries :: Python Modules Topic :: Internet :: WWW/HTTP @@ -50,7 +49,7 @@ all_files = 1 [upload_sphinx] upload-dir = docs/build/html -[pytest] +[tool:pytest] norecursedirs = . .svn _build tmp* lib/third lib *.egg bin distutils build docs demo python_files = *.py addopts = -p no:xdist --ignore=setup.py --tb=long --capture=fd -rxX --maxfail=10 --pep8 tendo @@ -63,6 +62,10 @@ addopts = -p no:xdist --ignore=setup.py --tb=long --capture=fd -rxX --maxfail=1 rsyncdirs = . tendo demo docs rsyncignore = .hg .git pep8ignore = E501 E265 E127 E901 E128 E402 +filterwarnings = default + ignore:.*mode is deprecated:Warning + ignore:unclosed file.*:Warning + ignore:can't resolve package from.*:Warning [flake8] exclude = migrations,__pycache__,build,bmll/config.py,env,src,.tox diff --git a/tendo/colorer.py b/tendo/colorer.py index 7ebc70d..18ebebe 100755 --- a/tendo/colorer.py +++ b/tendo/colorer.py @@ -170,7 +170,7 @@ def test_1(self): logging.getLogger().addHandler(ch) logging.getLogger().addHandler(fh) - logging.warn("a warning") + logging.warning("a warning") logging.error("some error") logging.info("some info") logging.debug("some info") diff --git a/tox.ini b/tox.ini index c636740..f7a9f9c 100644 --- a/tox.ini +++ b/tox.ini @@ -26,10 +26,3 @@ deps= commands= python -m pytest --cov-report xml --cov tendo --pyargs tendo -#.tests - -[testenv:py26] -sitepackages=False -deps= - {[testenv]deps} - unittest2 From 1d8899df4935a5a41588a66cf2e418edb827be6b Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Fri, 6 Oct 2017 10:33:02 +0100 Subject: [PATCH 4/4] travis: updated targets and refreshed README.rst Change-Id: I1eeef7aa654cc98e56bfa5256bbf142ed6fb2052 --- .travis.yml | 122 ++++++++++++++++++++++++++++++++-------------------- README.rst | 40 +++++++++++++---- tox.ini | 2 +- 3 files changed, 109 insertions(+), 55 deletions(-) diff --git a/.travis.yml b/.travis.yml index a74fc92..628b0f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,56 +1,86 @@ language: python +sudo: false +matrix: + fast_finish: false os: - linux -python: -- '2.7' -- '3.5' -- '3.6' +matrix: + include: + - python: 2.7 + env: TOXENV=py27 + - python: 3.4 + env: TOXENV=py34 + - python: 3.5 + env: TOXENV=py35 + - python: 3.6 + env: TOXENV=py36 + - python: pypy + env: TOXENV=pypy + - python: 2.7 + env: TOXENV=docs +branches: + only: + - master + - develop install: -- pip -q install -r requirements.txt -- pip -q install -r requirements-dev.txt -- pip -q install -r requirements-opt.txt || echo "skipped" -- pip -q install coveralls +- pip -q --log dist/pip.log install --upgrade pip setuptools tox-travis py wheel +- python setup.py sdist bdist_wheel install +- pip install ./dist/*.whl +- pip --version script: - - curl --silent -Lo travis_after_all.py https://raw.github.com/pycontribs/travis_after_all/master/travis_after_all.py - - travis_wait python setup.py test +- export PACKAGE_NAME=$(python setup.py --name) +- export PACKAGE_VERSION=$(python setup.py --version) +- python setup.py --version +- tox --installpkg ./dist/*.whl --travis-after +# validates that the build source distribution is installable using the old easy_install +- pip uninstall -y $PACKAGE_NAME && easy_install ./dist/$PACKAGE_NAME-*.tar.gz after_success: - - python travis_after_all.py - - export $(cat .to_export_back) - - | - if [ "$BUILD_LEADER" = "YES" ]; then - if [ "$BUILD_AGGREGATE_STATUS" = "others_succeeded" ]; then - echo "All jobs succeeded! PUBLISHING..." - else - echo "Some jobs failed" - fi - fi - - coveralls - - python setup.py build_sphinx upload_docs release -after_failure: - - python travis_after_all.py - - export $(cat .to_export_back) - - | - if [ "$BUILD_LEADER" = "YES" ]; then - if [ "$BUILD_AGGREGATE_STATUS" = "others_failed" ]; then - echo "All jobs failed" - else - echo "Some jobs failed" - fi - fi -after_script: - - echo leader=$BUILD_LEADER status=$BUILD_AGGREGATE_STATUS -branches: - only: - - master +- coveralls +- bash <(curl -s https://codecov.io/bash) +- requires.io update-site -t ac3bbcca32ae03237a6aae2b02eb9411045489bb -r notifications: - hipchat: 7d72ba6ba0bf07248f17e0a6a1a899@DevOps + email: + - pycontribs@googlegroups.com + - sorin.sbarnea@gmail.com + deploy: - provider: pypi +- provider: releases + api_key: + secure: G19YtkGAX0aJ1oyd/7eRj1KYdsmAkjkfU2UISvsjh/68ec1+9qtPpN7BbkFYZYMjSx0BtS0SEEA7Vdl4F9DI9Zzqahbj7WzDLFe9/4aZKM/ztfKWR6CNAYaMazAKS5W7r9pPkBBDIIJ9zCqvV7FRzjewEpfTwFzwUdY+IpxEsAM= + file: + - dist/$PACKAGE_NAME-$PACKAGE_VERSION.tar.gz + - dist/$PACKAGE_NAME-$PACKAGE_VERSION-py2.py3-none-any.whl + - ChangeLog + skip_cleanup: true + on: + repo: pycontribs/tendo + tags: true + python: 2.7 + condition: $TOXENV != docs +- provider: pypi user: sorin password: - secure: "E0cjANF7SLBdYrsnWLK8X/xWznqkF0JrP/DVfDazPzUYH6ynFeneyofzNJQPLTLsqe1eKXhuUJ/Sbl+RHFB0ySo/j/7NfYd/9pm8hpUkGCvR09IwtvMLgWKp3k10NWab03o2GOkSJSrLvZofyZBGR40wwu2O9uXPCb2rvucCGbw=" - distributions: "bdist_wheel" - before_deploy: - - echo "before deploy..." - after_deploy: - - echo "after deploy..." + secure: E0cjANF7SLBdYrsnWLK8X/xWznqkF0JrP/DVfDazPzUYH6ynFeneyofzNJQPLTLsqe1eKXhuUJ/Sbl+RHFB0ySo/j/7NfYd/9pm8hpUkGCvR09IwtvMLgWKp3k10NWab03o2GOkSJSrLvZofyZBGR40wwu2O9uXPCb2rvucCGbw= + distributions: sdist bdist_wheel + skip_cleanup: true + on: + tags: true + python: 2.7 + condition: $TOXENV != docs + branch: master +- provider: pypi + server: https://testpypi.python.org/pypi + user: sorins + password: + secure: E0cjANF7SLBdYrsnWLK8X/xWznqkF0JrP/DVfDazPzUYH6ynFeneyofzNJQPLTLsqe1eKXhuUJ/Sbl+RHFB0ySo/j/7NfYd/9pm8hpUkGCvR09IwtvMLgWKp3k10NWab03o2GOkSJSrLvZofyZBGR40wwu2O9uXPCb2rvucCGbw= + distributions: sdist bdist_wheel + skip_cleanup: true + on: + tags: false + python: 2.7 + condition: $TOXENV != docs + branch: develop +env: + global: + - secure: fuXwQL+KHQ96XkAFl2uQc8eK8dAjrgkup46tck/UGjVpdv1PT/yHmBKrvpFjDa50ueGbtBwTdKAwhyAmYuiZCk2IYHzdvBylCZBBji2FSpaTM59CVwgkVT6tx3HHO83X0mEX6ih9TJvZD5XhX+YUjopnseRXRq3ey3JZJXWN4RM= + - secure: "pGQGM5YmHvOgaKihOyzb3k6bdqLQnZQ2OXO9QrfXlXwtop3zvZQi80Q+01l230x2psDWlwvqWTknAjAt1w463fYXPwpoSvKVCsLSSbjrf2l56nrDqnoir+n0CBy288+eIdaGEfzcxDiuULeKjlg08zrqjcjLjW0bDbBrlTXsb5U=" diff --git a/README.rst b/README.rst index bfff28e..dab12d4 100644 --- a/README.rst +++ b/README.rst @@ -2,18 +2,43 @@ tendo ====== -Tendo is a python module that adds basic functionality that is -not (yet) provided by Python. +Tendo is a python module that adds basic functionality that is +not (yet) provided by Python. + +.. image:: https://img.shields.io/pypi/v/tendo.svg + :target: https://pypi.python.org/pypi/tendo/ + +.. image:: https://img.shields.io/pypi/l/tendo.svg + :target: https://pypi.python.org/pypi/tendo/ + +.. image:: https://img.shields.io/pypi/wheel/tendo.svg + :target: https://pypi.python.org/pypi/tendo/ + +.. image:: https://img.shields.io/codeclimate/github/pycontribs/tendo.svg + :target: https://codeclimate.com/github/pycontribs/tendo + +------------ + +.. image:: https://readthedocs.org/projects/tendo/badge/?version=master + :target: http://tendo.readthedocs.io + +.. image:: https://api.travis-ci.org/pycontribs/tendo.svg?branch=master + :target: https://travis-ci.org/pycontribs/tendo + +.. image:: https://img.shields.io/bountysource/team/pycontribs/activity.svg + :target: https://www.bountysource.com/teams/pycontribs/issues?tracker_ids=3650997 + +.. image:: https://requires.io/github/pycontribs/tendo/requirements.svg?branch=master + :target: https://requires.io/github/pycontribs/tendo/requirements/?branch=master + :alt: Requirements Status -[![Build Status](https://drone.io/github.com/pycontribs/tendo/status.png)](https://drone.io/github.com/pycontribs/tendo/latest) -[![Build Status](https://travis-ci.org/pycontribs/tendo.svg?branch=master)](https://travis-ci.org/pycontribs/tendo) * [transparent Unicode support for text file operations (BOM detection)](https://tendo.readthedocs.org/en/latest/#module-tendo.singleton) * [console logging coloring](https://tendo.readthedocs.org/en/latest/#module-tendo.colorer) * enable you to use symlinks under windows -* [python tee implementation](https://tendo.readthedocs.org/en/latest/#module-tendo.colorer) for executing extenal programs and redirecting their output to both console/file) +* [python tee implementation](https://tendo.readthedocs.org/en/latest/#module-tendo.colorer) for executing external programs and redirecting their output to both console/file) * [improved execfile](https://tendo.readthedocs.org/en/latest/#module-tendo.execfile2) - + Documentation ------------------------------ Check: @@ -22,7 +47,7 @@ Check: Requirements and compatibility ------------------------------ -* python 2.5-3.2 +* python 2.7-3.6 * distribute (for installation) * tox for running tests @@ -37,4 +62,3 @@ TODO ---- * implement testing, see test frameworks http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy * implement all PEP8 recomandations - diff --git a/tox.ini b/tox.ini index f7a9f9c..9556822 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.3.1 -envlist = {py27,py35,py36}-{win,linux,darwin} +envlist = {py27,py34,py35,py36}-{win,linux,darwin} skip_missing_interpreters = true #addopts = --ignore=setup.py