From 575e3d24ef963bd7ef7a23b445b9d75aa6891bc0 Mon Sep 17 00:00:00 2001 From: Tim Reichard Date: Thu, 7 Sep 2023 09:55:08 -0500 Subject: [PATCH] Only import domino within domino specific functions --- HISTORY.rst | 6 ++++++ aioradio/ds_utils.py | 12 +++++++++--- setup.py | 4 ++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 593d5d6..37ef883 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,12 @@ History ======= +v0.19.0 (2023-09-07) + +* Only import domino within domino specific functions so it doesn't need to be installed when using ds_utils. +* Improve logging in ds_utils to log with timestamp before message. + + v0.18.5 (2023-08-31) * Remove dominodatalab as an install dependency. diff --git a/aioradio/ds_utils.py b/aioradio/ds_utils.py index 26e0526..e69eab1 100644 --- a/aioradio/ds_utils.py +++ b/aioradio/ds_utils.py @@ -22,14 +22,19 @@ import boto3 import pandas as pd -from domino import Domino from smb.SMBConnection import SMBConnection warnings.simplefilter(action='ignore', category=UserWarning) -logging.basicConfig(level=logging.INFO) -logger = logging.getLogger(__name__) MAX_SSL_CONTENT_LENGTH = (2 ** 31) - 1 +logger = logging.getLogger(__name__) +logger.propagate = False +c_handler = logging.StreamHandler() +c_handler.setLevel(logging.INFO) +c_format = logging.Formatter('%(asctime)s: %(message)s') +c_handler.setFormatter(c_format) +logger.addHandler(c_handler) + def file_to_s3(s3_client, local_filepath, s3_bucket, key): """Write file to s3.""" @@ -256,6 +261,7 @@ def get_boto3_session(env): def get_domino_connection(secret_id, project, host, env='sandbox'): """Get domino connection.""" + from domino import Domino secret_client = get_boto3_session(env).client("secretsmanager", region_name='us-east-1') api_key = secret_client.get_secret_value(SecretId=secret_id)['SecretString'] return Domino(project=project, api_key=api_key, host=host) diff --git a/setup.py b/setup.py index 5e3d9e5..4c373d7 100644 --- a/setup.py +++ b/setup.py @@ -7,12 +7,12 @@ long_description = fileobj.read() setup(name='aioradio', - version='0.18.5', + version='0.19.0', description='Generic asynchronous i/o python utilities for AWS services (SQS, S3, DynamoDB, Secrets Manager), Redis, MSSQL (pyodbc), JIRA and more', long_description=long_description, long_description_content_type="text/markdown", url='https://github.com/nrccua/aioradio', - author='NRCCUA Architects', + author='Encoura DS Team', author_email='tim.reichard@encoura.org', license="MIT", packages=[