Skip to content

Commit 91da00a

Browse files
committed
Merge branch 'release/0.8.0'
2 parents 76e7538 + 4c602f7 commit 91da00a

19 files changed

Lines changed: 791 additions & 92 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
MANIFEST
2+
.cache
23

34
*.py[cod]
45

.travis.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
language: python
2-
32
services:
4-
- redis-server
5-
3+
- redis-server
64
python:
7-
- "2.7"
8-
- "3.2"
9-
- "3.3"
10-
# command to install dependencies
5+
- '2.7'
6+
- '3.3'
7+
- '3.4'
8+
- '3.5'
119
install:
12-
- "pip install httmock"
13-
- "pip install freezegun"
14-
- "pip install coveralls"
15-
- "python setup.py install"
16-
# command to run tests
17-
script:
18-
nosetests --with-coverage --cover-package=snowplow_tracker
19-
after_success:
20-
coveralls
10+
- pip install -r requirements-test.txt
11+
- pip install release-manager
12+
- pip install -e .
13+
script: pytest --cov=snowplow_tracker
14+
after_success: coveralls
15+
deploy:
16+
skip_cleanup: true
17+
provider: script
18+
script: ./.travis/deploy.py
19+
on:
20+
tags: true
21+
python: '2.7'
22+
env:
23+
global:
24+
secure: SnavmHqH0sB6xmyqSiN7HscdVpNr6pk+bWs/8Oin2FZ0Kp52V9vIQf1A9TjDQY67P3YgUsMFJKWmCIpbsWFUl65Nos2LXGK6oTe9mt7O5fsR6BsI1IiiZoC8wNZwmaUjqyJa3/Y5KUYvWXlTLYChbyiqxcTCtkBDnLaiFFDOEis=

.travis/deploy.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env python
2+
3+
4+
import os
5+
from os.path import expanduser
6+
import sys
7+
8+
from release_manager import utils, logger
9+
10+
from snowplow_tracker import _version
11+
12+
# --- Constants
13+
14+
15+
HOME = expanduser("~")
16+
DEFAULT_SERVER = 'https://pypi.python.org/pypi'
17+
DEFAULT_REPO = 'pypi'
18+
PYPIRC_FILE = '%s/.pypirc' % HOME
19+
20+
if 'TRAVIS_TAG' in os.environ:
21+
TRAVIS_TAG = os.environ.get('TRAVIS_TAG')
22+
else:
23+
sys.exit("Environment variable TRAVIS_TAG is unavailable")
24+
25+
if 'TRAVIS_BUILD_DIR' in os.environ:
26+
TRAVIS_BUILD_DIR = os.environ.get('TRAVIS_BUILD_DIR')
27+
else:
28+
sys.exit("Environment variable TRAVIS_BUILD_DIR is unavailable")
29+
30+
if 'PYPI_PASSWORD' in os.environ:
31+
PYPI_PASSWORD = os.environ.get('PYPI_PASSWORD')
32+
else:
33+
sys.exit("Environment variable PYPI_PASSWORD is unavailable")
34+
35+
36+
# --- Helpers
37+
38+
39+
def check_version():
40+
"""Fail deploy if tag version doesn't match version"""
41+
logger.log_start("Checking versions")
42+
if TRAVIS_TAG != _version.__build_version__:
43+
sys.exit("Version extracted from project doesn't match the TRAVIS_TAG variable. TRAVIS_TAG: {}, __build_version__: {}!".format(TRAVIS_TAG, _version.__build_version__))
44+
else:
45+
logger.log_info("Versions match!")
46+
logger.log_done()
47+
48+
49+
def write_config():
50+
"""Writes an array of lines to the PyPi config file"""
51+
logger.log_start("Writing ~/.pypirc file")
52+
lines = [
53+
'[distutils]\n',
54+
'index-servers =\n',
55+
' %s\n' % DEFAULT_REPO,
56+
'\n',
57+
'[%s]\n' % DEFAULT_REPO,
58+
'repository=%s\n' % DEFAULT_SERVER,
59+
'username=snowplow\n',
60+
'password=%s\n' % PYPI_PASSWORD
61+
]
62+
63+
with open(PYPIRC_FILE, 'w') as outfile:
64+
for line in lines:
65+
outfile.write(line)
66+
logger.log_info("The ~/.pypirc file has been written!")
67+
logger.log_done()
68+
69+
70+
def deploy_to_pypi():
71+
"""Deploys the release to PyPi"""
72+
logger.log_start("Deploying to PyPi")
73+
os.chdir(TRAVIS_BUILD_DIR)
74+
utils.execute("python setup.py register -r pypi", shell=True)
75+
utils.execute("python setup.py sdist upload -r pypi", shell=True)
76+
logger.log_info("Module deployed to PyPi!")
77+
logger.log_done()
78+
79+
80+
# --- Main
81+
82+
83+
if __name__ == "__main__":
84+
logger.log_header("Deploying snowplow-python-tracker to PyPi")
85+
check_version()
86+
write_config()
87+
deploy_to_pypi()
88+
logger.log_footer("Deployed version %s to PyPi!" % TRAVIS_TAG)

