Skip to content

Commit 64ac596

Browse files
committed
Start of v0.4.5: adopting git flow and flake8
Signed-off-by: Sorin Sbarnea <[email protected]>
1 parent e8fca42 commit 64ac596

21 files changed

+244
-101
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ dist
55
.tox
66
~*.*
77
build/
8+
.idea/inspectionProfiles/
9+
.python-version
10+
.vscode

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/atlassian-ide-plugin.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.travis.yml

+19-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ os:
44
- linux
55
python:
66
- '2.7'
7-
- '3.3'
87
- '3.4'
8+
- '3.5'
99
install:
10-
- pip -q install coveralls six autopep8
11-
script:
10+
- pip -q install -r requirements.txt
11+
- pip -q install -r requirements-dev.txt
12+
script:
1213
- 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 prerelease test
1314
- export PACKAGE_VERSION=$(python -c "from wstools.version import __version__; print(__version__)")
1415
after_success:
@@ -40,20 +41,34 @@ after_script:
4041
branches:
4142
only:
4243
- master
44+
- develop
4345
before_deploy:
4446
- echo "before deploy..."
4547
deploy:
4648
- provider: releases
4749
api_key:
4850
- secure: "gr9iOcQjdoAyUAim6FWKzJI9MBaJo9XKfGQGu7wdPXUFhg80Rp6GLJsowP+aU94NjXM1UQlVHDAy627WtjBlLH2SvmVEIIr7+UKBopBYuXG5jJ1m3wOZE+4f1Pqe9bqFc1DxgucqE8qF0sC24fIbNM2ToeyYrxrS6RoL2gRrX2I="
49-
file: "dist/jira-$PACKAGE_VERSION.tar.gz"
51+
file: "dist/wstools-$PACKAGE_VERSION.tar.gz"
5052
skip_cleanup: true
5153
on:
54+
branch: master
5255
condition: "$BUILD_LEADER = YES"
56+
tags: true
5357
- provider: pypi
5458
user: sorin
5559
password:
5660
secure: "E0cjANF7SLBdYrsnWLK8X/xWznqkF0JrP/DVfDazPzUYH6ynFeneyofzNJQPLTLsqe1eKXhuUJ/Sbl+RHFB0ySo/j/7NfYd/9pm8hpUkGCvR09IwtvMLgWKp3k10NWab03o2GOkSJSrLvZofyZBGR40wwu2O9uXPCb2rvucCGbw="
5761
distributions: "sdist bdist_wheel"
5862
on:
63+
branch: master
64+
condition: "$BUILD_LEADER = YES"
65+
- provider: pypi
66+
server: https://testpypi.python.org/pypi
67+
user: sorins
68+
password:
69+
secure: "E0cjANF7SLBdYrsnWLK8X/xWznqkF0JrP/DVfDazPzUYH6ynFeneyofzNJQPLTLsqe1eKXhuUJ/Sbl+RHFB0ySo/j/7NfYd/9pm8hpUkGCvR09IwtvMLgWKp3k10NWab03o2GOkSJSrLvZofyZBGR40wwu2O9uXPCb2rvucCGbw="
70+
distributions: "sdist bdist_wheel"
71+
on:
72+
branch: develop
73+
tags: false
5974
condition: "$BUILD_LEADER = YES"

