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/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/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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bd40e61 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +trxs: + build: . + 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 new file mode 100644 index 0000000..c077ace --- /dev/null +++ b/setup.cfg @@ -0,0 +1,6 @@ +[aliases] +test=pytest + +[coverage:run] +source = transactions +omit = *test* diff --git a/setup.py b/setup.py index d33abca..af03e1a 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,88 @@ +""" +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 + +""" +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', + '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', + version=find_version('transactions', '__init__.py'), 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, + }, ) 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 diff --git a/transactions/__init__.py b/transactions/__init__.py index eb1dc94..bce5487 100644 --- a/transactions/__init__.py +++ b/transactions/__init__.py @@ -1 +1,4 @@ -from transactions import Transactions +from transactions import Transactions # noqa + + +__version__ = '0.1.0'