package and version metadata for internal domain seperation

pull/513/head
Kieran Prasch 2018-11-04 14:07:02 +01:00
parent 4cd6cdc9cd
commit 08b22817b1
5 changed files with 233 additions and 33 deletions

23
.bumpversion.cfg Normal file
View File

@ -0,0 +1,23 @@
[bumpversion]
current_version = 0.1.0-alpha.0
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<stage>[^.]*)\.(?P<devnum>\d+))?
serialize =
{major}.{minor}.{patch}-{stage}.{devnum}
{major}.{minor}.{patch}
[bumpversion:part:stage]
optional_value = stable
first_value = stable
values =
alpha
beta
rc
stable
[bumpversion:part:devnum]
[bumpversion:file:README.md]
[bumpversion:file:umbral/__about__.py]

View File

@ -1,22 +1,22 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import collections
import hashlib import hashlib
import json import json
import logging import logging
import os import os
import random import random
import shutil
import sys import sys
from typing import Tuple, ClassVar
import click import click
import collections
import shutil
from constant_sorrow import constants from constant_sorrow import constants
from eth_utils import is_checksum_address from eth_utils import is_checksum_address
from more_itertools import seekable
from twisted.internet import reactor, stdio from twisted.internet import reactor, stdio
from typing import Tuple, ClassVar
from web3.middleware import geth_poa_middleware from web3.middleware import geth_poa_middleware
import nucypher
from nucypher.blockchain.eth.agents import MinerAgent, PolicyAgent, NucypherTokenAgent, EthereumContractAgent from nucypher.blockchain.eth.agents import MinerAgent, PolicyAgent, NucypherTokenAgent, EthereumContractAgent
from nucypher.blockchain.eth.chains import Blockchain from nucypher.blockchain.eth.chains import Blockchain
from nucypher.blockchain.eth.constants import (DISPATCHER_SECRET_LENGTH, from nucypher.blockchain.eth.constants import (DISPATCHER_SECRET_LENGTH,
@ -28,7 +28,8 @@ from nucypher.blockchain.eth.interfaces import BlockchainDeployerInterface
from nucypher.blockchain.eth.registry import TemporaryEthereumContractRegistry from nucypher.blockchain.eth.registry import TemporaryEthereumContractRegistry
from nucypher.blockchain.eth.sol.compile import SolidityCompiler from nucypher.blockchain.eth.sol.compile import SolidityCompiler
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.config.constants import BASE_DIR, SEEDNODES, SeednodeMetadata from nucypher.config.constants import BASE_DIR, SEEDNODES, SeednodeMetadata, NUCYPHER_SENTRY_ENDPOINT, REPORT_TO_SENTRY, \
DEBUG
from nucypher.config.keyring import NucypherKeyring from nucypher.config.keyring import NucypherKeyring
from nucypher.config.node import NodeConfiguration from nucypher.config.node import NodeConfiguration
from nucypher.utilities.sandbox.blockchain import TesterBlockchain, token_airdrop from nucypher.utilities.sandbox.blockchain import TesterBlockchain, token_airdrop
@ -37,7 +38,6 @@ from nucypher.utilities.sandbox.constants import (DEVELOPMENT_TOKEN_AIRDROP_AMOU
DEFAULT_SIMULATION_REGISTRY_FILEPATH) DEFAULT_SIMULATION_REGISTRY_FILEPATH)
from nucypher.utilities.sandbox.ursula import UrsulaCommandProtocol from nucypher.utilities.sandbox.ursula import UrsulaCommandProtocol
__version__ = '0.1.0-alpha.0'
BANNER = """ BANNER = """
_ _
| | | |
@ -50,7 +50,7 @@ BANNER = """
version {} version {}
""".format(__version__) """.format(nucypher.__version__)
def echo_version(ctx, param, value): def echo_version(ctx, param, value):
@ -60,17 +60,12 @@ def echo_version(ctx, param, value):
ctx.exit() ctx.exit()
# Constants
DEBUG = True
REPORT_TO_SENTRY = True
KEYRING_PASSPHRASE_ENVVAR_KEY = 'NUCYPHER_KEYRING_PASSPHRASE'
# Setup Logging # # Setup Logging #
################ ################
if DEBUG:
root = logging.Logger("cli")
root.setLevel(logging.DEBUG)
root = logging.Logger("cli")
if DEBUG:
root.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout) ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG) ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

21
nucypher/__about__.py Normal file
View File

@ -0,0 +1,21 @@
from __future__ import absolute_import, division, print_function
__all__ = [
"__title__", "__summary__", "__version__", "__author__", "__email__", "__license__", "__copyright__", "__url__"
]
__title__ = "nucypher"
__url__ = "https://github.com/nucypher/nucypher"
__summary__ = 'A proxy re-encryption network to empower privacy in decentralized systems.',
__version__ = "0.1.0-alpha.0"
__author__ = "NuCypher"
__email__ = "dev@nucypher.com"
__license__ = "GNU General Public License, Version 3"
__copyright__ = 'Copyright (C) 2018 NuCypher'

View File

@ -1,17 +1,49 @@
from nucypher.__about__ import (
__author__, __license__, __summary__, __title__, __version__, __copyright__, __email__, __url__
)
__all__ = [
"__title__", "__summary__", "__version__", "__author__", "__license__", "__copyright__", "__email__", "__url__"
]
# Set Default Curve # # Set Default Curve #
##################### #####################
from umbral.config import set_default_curve from umbral.config import set_default_curve
set_default_curve() set_default_curve()
#####################
# Report to Sentry # # Report to Sentry #
#################### ####################
import sentry_sdk from nucypher.config.constants import REPORT_TO_SENTRY, NUCYPHER_SENTRY_ENDPOINT, PACKAGE_NAME
sentry_sdk.init("https://d8af7c4d692e4692a455328a280d845e@sentry.io/1310685")
#################### try:
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
except ImportError:
if REPORT_TO_SENTRY is True:
raise ImportError("Sentry")
else:
import logging
sentry_logging = LoggingIntegration(
level=logging.INFO, # Capture info and above as breadcrumbs
event_level=logging.DEBUG # Send debug logs as events
)
sentry_sdk.init(
dsn=NUCYPHER_SENTRY_ENDPOINT,
integrations=[sentry_logging],
release='{}@{}'.format(PACKAGE_NAME, __version__)
)
# Twisted Log Observer #
########################
from nucypher.utilities.logging import simpleObserver
from twisted.logger import globalLogPublisher
globalLogPublisher.addObserver(simpleObserver)

155
setup.py
View File

@ -1,19 +1,134 @@
from setuptools import setup, find_packages #!/usr/bin/env python
# -*- coding: utf-8 -*-
VERSION = '0.1' import os
import sys
from setuptools import setup
from setuptools.command.install import install
# NOTE: Use Pipfile & Pipfile.lock to manage dependencies\ #
INSTALL_REQUIRES = [] # Metadata
TESTS_REQUIRE = [] #
PACKAGE_NAME = 'nucypher'
BASE_DIR = os.path.dirname(__file__)
ABOUT = dict()
with open(os.path.join(BASE_DIR, PACKAGE_NAME, "__about__.py")) as f:
exec(f.read(), ABOUT)
with open(os.path.join(BASE_DIR, "README.md")) as f:
long_description = f.read()
#
# Utilities
#
class VerifyVersionCommand(install):
"""Custom command to verify that the git tag matches our version"""
description = 'verify that the git tag matches our version'
def run(self):
tag = os.getenv('CIRCLE_TAG')
if tag.startswith('v'):
tag = tag[1:]
version = ABOUT['__version__']
if version.startswith('v'):
version = version[1:]
if tag != version:
info = "Git tag: {0} does not match the version of this app: {1}".format(
os.getenv('CIRCLE_TAG'), ABOUT['__version__']
)
sys.exit(info)
#
# Dependencies
#
INSTALL_REQUIRES = [
# NuCypher
'umbral',
'constant-sorrow',
'bytestringSplitter',
'hendrix>=3.1.0',
# Third Party (General)
'cryptography>=2.3',
'pysha3',
'requests',
'sqlalchemy',
'apistar==0.5.42',
'tzlocal==2.0.0b1',
'maya',
# Third Party (Ethereum)
'coincurve>=8.0.2',
'eth-utils',
'eth-keys',
'eth-tester>=0.1.0b33',
'py-evm>=0.2.0a33',
'py-solc',
'web3',
# Third Party (Configuration + CLI)
'appdirs',
'click',
'colorama',
'sentry-sdk'
]
TESTS_REQUIRE = [
'pytest',
'pytest-mypy',
'pytest-twisted',
'pytest-cov',
'mypy',
'codecov',
'coverage',
'moto'
]
DEPLOY_REQUIRES = [
'bumpversion',
'boto3',
'ansible',
]
DOCS_REQUIRE = [
'sphinx',
'sphinx-autobuild'
]
BENCHMARKS_REQUIRE = [
'pytest-benchmark'
]
EXTRAS_REQUIRE = {'testing': TESTS_REQUIRE,
'deployment': DEPLOY_REQUIRES,
'docs': DOCS_REQUIRE,
'benchmark': BENCHMARKS_REQUIRE}
setup(name=ABOUT['__title__'],
url=ABOUT['__url__'],
version=ABOUT['__version__'],
author=ABOUT['__author__'],
author_email=ABOUT['__email__'],
description=ABOUT['__summary__'],
long_description=long_description,
setup(name='nucypher',
version=VERSION,
description='A proxy re-encryption network to empower privacy in decentralized systems.',
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
extras_require={'testing': TESTS_REQUIRE}, extras_require=EXTRAS_REQUIRE,
packages=find_packages(),
package_data={'nucypher': [ packages=[PACKAGE_NAME],
package_data={PACKAGE_NAME: [
'blockchain/eth/*', 'project/contracts/*', 'blockchain/eth/*', 'project/contracts/*',
'blockchain/eth/sol_source/contracts/lib/*', 'blockchain/eth/sol_source/contracts/lib/*',
'blockchain/eth/sol_source/contracts/zepellin/math/*', 'blockchain/eth/sol_source/contracts/zepellin/math/*',
@ -22,6 +137,20 @@ setup(name='nucypher',
include_package_data=True, include_package_data=True,
entry_points=''' entry_points='''
[console_scripts] [console_scripts]
nucypher=cli.main:cli {}=cli.main:cli
''' '''.format(PACKAGE_NAME),
cmdclass={'verify': VerifyVersionCommand},
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Programming Language :: Python :: Implementation",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering",
],
python_requires='>=3'
) )