Skip to content

Commit

Permalink
Merge pull request #39 from cancervariants/env-var
Browse files Browse the repository at this point in the history
Env var
  • Loading branch information
korikuzma authored Mar 30, 2021
2 parents 06e1526 + 6f80bf5 commit 4286db8
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 48 deletions.
2 changes: 1 addition & 1 deletion gene/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
logger.setLevel(logging.DEBUG)


__version__ = "0.1.3"
__version__ = "0.1.4"


class DownloadException(Exception):
Expand Down
14 changes: 7 additions & 7 deletions gene/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,27 @@ def __init__(self, db_url: str = '', region_name: str = 'us-east-2'):
:param str db_url: URL endpoint for DynamoDB source
:param str region_name: default AWS region
"""
env_keys = environ.keys()
if 'GENE_NORM_PROD' in env_keys or 'GENE_NORM_EB_PROD' in env_keys:
if 'GENE_NORM_PROD' in environ or 'GENE_NORM_EB_PROD' in environ:
boto_params = {
'region_name': region_name
}
if 'GENE_NORM_EB_PROD' not in env_keys:
if 'GENE_NORM_EB_PROD' not in environ:
# EB Instance should not have to confirm.
# This is used only for updating production via CLI
if click.confirm("Are you sure you want to use the "
"production database?", default=False):
click.echo("***PRODUCTION DATABASE IN USE***")
click.echo("***GENE PRODUCTION DATABASE IN USE***")
else:
click.echo("Exiting.")
sys.exit()
else:
if db_url:
endpoint_url = db_url
elif 'GENE_NORM_DB_URL' in env_keys:
elif 'GENE_NORM_DB_URL' in environ:
endpoint_url = environ['GENE_NORM_DB_URL']
else:
endpoint_url = 'http://localhost:8000'
click.echo(f"***Using Database Endpoint: {endpoint_url}***")
click.echo(f"***Using Gene Database Endpoint: {endpoint_url}***")
boto_params = {
'region_name': region_name,
'endpoint_url': endpoint_url
Expand All @@ -46,7 +45,8 @@ def __init__(self, db_url: str = '', region_name: str = 'us-east-2'):
self.dynamodb_client = boto3.client('dynamodb', **boto_params)

# Create tables if nonexistent if not connecting to production database
if 'GENE_NORM_PROD' not in env_keys:
if 'GENE_NORM_PROD' not in environ and\
'GENE_NORM_EB_PROD' not in environ:
existing_tables = self.dynamodb_client.list_tables()['TableNames']
self.create_genes_table(existing_tables)
self.create_meta_data_table(existing_tables)
Expand Down
58 changes: 30 additions & 28 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ beautifulsoup4==4.9.3
biocommons.seqrepo==0.6.3
bioutils==0.5.2.post3; python_version >= '3.6'
bleach==3.3.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
boto3==1.17.20
botocore==1.20.20; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
boto3==1.17.40
botocore==1.20.40; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
bs4==0.0.1
canonicaljson==1.4.0; python_version ~= '3.5'
certifi==2020.12.5
Expand All @@ -41,7 +41,7 @@ coverage==5.5
coveralls==3.0.1
cssselect==1.1.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
decorator==4.4.2
defusedxml==0.6.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
defusedxml==0.7.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
deprecation==2.1.0
distlib==0.3.1
docopt==0.6.2
Expand All @@ -50,35 +50,36 @@ entrypoints==0.3; python_version >= '2.7'
fake-useragent==0.1.11
fastapi==0.63.0
filelock==3.0.12
flake8-docstrings==1.5.0
flake8==3.8.4
flake8-docstrings==1.6.0
flake8==3.9.0
frozendict==1.2
ga4gh.vrs==0.6.3rc0
gffutils==0.10.1
h11==0.12.0; python_version >= '3.6'
httptools==0.1.1
humanfriendly==9.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
identify==2.1.0; python_full_version >= '3.6.1'
identify==2.2.2; python_full_version >= '3.6.1'
idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
importlib-metadata==3.10.0; python_version >= '3.6'
inflection==0.5.1; python_version >= '3.5'
iniconfig==1.1.1
ipykernel==5.5.0; python_version >= '3.5'
ipython-genutils==0.2.0
ipython==7.21.0; python_version >= '3.7'
ipython==7.22.0; python_version >= '3.7'
jedi==0.18.0; python_version >= '3.6'
jinja2==2.11.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
jmespath==0.10.0; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
json5==0.9.5
jsonschema==3.2.0
jupyter-client==6.1.11; python_version >= '3.5'
jupyter-client==6.1.12; python_version >= '3.5'
jupyter-core==4.7.1; python_version >= '3.6'
jupyter-packaging==0.7.12; python_version >= '3.6'
jupyter-server==1.4.1; python_version >= '3.6'
jupyter-server==1.5.1; python_version >= '3.6'
jupyterlab-pygments==0.1.2
jupyterlab-server==2.3.0; python_version >= '3.6'
jupyterlab==3.0.9
keyring==22.3.0; python_version >= '3.6'
lxml==4.6.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
jupyterlab==3.0.12
keyring==23.0.1; python_version >= '3.6'
lxml==4.6.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
markdown==3.3.4; python_version >= '3.6'
markupsafe==1.1.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
mccabe==0.6.1
Expand All @@ -90,8 +91,8 @@ nbformat==5.1.2; python_version >= '3.5'
nest-asyncio==1.5.1; python_version >= '3.5'
networkx==2.5; python_version >= '3.6'
nodeenv==1.5.0
notebook==6.2.0; python_version >= '3.5'
numpy==1.20.1; python_version >= '3.7'
notebook==6.3.0; python_version >= '3.6'
numpy==1.20.2; python_version >= '3.7'
obonet==0.2.6; python_version >= '3'
packaging==20.9; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pandas==1.2.3; python_full_version >= '3.7.1'
Expand All @@ -102,21 +103,21 @@ pexpect==4.8.0; sys_platform != 'win32'
pickleshare==0.7.5
pkginfo==1.7.0
pluggy==0.13.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pre-commit==2.10.1
pre-commit==2.11.1
prometheus-client==0.9.0
prompt-toolkit==3.0.16; python_full_version >= '3.6.1'
prompt-toolkit==3.0.18; python_full_version >= '3.6.1'
ptyprocess==0.7.0; os_name != 'nt'
py==1.10.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pycodestyle==2.6.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pycodestyle==2.7.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pycparser==2.20; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pydantic==1.8.1
pydocstyle==5.1.1; python_version >= '3.5'
pydocstyle==6.0.0; python_version >= '3.6'
pyee==8.1.0
pyfaidx==0.5.9.5
pyflakes==2.2.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pygments==2.8.0; python_version >= '3.5'
pyflakes==2.3.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pygments==2.8.1; python_version >= '3.5'
pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
pyppeteer==0.2.5; python_full_version >= '3.6.1' and python_version < '4'
pyppeteer==0.2.5; python_full_version >= '3.6.1' and python_full_version < '4.0.0'
pyquery==1.4.3
pyrsistent==0.17.3; python_version >= '3.5'
pysam==0.16.0.1
Expand All @@ -132,32 +133,33 @@ requests-html==0.10.0; python_version >= '3.6'
requests-toolbelt==0.9.1
requests==2.25.1
rfc3986==1.4.0
s3transfer==0.3.4
s3transfer==0.3.6
send2trash==1.5.0
seqrepo==0.0.0
simplejson==3.17.2; python_version >= '2.5' and python_version not in '3.0, 3.1, 3.2'
six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'
sniffio==1.2.0; python_version >= '3.5'
snowballstemmer==2.1.0
soupsieve==2.2; python_version >= '3.0'
soupsieve==2.2.1; python_version >= '3.0'
sqlparse==0.4.1; python_version >= '3.5'
starlette==0.13.6; python_version >= '3.6'
tabulate==0.8.9
terminado==0.9.2; python_version >= '3.6'
terminado==0.9.4; python_version >= '3.6'
testpath==0.4.4
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
tornado==6.1; python_version >= '3.5'
tqdm==4.58.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
tqdm==4.59.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
traitlets==5.0.5; python_version >= '3.7'
twine==3.3.0
twine==3.4.1
typing-extensions==3.7.4.3
urllib3==1.26.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'
urllib3==1.26.4; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_full_version < '4.0.0'
uvicorn==0.13.4
uvloop==0.15.2
vcfpy==0.13.3
virtualenv==20.4.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
virtualenv==20.4.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
w3lib==1.22.0
wcwidth==0.2.5
webencodings==0.5.1
websockets==8.1
yoyo-migrations==7.3.1
zipp==3.4.1; python_version >= '3.6'
26 changes: 14 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ beautifulsoup4==4.9.3
biocommons.seqrepo==0.6.3
bioutils==0.5.2.post3; python_version >= '3.6'
bleach==3.3.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
boto3==1.17.20
botocore==1.20.20; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
boto3==1.17.40
botocore==1.20.40; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
bs4==0.0.1
canonicaljson==1.4.0; python_version ~= '3.5'
certifi==2020.12.5
Expand All @@ -38,14 +38,15 @@ h11==0.12.0; python_version >= '3.6'
httptools==0.1.1
humanfriendly==9.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
importlib-metadata==3.10.0; python_version >= '3.6'
inflection==0.5.1; python_version >= '3.5'
jmespath==0.10.0; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
jsonschema==3.2.0
keyring==22.3.0; python_version >= '3.6'
lxml==4.6.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
keyring==23.0.1; python_version >= '3.6'
lxml==4.6.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
markdown==3.3.4; python_version >= '3.6'
networkx==2.5; python_version >= '3.6'
numpy==1.20.1; python_version >= '3.7'
numpy==1.20.2; python_version >= '3.7'
obonet==0.2.6; python_version >= '3'
packaging==20.9; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pandas==1.2.3; python_full_version >= '3.7.1'
Expand All @@ -54,9 +55,9 @@ pkginfo==1.7.0
pydantic==1.8.1
pyee==8.1.0
pyfaidx==0.5.9.5
pygments==2.8.0; python_version >= '3.5'
pygments==2.8.1; python_version >= '3.5'
pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
pyppeteer==0.2.5; python_full_version >= '3.6.1' and python_version < '4'
pyppeteer==0.2.5; python_full_version >= '3.6.1' and python_full_version < '4.0.0'
pyquery==1.4.3
pyrsistent==0.17.3; python_version >= '3.5'
pysam==0.16.0.1
Expand All @@ -69,22 +70,23 @@ requests-html==0.10.0; python_version >= '3.6'
requests-toolbelt==0.9.1
requests==2.25.1
rfc3986==1.4.0
s3transfer==0.3.4
s3transfer==0.3.6
seqrepo==0.0.0
simplejson==3.17.2; python_version >= '2.5' and python_version not in '3.0, 3.1, 3.2'
six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'
soupsieve==2.2; python_version >= '3.0'
soupsieve==2.2.1; python_version >= '3.0'
sqlparse==0.4.1; python_version >= '3.5'
starlette==0.13.6; python_version >= '3.6'
tabulate==0.8.9
tqdm==4.58.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
twine==3.3.0
tqdm==4.59.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
twine==3.4.1
typing-extensions==3.7.4.3
urllib3==1.26.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'
urllib3==1.26.4; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_full_version < '4.0.0'
uvicorn==0.13.4
uvloop==0.15.2
vcfpy==0.13.3
w3lib==1.22.0
webencodings==0.5.1
websockets==8.1
yoyo-migrations==7.3.1
zipp==3.4.1; python_version >= '3.6'

0 comments on commit 4286db8

Please sign in to comment.