Makefile

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
all: clean flake8 test pypi docs tag release
2+
.PHONY: all docs
3+
4+
PACKAGE_NAME=$(shell python setup.py --name)
5+
PYTHON_VERSION=$(shell python -c "import sys; print('py%s%s' % sys.version_info[0:2])")
6+
PYTHON_PATH=$(shell which python)
7+
PLATFORM=$(shell uname -s | awk '{print tolower($0)}')
8+
DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
9+
PYENV_HOME := $(DIR)/.tox/$(PYTHON_VERSION)-$(PLATFORM)/
10+
11+
clean:
12+
find . -name "*.pyc" -delete
13+
14+
package:
15+
python setup.py sdist bdist_wheel build_sphinx
16+
17+
install: prepare
18+
$(PYENV_HOME)/bin/python setup.py install
19+
20+
uninstall:
21+
$(PYENV_HOME)/bin/pip uninstall -y $(PACKAGE_NAME)
22+
23+
venv: $(PYENV_HOME)/bin/activate
24+
25+
# virtual environment depends on requriements files
26+
$(PYENV_HOME)/bin/activate: requirements*.txt
27+
@echo "INFO: (Re)creating virtual environment..."
28+
test -d $(PYENV_HOME)/bin/activate || virtualenv --python=$(PYTHON_PATH) --system-site-packages $(PYENV_HOME)
29+
$(PYENV_HOME)/bin/pip install -q -r requirements.txt
30+
$(PYENV_HOME)/bin/pip install -q -r requirements-dev.txt
31+
touch $(PYENV_HOME)/bin/activate
32+
33+
prepare: venv
34+
@echo "INFO: === Prearing to run for package:$(PACKAGE_NAME) platform:$(PLATFORM) py:$(PYTHON_VERSION) dir:$(DIR) ==="
35+
36+
testspace:
37+
${HOME}/testspace/testspace publish build/results.xml
38+
39+
flake8:
40+
$(PYENV_HOME)/bin/python -m flake8
41+
$(PYENV_HOME)/bin/python -m flake8 --install-hook 2>/dev/null || true
42+
43+
test: prepare flake8
44+
$(PYENV_HOME)/bin/python setup.py test
45+
46+
test-all:
47+
# tox should not run inside virtualenv because it does create and use multiple virtualenvs
48+
pip install -q tox tox-pyenv
49+
python -m tox --skip-missing-interpreters true
50+
51+
pypi:
52+
$(PYENV_HOME)/bin/python setup.py check --restructuredtext --strict
53+
$(PYENV_HOME)/bin/python setup.py sdist bdist_wheel upload
54+
55+
pypitest:
56+
$(PYENV_HOME)/bin/python setup.py check --restructuredtext --strict
57+
$(PYENV_HOME)/bin/python setup.py sdist bdist_wheel upload -r pypitest
58+
59+
tag:
60+
bumpversion minor
61+
git push origin master
62+
git push --tags
63+
64+
release:
65+
tag
66+
pypi
67+
web

release.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VERSION=$(python -c "from wstools.version import __version__ ; print __version__
55
echo Preparing to release version $VERSION
66

77
echo === Chechink that all changes are commited and pushed ===
8-
git pull -u
8+
git pull
99

1010
git diff
1111
# Disallow unstaged changes in the working tree

requirements-dev.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
autopep8
2+
coverage
3+
coveralls
4+
flake8
5+
flake8-docstrings>=0.2.8
6+
flake8-pep257>=1.0.5
7+
nose
8+
pytest
9+
pytest-flake8

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
six

setup.cfg

+8-19
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ upload-dir = docs/build/html
1515
[pytest]
1616
norecursedirs = . .svn jira _build tmp* lib/third lib *.egg bin distutils build docs demo
1717
python_files = *.py
18-
addopts = -p no:xdist --ignore=setup.py --tb=long -rsxX -v --maxfail=10 --pep8 tests
18+
addopts = -p no:xdist --ignore=setup.py --tb=long -rsxX -v --maxfail=10 --flake8 tests
1919
timeout=60
2020
# --maxfail=2 -n4
2121
# -n4 runs up to 4 parallel procs
@@ -25,22 +25,11 @@ timeout=60
2525
# these are important for distributed testing, to speedup their execution we minimize what we sync
2626
rsyncdirs = . jira demo docs
2727
rsyncignore = .hg .git
28-
pep8ignore = E501 E265 E127 E901 E128 E402
28+
flake8-max-line-length = 99
29+
flake8-ignore = D D100 E402
2930

30-
[pep8]
31-
exclude=build,lib,.tox,third,*.egg,docs,packages
32-
;filename=
33-
;select
34-
ignore=E501,E265,E402
35-
max-line-length=1024
36-
count=1
37-
;format
38-
;quiet
39-
;show-pep8
40-
;show-source
41-
statistics=1
42-
;verbose=1
43-
44-
;PEP8_OPTS="--filename=*.py --exclude=lib --ignore=E501 scripts"
45-
;pep8 $PEP8_OPTS --show-source --repeat
46-
;pep8 --statistics -qq $PEP8_OPTS
31+
[flake8]
32+
max-line-length=160
33+
exclude=build
34+
statistics=yes
35+
ignore = D,E402

setup.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def initialize_options(self):
3737

3838
# if we have pytest-cache module we enable the test failures first mode
3939
try:
40-
import pytest_cache
40+
import pytest_cache # noqa
4141
self.pytest_args.append("--ff")
4242
except ImportError:
4343
pass
@@ -47,7 +47,7 @@ def initialize_options(self):
4747
# when run manually we enable fail fast
4848
self.pytest_args.append("--maxfail=1")
4949
try:
50-
import coveralls
50+
import coveralls # noqa
5151
self.pytest_args.append("--cov=%s" % NAME)
5252
self.pytest_args.extend(["--cov-report", "term"])
5353
self.pytest_args.extend(["--cov-report", "xml"])
@@ -63,14 +63,14 @@ def finalize_options(self):
6363
def run_tests(self):
6464
# before running tests we need to run autopep8
6565
try:
66-
r = subprocess.check_call(
66+
subprocess.check_call(
6767
"python -m autopep8 -r --in-place wstools/ tests/",
6868
shell=True)
6969
except subprocess.CalledProcessError:
7070
logging.getLogger().warn('autopep8 is not installed so '
7171
'it will not be run')
7272
# import here, cause outside the eggs aren't loaded
73-
import pytest
73+
import pytest # noqa
7474
errno = pytest.main(self.pytest_args)
7575
sys.exit(errno)
7676

@@ -98,7 +98,8 @@ def run(self):
9898
released_version = data['info']['version']
9999
if released_version == __version__:
100100
raise RuntimeError(
101-
"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)
101+
"This version was already released, remove it from PyPi if you want to release it"
102+
" again or increase the version number. http://pypi.python.org/pypi/%s/" % NAME)
102103
elif released_version > __version__:
103104
raise RuntimeError("Cannot release a version (%s) smaller than the PyPI current release (%s)." % (
104105
__version__, released_version))
@@ -163,8 +164,8 @@ def run(self):
163164
'License :: OSI Approved :: BSD License',
164165
'Operating System :: OS Independent',
165166
'Topic :: Software Development :: Libraries :: Python Modules',
166-
'Programming Language :: Python :: 3.3',
167167
'Programming Language :: Python :: 3.4',
168+
'Programming Language :: Python :: 3.5',
168169
'Topic :: Internet :: WWW/HTTP',
169170
],
170171
)

