From 9fb7c2fde3835841298005016a029d5772f20403 Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Fri, 19 Feb 2016 23:15:42 +0100 Subject: [PATCH 1/8] Add tests dir and one test --- tests/test_transactions.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/test_transactions.py diff --git a/tests/test_transactions.py b/tests/test_transactions.py new file mode 100644 index 0000000..b3cc3cd --- /dev/null +++ b/tests/test_transactions.py @@ -0,0 +1,8 @@ +def test_init_transactions_class_with_defaults(): + from transactions import Transactions + from transactions.services.blockrservice import BitcoinBlockrService + trxs = Transactions() + assert trxs.testnet is False + assert isinstance(trxs._service, BitcoinBlockrService) + assert trxs._min_tx_fee == trxs._service._min_transaction_fee + assert trxs._dust == trxs._service._min_dust From 4a3bdbb65ba14d6391886b9e9fa0444fc5e0bb8c Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Fri, 19 Feb 2016 23:16:29 +0100 Subject: [PATCH 2/8] Add dockerfile and docker-compose file --- Dockerfile | 13 +++++++++++++ docker-compose.yml | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7803cb6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:2.7 + +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +COPY requirements.txt /usr/src/app/ +RUN pip install --upgrade pip + +COPY . /usr/src/app + +RUN pip install -e .[dev] + +CMD ["py.test", "-v", "tests/"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..23ce1f0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +trxs: + build: . + volumes: + - ./transactions:/usr/src/app/transactions + - ./tests:/usr/src/app/tests + - ./setup.py:/usr/src/app/setup.py + command: py.test -v From 359ca5c1791510dbd5a5c88f2d25042195722718 Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Fri, 19 Feb 2016 23:46:54 +0100 Subject: [PATCH 3/8] Update setup.py --- setup.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d33abca..4c30d89 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,66 @@ +""" +transactions: Bitcoin for Humans + +transactions is a small python library to easily create and push transactions +to the bitcoin network. + +More information at https://github.com/ascribe/transactions + +""" from setuptools import setup +install_requires = [ + 'pybitcointools==1.1.15', + 'pycoin==0.52', + 'requests==2.7.0', +] + +tests_require = [ + 'pytest', + 'coverage', + 'pep8', + 'pyflakes', + 'pylint', + 'pytest', + 'pytest-cov', +] + +dev_require = [ + 'ipdb', + 'ipython', +] + +docs_require = [ + 'Sphinx>=1.3.5', + 'sphinxcontrib-napoleon>=0.4.4', +] + setup( name='transactions', version='0.1', url='https://github.com/ascribe/transactions', - license='', + license='Apache Software License', author='Rodolphe Marques', author_email='rodolphe@ascribe.io', packages=['transactions', 'transactions.services'], - description='transactions: Bitcoin for Humans' + description='transactions: Bitcoin for Humans', + long_description=__doc__, + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'Natural Language :: English', + 'License :: OSI Approved :: Apache Software License', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Topic :: Software Development', + ], + install_requires=install_requires, + setup_requires=['pytest-runner'], + tests_require=tests_require, + extras_require={ + 'test': tests_require, + 'dev': dev_require + tests_require + docs_require, + 'docs': docs_require, + }, ) From 7797594327bd3dc8d398968ad48090e331164091 Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Fri, 19 Feb 2016 23:47:47 +0100 Subject: [PATCH 4/8] Add setup.cfg --- setup.cfg | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..0eb958c --- /dev/null +++ b/setup.cfg @@ -0,0 +1,6 @@ +[aliases] +test=pytest + +[coverage:run] +source = . +omit = *test* From d70e4dda5a13d465e5e7e72a72fde3d747590cc6 Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Sat, 20 Feb 2016 03:07:05 +0100 Subject: [PATCH 5/8] Add test coverage and ci support --- .travis.yml | 6 ++++++ docker-compose.yml | 2 ++ pytest.ini | 2 ++ setup.cfg | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .travis.yml create mode 100644 pytest.ini diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..63f23bc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: python +python: 2.7 +install: pip install -e .[test] +before_install: pip install codecov +script: py.test -v --cov +after_success: codecov diff --git a/docker-compose.yml b/docker-compose.yml index 23ce1f0..bd40e61 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,5 +3,7 @@ trxs: volumes: - ./transactions:/usr/src/app/transactions - ./tests:/usr/src/app/tests + - ./pytest.ini:/usr/src/app/pytest.ini + - ./setup.cfg:/usr/src/app/setup.cfg - ./setup.py:/usr/src/app/setup.py command: py.test -v diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..5ee6477 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +testpaths = tests diff --git a/setup.cfg b/setup.cfg index 0eb958c..c077ace 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,5 +2,5 @@ test=pytest [coverage:run] -source = . +source = transactions omit = *test* From 30cd47ab231b81812d6514c6144b8adfdcde3302 Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Mon, 22 Feb 2016 11:02:06 +0100 Subject: [PATCH 6/8] Add pypi and travis badges --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8e5cd92..f27f6b7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # transactions: Bitcoin for Humans + +[![PyPI](https://img.shields.io/pypi/v/transactions.svg)](https://pypi.python.org/pypi/transactions) +[![Travis](https://img.shields.io/travis/ascribe/transactions.svg)](https://travis-ci.org/ascribe/transactions) + transactions is a small python library to easily create and push transactions to the bitcoin network. ## Install From 7d7ac5c11fdf2ed135b815a02f070ea6c7fe597d Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Mon, 22 Feb 2016 22:18:51 +0100 Subject: [PATCH 7/8] Put version in __init__.py and get it from there --- setup.py | 24 +++++++++++++++++++++++- transactions/__init__.py | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4c30d89..af03e1a 100644 --- a/setup.py +++ b/setup.py @@ -7,8 +7,30 @@ More information at https://github.com/ascribe/transactions """ +import io +import os +import re + from setuptools import setup + +def read(*names, **kwargs): + with io.open( + os.path.join(os.path.dirname(__file__), *names), + encoding=kwargs.get('encoding', 'utf8') + ) as fp: + return fp.read() + + +def find_version(*file_paths): + version_file = read(*file_paths) + version_match = re.search( + r'^__version__ = [\'"]([^\'"]*)[\'"]', version_file, re.M) + if version_match: + return version_match.group(1) + raise RuntimeError('Unable to find version string.') + + install_requires = [ 'pybitcointools==1.1.15', 'pycoin==0.52', @@ -37,7 +59,7 @@ setup( name='transactions', - version='0.1', + version=find_version('transactions', '__init__.py'), url='https://github.com/ascribe/transactions', license='Apache Software License', author='Rodolphe Marques', diff --git a/transactions/__init__.py b/transactions/__init__.py index eb1dc94..eddf026 100644 --- a/transactions/__init__.py +++ b/transactions/__init__.py @@ -1 +1,4 @@ from transactions import Transactions + + +__version__ = '0.1.0' From 9230c3f268274b09147e6e816cb7571f72786d1f Mon Sep 17 00:00:00 2001 From: Sylvain Bellemare Date: Mon, 22 Feb 2016 22:33:13 +0100 Subject: [PATCH 8/8] Add noqa marker for flake8 --- transactions/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transactions/__init__.py b/transactions/__init__.py index eddf026..bce5487 100644 --- a/transactions/__init__.py +++ b/transactions/__init__.py @@ -1,4 +1,4 @@ -from transactions import Transactions +from transactions import Transactions # noqa __version__ = '0.1.0'