From 01cd13070ff9770b5e1166b4e8639a1a42dfd80d Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Sun, 3 Jun 2018 17:44:36 +0100 Subject: [PATCH] Build and test system refresh - adopted tox - migrated to pbr (versioning) - moved module to its own folder - updated travis tests targets --- .gitignore | 7 ++++ .travis.yml | 56 +++++++++++++++++++++++++---- MANIFEST.in | 4 +++ __init__.py => crowd/__init__.py | 0 crowd.py => crowd/crowd.py | 0 doc/requirements.txt | 0 requirements.txt | 2 ++ setup.cfg | 60 ++++++++++++++++++++++++++++++++ setup.py | 40 +++++++-------------- test-requirements.txt | 3 ++ tests/__init__.py | 0 tests/crowdserverstub.py | 10 +++--- tox.ini | 50 ++++++++++++++++++++++++++ 13 files changed, 194 insertions(+), 38 deletions(-) create mode 100644 MANIFEST.in rename __init__.py => crowd/__init__.py (100%) rename crowd.py => crowd/crowd.py (100%) create mode 100644 doc/requirements.txt create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 test-requirements.txt create mode 100644 tests/__init__.py create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 0d20b64..9570ad4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ *.pyc +/.eggs +/.tox +/build +/AUTHORS +/ChangeLog +/dist +/doc/_build diff --git a/.travis.yml b/.travis.yml index 35aaa9a..42f1bfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,52 @@ language: python -python: - - "3.3" - - "2.7" +cache: +- pip +sudo: false +os: +- linux +stages: +- spell +- docs +- test +- deploy +script: +notifications: + email: + - pycontribs@googlegroups.com + - sorin.sbarnea@gmail.com +jobs: + include: + + - stage: docs + script: pip install -q tox-travis && python -m tox + python: 2.7 + env: TOXENV=docs + - stage: test + script: pip install -q tox-travis && python -m tox + python: 2.7 + env: TOXENV=py27 + after_success: + - bash <(curl -s https://codecov.io/bash) -e TOX_ENV + - requires.io update-site -t ac3bbcca32ae03237a6aae2b02eb9411045489bb -r + - stage: test + script: pip install -q tox-travis && python -m tox + python: 3.4 + env: TOXENV=py34 + after_success: + - bash <(curl -s https://codecov.io/bash) -e TOX_ENV + - stage: test + script: pip install -q tox-travis && python -m tox + python: 3.5 + env: TOXENV=py35 + after_success: + - bash <(curl -s https://codecov.io/bash) -e TOX_ENV + - stage: test + script: pip install -q tox-travis && python -m tox + python: 3.6 + env: TOXENV=py36 PYTHON='3.6' PYENV_VERSION='system' + after_success: + - bash <(curl -s https://codecov.io/bash) -e TOX_ENV install: - - pip install . - - pip install nose -script: python tests/unittests.py + - tox +script: tox + diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..b5750e5 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include LICENSE README.rst +include requirements.txt +include test-requirements.txt +prune tests diff --git a/__init__.py b/crowd/__init__.py similarity index 100% rename from __init__.py rename to crowd/__init__.py diff --git a/crowd.py b/crowd/crowd.py similarity index 100% rename from crowd.py rename to crowd/crowd.py diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0d8fbe7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +requests>=2.10.0 +lxml diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..4ce2d3f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,60 @@ +[metadata] +name = crowd +author = Alexander Else +author-email = aelse@else.id.au +maintainer = Sorin Sbarnea +maintainer-email = sorin.sbarnea@gmail.com +summary = A python client to the Atlassian Crowd REST API +description-file = + README.rst +# Do not include ChangeLog in description-file due to multiple reasons: +# - Unicode chars, see https://github.com/pycontribs/jira/issues/512 +# - Breaks ability to perform `python setup.py install` + +home-page = https://github.com/pycontribs/crowd +license = BSD +classifier = + Development Status :: 4 - Beta + 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.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 +keywords = + api + atlassian + crowd + rest + web + +[files] +packages = + crowd + +[egg_info] +egg_base = . + +[aliases] +test=pytest + +[bdist_wheel] +universal = 1 + +[build_sphinx] +source-dir = doc +build-dir = doc/build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/build/html + +[pbr] +warnerrors = true diff --git a/setup.py b/setup.py index aa11d4c..c49a24d 100644 --- a/setup.py +++ b/setup.py @@ -1,31 +1,15 @@ -from setuptools import setup -import codecs -import os.path -__dir__ = os.path.dirname(os.path.abspath(__file__)) +#!/usr/bin/env python +import setuptools -setup( - name='Crowd', - license='BSD', - py_modules=['crowd'], - version='1.0.1', - install_requires=['requests', 'lxml'], +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass - description='A python client to the Atlassian Crowd REST API', - long_description=codecs.open(os.path.join(__dir__, 'README.rst'), - encoding='utf-8').read(), - author='Alexander Else', - author_email='aelse@else.id.au', - url='https://github.com/pycontribs/python-crowd', - - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Programming Language :: Python", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.3", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: System :: Systems Administration :: Authentication/Directory", - ] -) +setuptools.setup( + setup_requires=['pbr>=3.0.0', 'setuptools>=17.1', 'pytest-runner', 'sphinx>=1.6.5'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..2d21c7c --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,3 @@ +hacking>=1.1.0 +pytest>=3.0.0 +pip>=10.0.1 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/crowdserverstub.py b/tests/crowdserverstub.py index eee673b..259a74e 100644 --- a/tests/crowdserverstub.py +++ b/tests/crowdserverstub.py @@ -18,10 +18,12 @@ import re, sys -try: - from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler # Py27 -except ImportError: - from http.server import HTTPServer, BaseHTTPRequestHandler # Py3k +try: # Py27 + from BaseHTTPServer import HTTPServer + from BaseHTTPServer import BaseHTTPRequestHandler +except ImportError: # Py3k + from http.server import HTTPServer + from http.server importBaseHTTPRequestHandler try: from urllib2 import urlparse # Py27 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..480c1cd --- /dev/null +++ b/tox.ini @@ -0,0 +1,50 @@ +[tox] +minversion = 2.3.1 +envlist = py27,py34,py35,py36,docs +skip_missing_interpreters = true + +[testenv:docs] +basepython=python +changedir=doc +deps = + -rrequirements.txt + -rdoc/requirements.txt +commands= + make html + +[testenv] +usedevelop = True +deps = + -rrequirements.txt + -rtest-requirements.txt +sitepackages=False +commands= + python -m pip check + python -m flake8 + python -m pytest tests/*.py {posargs} +passenv = + CI + CI_JIRA_* + TRAVIS + TRAVIS_* + XDG_CACHE_HOME + USER + PIP* + PYTHON* +envars = + PIP_DISABLE_PIP_VERSON_CHECK=1 +whitelist_externals = + bash + make + +[flake8] +# Following checks are ignored on purpose. +# +# E251 unexpected spaces around keyword / parameter equals +# reason: no improvement in readability +ignore = E251,E302,E401 +# H904 Delay string interpolations at logging calls. +enable-extensions = H106,H203,H904 +exclude = .git,.venv,.tox,dist,tools,doc/ext,*egg,build,doc/conf.py +max-complexity=30 +max-line-length=160