From a15985bb6aff03b2737a826d68aac5a514c7e410 Mon Sep 17 00:00:00 2001 From: lambeb <141648830+lambeb@users.noreply.github.com> Date: Mon, 27 Jan 2025 17:41:32 +0000 Subject: [PATCH] updated several files to do with testing locally --- .gitignore | 1 - README.md | 4 +++- main.py | 29 +++++------------------------ mypi.ini | 7 ------- poetry.lock | 22 +++++++++++----------- services/mypi.ini | 19 +++++++++++++++++++ 6 files changed, 38 insertions(+), 44 deletions(-) delete mode 100644 mypi.ini create mode 100644 services/mypi.ini diff --git a/.gitignore b/.gitignore index 4df5858..e13f7b6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ .vscode .DS_Store .env -/requirements.txt /venv/ /app.yaml .pytest_cache diff --git a/README.md b/README.md index 45db8e7..25bd978 100644 --- a/README.md +++ b/README.md @@ -53,4 +53,6 @@ gcloud compute start-iap-tunnel restapi-1 80 --local-host-port=localhost:8011 export BLAISE_API_URL="localhost:8011" -export BLAISE_SERVER_PARK="gusty" \ No newline at end of file +export BLAISE_SERVER_PARK="gusty" + +Run main.py \ No newline at end of file diff --git a/main.py b/main.py index b05b82f..a854f13 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,9 @@ import logging import os -from google.cloud import storage +from dotenv import load_dotenv import utils -from dotenv import load_dotenv from appconfig.config import Config from services.blaise_service import BlaiseService from services.validation_service import ValidationService @@ -35,20 +34,7 @@ def process_zip_file(data): print(f"File {file_name} is not a zip file, skipping.") return - print(f"Processing ZIP file: {file_name} from bucket {bucket_name}") - - # Initialize the client - storage_client = storage.Client() - - # Reference to the bucket - bucket = storage_client.get_bucket(bucket_name) - - # Get the uploaded ZIP file - blob = bucket.blob(file_name) - - # Debug: Print out the file's metadata - print(f"File {file_name} uploaded to {bucket_name}.") - print(f"Blob size: {blob.size} bytes") + logging.info(f"Processing ZIP file: {file_name} from bucket {bucket_name}") # Config Handler blaise_config = Config.from_env() @@ -91,14 +77,9 @@ def process_zip_file(data): if os.path.isfile("./.env"): - print("Loading environment variables from dotenv file") + logging.info("Loading environment variables from dotenv file") load_dotenv() -# Testing + if __name__ == "__main__": - process_zip_file( - { - "bucket": "ons-blaise-v2-dev-rr3-ingest", - "name": "IPS2501A.zip" - } - ) + process_zip_file({"bucket": "ons-blaise-v2-dev-rr3-ingest", "name": "IPS2501A.zip"}) diff --git a/mypi.ini b/mypi.ini deleted file mode 100644 index a6fe838..0000000 --- a/mypi.ini +++ /dev/null @@ -1,7 +0,0 @@ -[mypy] -disallow_untyped_defs = False -namespace_packages = True -exclude = "scripts/" - -[mypy-blaise_restapi.*] -ignore_missing_imports = True diff --git a/poetry.lock b/poetry.lock index ac7d16b..3f38e71 100644 --- a/poetry.lock +++ b/poetry.lock @@ -330,20 +330,20 @@ toml = ["tomli"] [[package]] name = "deprecated" -version = "1.2.16" +version = "1.2.18" description = "Python @deprecated decorator to deprecate old python classes, functions or methods." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" files = [ - {file = "Deprecated-1.2.16-py2.py3-none-any.whl", hash = "sha256:4c8e429ada6573698ba723f9c4ea53006e990042a45db938e412f1f9d4b9ffd9"}, - {file = "deprecated-1.2.16.tar.gz", hash = "sha256:6ec624c168290715d56c6af7c1c1066ea5c732bd56427b1651db75ede923aa38"}, + {file = "Deprecated-1.2.18-py2.py3-none-any.whl", hash = "sha256:bd5011788200372a32418f888e326a09ff80d0214bd961147cfed01b5c018eec"}, + {file = "deprecated-1.2.18.tar.gz", hash = "sha256:422b6f6d859da6f2ef57857761bfb392480502a64c3028ca9bbe86085d72115d"}, ] [package.dependencies] wrapt = ">=1.10,<2" [package.extras] -dev = ["PyTest", "PyTest-Cov", "bump2version (<1)", "jinja2 (>=3.0.3,<3.1.0)", "setuptools", "sphinx (<2)", "tox"] +dev = ["PyTest", "PyTest-Cov", "bump2version (<1)", "setuptools", "tox"] [[package]] name = "exceptiongroup" @@ -551,13 +551,13 @@ protobuf = ">=3.20.2,<4.21.0 || >4.21.0,<4.21.1 || >4.21.1,<4.21.2 || >4.21.2,<4 [[package]] name = "google-cloud-pubsub" -version = "2.27.2" +version = "2.27.3" description = "Google Cloud Pub/Sub API client library" optional = false python-versions = ">=3.7" files = [ - {file = "google_cloud_pubsub-2.27.2-py2.py3-none-any.whl", hash = "sha256:a919f84fdea683b0a02464e38dd32332edbcbc8e85da82070079a57791119fd6"}, - {file = "google_cloud_pubsub-2.27.2.tar.gz", hash = "sha256:d92c156c7ddd0e5125008f977898198d7b1ae766026056497271bec4909647fe"}, + {file = "google_cloud_pubsub-2.27.3-py2.py3-none-any.whl", hash = "sha256:6e294b063d6c6bf44d7b1ca99721ae6137930df3fdf7b91e44d280dd84b9410c"}, + {file = "google_cloud_pubsub-2.27.3.tar.gz", hash = "sha256:daa03d16552c34240774307fc69ceebb991a94d70d0d6f208179e375f503f532"}, ] [package.dependencies] @@ -1117,13 +1117,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "proto-plus" -version = "1.25.0" -description = "Beautiful, Pythonic protocol buffers." +version = "1.26.0" +description = "Beautiful, Pythonic protocol buffers" optional = false python-versions = ">=3.7" files = [ - {file = "proto_plus-1.25.0-py3-none-any.whl", hash = "sha256:c91fc4a65074ade8e458e95ef8bac34d4008daa7cce4a12d6707066fca648961"}, - {file = "proto_plus-1.25.0.tar.gz", hash = "sha256:fbb17f57f7bd05a68b7707e745e26528b0b3c34e378db91eef93912c54982d91"}, + {file = "proto_plus-1.26.0-py3-none-any.whl", hash = "sha256:bf2dfaa3da281fc3187d12d224c707cb57214fb2c22ba854eb0c105a3fb2d4d7"}, + {file = "proto_plus-1.26.0.tar.gz", hash = "sha256:6e93d5f5ca267b54300880fff156b6a3386b3fa3f43b1da62e680fc0c586ef22"}, ] [package.dependencies] diff --git a/services/mypi.ini b/services/mypi.ini new file mode 100644 index 0000000..dca5dc9 --- /dev/null +++ b/services/mypi.ini @@ -0,0 +1,19 @@ +[mypy] +disallow_untyped_defs = False +namespace_packages = True +exclude = "scripts/" + +[mypy-blaise_restapi.*] +ignore_missing_imports = True + +[mypy-flask_httpauth.*] +ignore_missing_imports = True + +[mypy-google.auth.transport.requests.*] +ignore_missing_imports = True + +[mypy-google.oauth2.*] +ignore_missing_imports = True + +[mypy-dataclass_wizard.*] +ignore_missing_imports = True \ No newline at end of file