commons-metrics 0.0.27__tar.gz → 0.0.29__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.
Files changed (23) hide show
  1. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/PKG-INFO +1 -1
  2. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/__init__.py +1 -1
  3. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/github_api_client.py +7 -4
  4. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/util.py +1 -11
  5. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/PKG-INFO +1 -1
  6. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/setup.py +1 -1
  7. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/LICENSE +0 -0
  8. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/README.md +0 -0
  9. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/azure_devops_client.py +0 -0
  10. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/cache_manager.py +0 -0
  11. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/commons_repos_client.py +0 -0
  12. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/database.py +0 -0
  13. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/date_utils.py +0 -0
  14. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/repositories.py +0 -0
  15. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/s3_file_manager.py +0 -0
  16. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/text_simplifier.py +0 -0
  17. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/update_design_components.py +0 -0
  18. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics/variable_finder.py +0 -0
  19. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/SOURCES.txt +0 -0
  20. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/dependency_links.txt +0 -0
  21. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/requires.txt +0 -0
  22. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/commons_metrics.egg-info/top_level.txt +0 -0
  23. {commons_metrics-0.0.27 → commons_metrics-0.0.29}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commons_metrics
3
- Version: 0.0.27
3
+ Version: 0.0.29
4
4
  Summary: A simple library for basic statistical calculations
5
5
  Author: Bancolombia
6
6
  Author-email: omar.david.pino@email.com
@@ -12,4 +12,4 @@ from .text_simplifier import TextSimplifier
12
12
  from .variable_finder import VariableFinder
13
13
 
14
14
  __all__ = ['Util', 'DatabaseConnection', 'ComponentRepository', 'UpdateDesignSystemComponents', 'GitHubAPIClient', 'AzureDevOpsClient', 'S3FileManager', 'CacheManager', 'CommonsReposClient', 'DateUtils', 'TextSimplifier', 'VariableFinder']
15
- __version__ = '0.0.27'
15
+ __version__ = '0.0.29'
@@ -10,14 +10,15 @@ from .commons_repos_client import CommonsReposClient
10
10
  class RateLimiter:
11
11
  """
12
12
  Controla el rate limiting para respetar los límites de API de GitHub.
13
- GitHub permite 5000 requests/hora autenticados = ~1.4 TPS.
13
+ GitHub App permite 15000 requests/hora autenticados = ~4.17 TPS.
14
+ Personal Access Token: 5000 requests/hora = ~1.4 TPS.
14
15
 
15
16
  Estrategia adaptativa:
16
17
  1. Cuando está cerca del límite (>90%), aumenta delays si falta >10min para reset
17
18
  2. Si faltan <10min para reset, reduce delay a 10ms para usar toda la cuota
18
19
  3. Exponential backoff solo para errores 403/429 de rate limit
19
20
  """
20
- def __init__(self, delay: float = 0.72, token: str = None):
21
+ def __init__(self, delay: float = 0.24, token: str = None):
21
22
  self.base_delay = delay
22
23
  self.current_delay = delay
23
24
  self.last_request_time = 0
@@ -104,7 +105,9 @@ class RateLimiter:
104
105
  class GitHubAPIClient:
105
106
  """
106
107
  Cliente para interactuar con la API de GitHub con rate limiting integrado.
107
- Controla automáticamente el TPS para no exceder los límites de GitHub (5000 req/hora).
108
+ Controla automáticamente el TPS para no exceder los límites de GitHub:
109
+ - GitHub App: 15000 req/hora (~4.17 TPS)
110
+ - Personal Token: 5000 req/hora (~1.4 TPS)
108
111
 
109
112
  Incluye:
110
113
  - Rate limiting adaptativo (ajusta delays según uso)
@@ -137,7 +140,7 @@ class GitHubAPIClient:
137
140
 
138
141
  # Inicializar rate limiter compartido con token
139
142
  if GitHubAPIClient._rate_limiter is None:
140
- GitHubAPIClient._rate_limiter = RateLimiter(delay=0.72, token=token)
143
+ GitHubAPIClient._rate_limiter = RateLimiter(delay=0.24, token=token)
141
144
 
142
145
  def _request_with_backoff(self, method: str, url: str, max_retries: int = 5, **kwargs):
143
146
  """
@@ -6,9 +6,7 @@ class Util:
6
6
 
7
7
  @staticmethod
8
8
  def get_secret_aws(secret_name: str, logger, region_name: str):
9
- """
10
- Retrieves AWS Secrets Manager secret and returns database credentials
11
- """
9
+ """Retrieves a secret from AWS Secrets Manager"""
12
10
  try:
13
11
  session = boto3.session.Session()
14
12
  client = session.client(
@@ -20,14 +18,6 @@ class Util:
20
18
  secret_string = get_secret_value_response['SecretString']
21
19
  secret_json = json.loads(secret_string)
22
20
 
23
- required_keys = ["password", "host", "port", "username", "dbname"]
24
- missing_keys = [key for key in required_keys if key not in secret_json]
25
-
26
- if missing_keys:
27
- msg = f"Missing required keys in AWS secret: {missing_keys}"
28
- logger.error(msg)
29
- raise KeyError(msg)
30
-
31
21
  return secret_json
32
22
 
33
23
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commons_metrics
3
- Version: 0.0.27
3
+ Version: 0.0.29
4
4
  Summary: A simple library for basic statistical calculations
5
5
  Author: Bancolombia
6
6
  Author-email: omar.david.pino@email.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='commons_metrics',
5
- version='0.0.27',
5
+ version='0.0.29',
6
6
  description='A simple library for basic statistical calculations',
7
7
  #long_description=open('USAGE.md').read(),
8
8
  #long_description_content_type='text/markdown',