summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2015-06-01 00:26:07 -0500
committerBryan Bishop <kanzure@gmail.com>2015-06-01 00:26:07 -0500
commit66b041cfbc69ed26ba536c34cdd997a96cae7ceb (patch)
treea38c43fb8a697d5a62a6c5b64aa052e733d6eb28
downloadrpcblockchainexplorer-66b041cfbc69ed26ba536c34cdd997a96cae7ceb.tar.gz
rpcblockchainexplorer-66b041cfbc69ed26ba536c34cdd997a96cae7ceb.zip
initial commit
-rw-r--r--LICENSE1
-rw-r--r--Makefile17
-rw-r--r--README.md8
-rw-r--r--requirements.txt2
-rw-r--r--rpcblockchainexplorer/__init__.py27
-rw-r--r--setup.py81
6 files changed, 136 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..9000ab8
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1 @@
+BSD
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bda95c1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+SHELL := /bin/bash
+
+test:
+ nosetests-2.7 -s -v
+ nosetests-3.4 -s -v
+
+clean:
+ rm -fr build dist
+ rm -fr *.egg-info
+ find . -name *.pyc -exec rm {} \;
+ find . -name *.swp -exec rm {} \;
+
+install:
+ python3.4 setup.py install
+
+upload: clean
+ python3.4 setup.py sdist upload
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3c80aca
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+# RPC-based Blockchain Explorer
+
+This is a small python application that runs a web server for locally exploring
+a blockchain using RPC connectivity.
+
+# license
+
+BSD
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..0cf69f0
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+# bitcoin rpc client
+python-bitcoinlib==0.2.1
diff --git a/rpcblockchainexplorer/__init__.py b/rpcblockchainexplorer/__init__.py
new file mode 100644
index 0000000..aa74c65
--- /dev/null
+++ b/rpcblockchainexplorer/__init__.py
@@ -0,0 +1,27 @@
+# coding: utf-8
+
+"""
+rpcblockchainexplorer
+~~~~~~~~~~~~~~~~~~~~~
+
+This is a small web application that operates as a blockchain explorer using
+only an RPC connection to bitcoind.
+"""
+
+__title__ = "rpcblockchainexplorer"
+__version__ = "0.0.1"
+__build__ = 0x000001
+__author__ = "Bryan Bishop <kanzure@gmail.com>"
+__license__ = "BSD"
+__copyright__ = "Copyright 2015 Bryan Bishop"
+
+# set default logging handler to avoid "No handler found" warnings
+import logging
+try: # python 2.7+
+ from logging import NullHandler
+except ImportError:
+ class NullHandler(logging.Handler):
+ def emit(self, record):
+ pass
+
+logging.getLogger(__name__).addHandler(NullHandler())
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..9f9ad7f
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,81 @@
+# coding: utf-8
+
+import os
+
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils.core import setup
+
+base_path = os.path.dirname(__FILE__)
+requirements_path = os.path.join(base_path, "requirements.txt")
+long_description_path = os.path.join(base_path, "README.md")
+version_path = os.path.join(base_path, "rpcblockchainexplorer/__init__.py")
+
+# dependency list is loaded later
+requires = []
+
+# version is also loaded later
+version = None
+
+def __filter_requirements(requirements):
+ """
+ Remove lines that are not related to requirements.
+ """
+ return [line for line in requirements if line[0] != "#"]
+
+def __get_version(version_content):
+ """
+ Extract the version number from the `__init__.py` file.
+ """
+ version = re.search(
+ r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
+ version_content,
+ re.MULTILINE,
+ ).group(1)
+
+ if not version:
+ raise Exception("Cannot find version information.")
+
+ return version
+
+with open(requirements_path, "r") as requirements_file:
+ requirements = requirements_file.read()
+ requirements = requirements.split("\n")
+ requires = __filter_requirements(requirements)
+
+with open(long_description_path, "r") as readme_file:
+ long_description = readme_file.read()
+
+with open(version_path, "r") as version_file:
+ content = version_file.read()
+ version = __get_version(content)
+
+setup(
+ # metadata
+ name="rpcblockchainexplorer",
+ version=version,
+ url="https://github.com/kanzure/rpcblockchainexplorer",
+ license="BSD",
+
+ # details
+ description="Lightweight local RPC blockchain explorer (web application)",
+ long_description=long_description,
+ install_requires=requires,
+
+ # blame who?
+ author="Bryan Bishop",
+ author_email="kanzure@gmail.com",
+
+ # just being conservative here..
+ zip_safe=False,
+
+ # for the greater good
+ classifiers=[
+ "License :: OSI Approved :: BSD License",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 2.7",
+ "Programming Language :: Python :: 3.4",
+ ]
+)