CHANGES.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
Version 0.8.0 (2016-09-xx)
2+
--------------------------
3+
Add byte_limit to Emitter (#170)
4+
Add support for dvce_sent_tstamp (#159)
5+
Use SelfDescribingJson class to build payload_data JSON (#141)
6+
Add ability to automatically send all events in buffer at a regular time interval (#114)
7+
Add support for attaching true timestamp for events (#161)
8+
Use exact dependencies versions and remove requirements.txt (#175)
9+
Add missing dependencies (#174)
10+
Remove Python 3.2 from travis testing (#173)
11+
Add missing classifiers to setup.py (#148)
12+
Add additional supported platforms to Subject (#172)
13+
Add missing tracker events (#165)
14+
Add support for Python 3.4 and 3.5 (#169)
15+
Add `track_self_describing_event()` method (#160)
16+
117
Version 0.7.2 (2015-08-16)
218
--------------------------
319
Corrected contract typo in the docstring of AsyncEmitter's constructor (#147)

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ Assuming Git, Vagrant_ and VirtualBox_ are installed:
5656
host$ git clone git@github.com:snowplow/snowplow-python-tracker.git
5757
host$ vagrant up && vagrant ssh
5858
guest$ cd /vagrant
59-
guest$ ./run-tests.sh
59+
guest$ ./run-tests.sh deploy
60+
guest$ ./run-tests.sh test
6061

6162
.. _Vagrant: http://docs.vagrantup.com/v2/installation/index.html
6263
.. _VirtualBox: https://www.virtualbox.org/wiki/Downloads

requirements-test.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pytest==3.0.2
2+
httmock==1.2.5
3+
freezegun==0.3.7
4+
pytest-cov==2.3.1
5+
coveralls==1.1
6+

requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

run-tests.sh

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/bin/sh
1+
#!/bin/bash
2+
23
# Run the Snowplow Tracker test suite.
34

45
# Quit on failure
@@ -9,9 +10,81 @@ cd $(dirname $0)
910

1011
# pytest because it has a neat output
1112

12-
# Test against Python 3
13-
~/snowplow-python-3.3-tracker-environment/bin/python3.3 -m pytest -s
13+
export PATH="~/.pyenv/bin:$PATH"
14+
eval "$(pyenv init -)"
15+
eval "$(pyenv virtualenv-init -)"
16+
17+
function deploy {
18+
19+
# pyenv install 2.7.12
20+
if [ ! -f ~/.pyenv/versions/tracker27 ]; then
21+
pyenv virtualenv 2.7.12 tracker27
22+
pyenv activate tracker27
23+
pip install -r requirements.txt
24+
pip install -r requirements-test.txt
25+
source deactivate
26+
fi
27+
28+
# pyenv install 3.3.6
29+
if [ ! -f ~/.pyenv/versions/tracker33 ]; then
30+
pyenv virtualenv 3.3.6 tracker33
31+
pyenv activate tracker33
32+
pip install -r requirements.txt
33+
pip install -r requirements-test.txt
34+
source deactivate
35+
fi
36+
37+
# pyenv install 3.4.5
38+
if [ ! -f ~/.pyenv/versions/tracker34 ]; then
39+
pyenv virtualenv 3.4.5 tracker34
40+
pyenv activate tracker34
41+
pip install -r requirements.txt
42+
pip install -r requirements-test.txt
43+
source deactivate
44+
fi
45+
46+
# pyenv install 3.5.2
47+
if [ ! -f ~/.pyenv/versions/tracker35 ]; then
48+
pyenv virtualenv 3.5.2 tracker35
49+
pyenv activate tracker35
50+
pip install -r requirements.txt
51+
pip install -r requirements-test.txt
52+
source deactivate
53+
fi
54+
55+
}
56+
57+
58+
function run_tests {
59+
60+
pyenv activate tracker27
61+
pytest -s
62+
source deactivate
63+
64+
pyenv activate tracker33
65+
pytest
66+
source deactivate
67+
68+
pyenv activate tracker34
69+
pytest
70+
source deactivate
71+
72+
pyenv activate tracker35
73+
pytest
74+
source deactivate
75+
}
76+
77+
78+
case "$1" in
1479

15-
# Test against Python 2
16-
~/snowplow-python-2.7-tracker-environment/bin/python2.7 -m pytest -s
80+
"deploy") echo "Deploying python environments. This can take few minutes"
81+
deploy
82+
;;
83+
"test") echo "Running tests"
84+
run_tests
85+
;;
86+
*) echo "Unknown subcommand. Specify deploy or test"
87+
exit 1
88+
;;
1789

90+
esac

setup.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,26 @@
6161
long_description=open('README.rst').read(),
6262

6363
classifiers=[
64-
"Development Status :: 4 - Beta",
64+
"Development Status :: 5 - Production/Stable",
6565
"Intended Audience :: Developers",
6666
"License :: OSI Approved :: Apache Software License",
67-
"Programming Language :: Python"
67+
"Programming Language :: Python",
68+
"Programming Language :: Python :: 2",
69+
"Programming Language :: Python :: 2.7",
70+
"Programming Language :: Python :: 3",
71+
"Programming Language :: Python :: 3.3",
72+
"Programming Language :: Python :: 3.4",
73+
"Programming Language :: Python :: 3.5",
74+
"Operating System :: OS Independent",
6875
],
6976

70-
install_requires = [
71-
"requests",
72-
"pycontracts",
73-
"celery",
74-
"gevent",
75-
"redis"
77+
install_requires=[
78+
"greenlet==0.4.10",
79+
"requests==2.2.1",
80+
"pycontracts==1.7.6",
81+
"celery==3.1.11",
82+
"gevent==1.0.2",
83+
"redis==2.9.1",
84+
"six==1.9.0"
7685
],
7786
)

snowplow_tracker/_version.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
language governing permissions and limitations there under.
1616
1717
Authors: Anuj More, Alex Dean, Fred Blundun
18-
Copyright: Copyright (c) 2013-2014 Snowplow Analytics Ltd
18+
Copyright: Copyright (c) 2013-2016 Snowplow Analytics Ltd
1919
License: Apache License Version 2.0
2020
"""
2121

2222

23-
__version_info__ = (0, 7, 2)
23+
__version_info__ = (0, 8, 0)
2424
__version__ = ".".join(str(x) for x in __version_info__)
25+
__build_version__ = __version__ + ''

0 commit comments

Comments
 (0)