ipulse-shared-core-ftredge 2.14__tar.gz → 2.16__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ipulse-shared-core-ftredge might be problematic. Click here for more details.

Files changed (25) hide show
  1. {ipulse_shared_core_ftredge-2.14/src/ipulse_shared_core_ftredge.egg-info → ipulse_shared_core_ftredge-2.16}/PKG-INFO +3 -1
  2. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/setup.py +3 -1
  3. ipulse_shared_core_ftredge-2.16/src/ipulse_shared_core_ftredge/gcp_logger.py +74 -0
  4. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/models/user_profile.py +2 -0
  5. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/models/user_profile_update.py +9 -0
  6. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16/src/ipulse_shared_core_ftredge.egg-info}/PKG-INFO +3 -1
  7. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge.egg-info/SOURCES.txt +1 -0
  8. ipulse_shared_core_ftredge-2.16/src/ipulse_shared_core_ftredge.egg-info/requires.txt +5 -0
  9. ipulse_shared_core_ftredge-2.14/src/ipulse_shared_core_ftredge.egg-info/requires.txt +0 -3
  10. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/LICENCE +0 -0
  11. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/README.md +0 -0
  12. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/pyproject.toml +0 -0
  13. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/setup.cfg +0 -0
  14. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/__init__.py +0 -0
  15. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/models/__init__.py +0 -0
  16. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/models/audit_log_firestore.py +0 -0
  17. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/models/organisation.py +0 -0
  18. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/models/pulse_enums.py +0 -0
  19. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/models/resource_catalog_item.py +0 -0
  20. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/models/user_auth.py +0 -0
  21. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/models/user_status.py +0 -0
  22. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/tests/__init__.py +0 -0
  23. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge/tests/test.py +0 -0
  24. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge.egg-info/dependency_links.txt +0 -0
  25. {ipulse_shared_core_ftredge-2.14 → ipulse_shared_core_ftredge-2.16}/src/ipulse_shared_core_ftredge.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipulse_shared_core_ftredge
3
- Version: 2.14
3
+ Version: 2.16
4
4
  Summary: Shared models for the Pulse platform project. Using AI for financial advisory and investment management.
5
5
  Home-page: https://github.com/TheFutureEdge/ipulse_shared_core
6
6
  Author: Russlan Ramdowar
@@ -8,3 +8,5 @@ License-File: LICENCE
8
8
  Requires-Dist: pydantic[email]~=2.5
9
9
  Requires-Dist: python-dateutil~=2.8
10
10
  Requires-Dist: pytest~=7.1
11
+ Requires-Dist: google-cloud-logging~=3.10.0
12
+ Requires-Dist: google-cloud-error-reporting~=1.11.0
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='ipulse_shared_core_ftredge',
5
- version='2.14',
5
+ version='2.16',
6
6
  package_dir={'': 'src'}, # Specify the source directory
7
7
  packages=find_packages(where='src'), # Look for packages in 'src'