tests/test_wsdl.py

100644100755
+5-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
inspect.currentframe()))[0], ".."))
1414
if cmd_folder not in sys.path:
1515
sys.path.insert(0, cmd_folder)
16-
from wstools.Utility import DOM
17-
from wstools.WSDLTools import WSDLReader
18-
from wstools.TimeoutSocket import TimeoutError
16+
from wstools.Utility import DOM # noqa E402
17+
from wstools.WSDLTools import WSDLReader # noqa E402
18+
from wstools.TimeoutSocket import TimeoutError # noqa E402
1919
try:
2020
import configparser
2121
except:
@@ -49,7 +49,7 @@ def setUp(self):
4949
self.path = nameGenerator.__next__()
5050
else:
5151
self.path = nameGenerator.next()
52-
#print(self.path)
52+
# print(self.path)
5353
sys.stdout.flush()
5454

5555
def __str__(self):
@@ -67,7 +67,7 @@ def checkWSDLCollection(self, tag_name, component, key='name'):
6767
nspname = DOM.GetWSDLUri(version)
6868
for node in DOM.getElements(definition, tag_name, nspname):
6969
name = DOM.getAttr(node, key)
70-
comp = component[name]
70+
comp = component[name] # noqa F841
7171
self.failUnlessEqual(eval('comp.%s' % key), name)
7272

7373
def checkXSDCollection(self, tag_name, component, node, key='name'):

tox.ini

+15-20
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
[tox]
2-
minversion = 1.3
3-
envlist = py27,py34,flake8
2+
minversion = 2.3.1
3+
envlist = {py27,py34,py35}-{win,linux,darwin}
4+
addopts = --ignore=setup.py
5+
skip_missing_interpreters = true
6+
tox_pyenv_fallback=True
47

58
[testenv]
6-
deps=
7-
nose
8-
coveralls
9-
coverage
10-
commands=
11-
nosetests --with-coverage --cover-package=wstools
12-
bash -c "coveralls || true"
13-
whitelist_externals=bash
14-
15-
[testenv:py27]
16-
17-
[testenv:py33]
9+
sitepackages=True
10+
platform =
11+
win: windows
12+
linux: linux
13+
darwin: darwin
1814

19-
[testenv:py34]
20-
21-
[testenv:flake8]
22-
basepython=python2.7
23-
deps=flake8
24-
commands=flake8 wstools/
15+
deps=
16+
-rrequirements.txt
17+
-rrequirements-dev.txt
2518

19+
commands=
20+
python -m py.test --cov-report xml

0 commit comments

Comments
 (0)