8
8
  install_requires=[
@@ -10,6 +10,8 @@ setup(
10
10
  'pydantic[email]~=2.5',
11
11
  'python-dateutil~=2.8',
12
12
  'pytest~=7.1',
13
+ 'google-cloud-logging~=3.10.0',
14
+ 'google-cloud-error-reporting~=1.11.0'
13
15
  ],
14
16
  author='Russlan Ramdowar',
15
17
  description='Shared models for the Pulse platform project. Using AI for financial advisory and investment management.',
@@ -0,0 +1,74 @@
1
+ import logging
2
+ import os
3
+ import traceback
4
+ from google.cloud import error_reporting, logging as cloud_logging
5
+
6
+
7
+ ############################################################################
8
+ ##################### SETTING UP LOGGER ####################################
9
+
10
+ ####DEPCREACATED: THIS APPROACH WAS GOOD, BUT ERRORS WERE NOT REPORTED TO ERROR REPORTING
11
+
12
+ # logging.basicConfig(level=logging.INFO)
13
+ # logging_client = google.cloud.logging.Client()
14
+ # # Retrieves a Cloud Logging handler based on the environment
15
+ # # you're running in and integrates the handler with the
16
+ # # Python logging module. By default this captures all logs
17
+ # # at INFO level and higher
18
+ # logging_client.setup_logging()
19
+ ###################################
20
+
21
+ ##### THIS APPROACH IS USED NOW ########
22
+ ## TODO Fix the issue with POST 0B Nan.... printed in Cloud Logging , which is referring to posting to Cloud Logging probably.
23
+
24
+ def setup_logger(logger_name):
25
+ """Sets up a logger with Error Reporting and Cloud Logging handlers.
26
+
27
+ Args:
28
+ logger_name: The name of the logger.
29
+
30
+ Returns:
31
+ logging.Logger: The configured logger instance.
32
+ """
33
+
34
+ class ErrorReportingHandler(logging.Handler):
35
+ def __init__(self, level=logging.ERROR):
36
+ super().__init__(level)
37
+ self.error_client = error_reporting.Client()
38
+ self.propagate = True
39
+
40
+ def emit(self, record):
41
+ try:
42
+ if record.levelno >= logging.ERROR:
43
+ message = self.format(record)
44
+ if record.exc_info:
45
+ message += "\n" + ''.join(traceback.format_exception(*record.exc_info))
46
+ if hasattr(record, 'pathname') and hasattr(record, 'lineno'):
47
+ message += f"\nFile: {record.pathname}, Line: {record.lineno}"
48
+ self.error_client.report(message)
49
+ except Exception as e:
50
+ # Ensure no exceptions are raised during logging
51
+ self.handleError(record)
52
+
53
+ logger = logging.getLogger(logger_name)
54
+ logger.setLevel(logging.INFO)
55
+
56
+ # Create Error Reporting handler
57
+ error_reporting_handler = ErrorReportingHandler()
58
+
59
+ # Create Google Cloud Logging handler
60
+ cloud_logging_client = cloud_logging.Client()
61
+ cloud_logging_handler = cloud_logging_client.get_default_handler()
62
+
63
+ # Add handlers to the logger
64
+ logger.addHandler(error_reporting_handler)
65
+ logger.addHandler(cloud_logging_handler)
66
+
67
+ # Add a console handler for local development
68
+ if os.environ.get("ENV") == "LOCAL":
69
+ formatter = logging.Formatter('%(levelname)s : %(name)s : %(asctime)s : %(message)s')
70
+ console_handler = logging.StreamHandler()
71
+ console_handler.setFormatter(formatter)
72
+ logger.addHandler(console_handler)
73
+
74
+ return logger
@@ -11,6 +11,8 @@ CLASS_ORGIN_DATE=datetime(2024, 1, 16, 20, 5)
11
11
  CLASS_VERSION = 3.01
12
12
  CLASS_REVISION_AUTHOR="Russlan Ramdowar;russlan@ftredge.com"
13
13
  CLASS_REVISION_DATE=datetime(2024, 2, 13, 20, 15)
14
+ LAST_MODIFICATION="Fixed typo"
15
+
14
16
 
15
17
  DOMAIN="user"
16
18
  OBJ_REF = "usprfl"
@@ -2,6 +2,15 @@ from typing import Optional, Set
2
2
  from pydantic import BaseModel, Field, EmailStr
3
3
  from datetime import date, datetime
4
4
 
5
+
6
+ CLASS_ORIGIN_AUTHOR="Russlan Ramdowar;russlan@ftredge.com"
7
+ CLASS_ORGIN_DATE=datetime(2024, 3, 15, 20, 15)
8
+
9
+ CLASS_VERSION = 2.01
10
+ CLASS_REVISION_AUTHOR="Russlan Ramdowar;russlan@ftredge.com"
11
+ CLASS_REVISION_DATE=datetime(2024, 3, 15, 20, 15)
12
+ LAST_MODIFICATION="Created , with all fields Optional"
13
+
5
14
  class UserProfileUpdate(BaseModel):
6
15
  schema_version: Optional[float] = Field(None, description="Version of this Class == version of DB Schema")
7
16
  email: Optional[EmailStr] = Field(None, description="Propagated from Firebase Auth")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipulse_shared_core_ftredge
3
- Version: 2.14
3
+ Version: 2.16
4
4
  Summary: Shared models for the Pulse platform project. Using AI for financial advisory and investment management.
5
5
  Home-page: https://github.com/TheFutureEdge/ipulse_shared_core
6
6
  Author: Russlan Ramdowar
@@ -8,3 +8,5 @@ License-File: LICENCE
8
8
  Requires-Dist: pydantic[email]~=2.5
9
9
  Requires-Dist: python-dateutil~=2.8
10
10
  Requires-Dist: pytest~=7.1
11
+ Requires-Dist: google-cloud-logging~=3.10.0
12
+ Requires-Dist: google-cloud-error-reporting~=1.11.0
@@ -3,6 +3,7 @@ README.md
3
3
  pyproject.toml
4
4
  setup.py
5
5
  src/ipulse_shared_core_ftredge/__init__.py
6
+ src/ipulse_shared_core_ftredge/gcp_logger.py
6
7
  src/ipulse_shared_core_ftredge.egg-info/PKG-INFO
7
8
  src/ipulse_shared_core_ftredge.egg-info/SOURCES.txt
8
9
  src/ipulse_shared_core_ftredge.egg-info/dependency_links.txt
@@ -0,0 +1,5 @@
1
+ pydantic[email]~=2.5
2
+ python-dateutil~=2.8
3
+ pytest~=7.1
4
+ google-cloud-logging~=3.10.0
5
+ google-cloud-error-reporting~=1.11.0
@@ -1,3 +0,0 @@
1
- pydantic[email]~=2.5
2
- python-dateutil~=2.8
3
- pytest~=7.1