iatoolkit 0.3.6__py3-none-any.whl → 0.3.7__py3-none-any.whl

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 iatoolkit might be problematic. Click here for more details.

iatoolkit/iatoolkit.py CHANGED
@@ -19,10 +19,10 @@ import click
19
19
  from typing import Optional, Dict, Any
20
20
  from repositories.database_manager import DatabaseManager
21
21
  from injector import Binder, singleton, Injector
22
+ from importlib.metadata import version as _pkg_version, PackageNotFoundError
22
23
 
23
- VERSION = "2.0.0"
24
24
 
25
- # global variable for yhe unique instance of IAToolkit
25
+ # global variable for the unique instance of IAToolkit
26
26
  _iatoolkit_instance: Optional['IAToolkit'] = None
27
27
 
28
28
 
@@ -53,6 +53,7 @@ class IAToolkit:
53
53
  self.app = None
54
54
  self.db_manager = None
55
55
  self._injector = None
56
+ self.version = "0.0.0+dev"
56
57
 
57
58
  @classmethod
58
59
  def get_instance(cls) -> 'IAToolkit':
@@ -69,6 +70,9 @@ class IAToolkit:
69
70
  Creates, configures, and returns the Flask application instance.
70
71
  this is the main entry point for the application factory.
71
72
  """
73
+ if self._initialized and self.app:
74
+ return self.app
75
+
72
76
  self._setup_logging()
73
77
 
74
78
  # Step 1: Create the Flask app instance
@@ -94,7 +98,13 @@ class IAToolkit:
94
98
  self._setup_cli_commands()
95
99
  self._setup_context_processors()
96
100
 
97
- logging.info(f"🎉 IAToolkit v{VERSION} inicializado correctamente")
101
+ try:
102
+ self.version = _pkg_version("iatoolkit")
103
+ except PackageNotFoundError:
104
+ pass
105
+
106
+ logging.info(f"🎉 IAToolkit v{self.version} inicializado correctamente")
107
+ self._initialized = True
98
108
  return self.app
99
109
 
100
110
  def _get_config_value(self, key: str, default=None):
@@ -133,7 +143,7 @@ class IAToolkit:
133
143
  is_dev = self._get_config_value('FLASK_ENV') == 'development'
134
144
 
135
145
  self.app.config.update({
136
- 'VERSION': VERSION,
146
+ 'VERSION': self.version,
137
147
  'SECRET_KEY': self._get_config_value('FLASK_SECRET_KEY', 'iatoolkit-default-secret'),
138
148
  'SESSION_COOKIE_SAMESITE': "None" if is_https else "Lax",
139
149
  'SESSION_COOKIE_SECURE': is_https,
@@ -192,9 +202,9 @@ class IAToolkit:
192
202
  """🌐 Configura CORS"""
193
203
  # Origins por defecto para desarrollo
194
204
  default_origins = [
195
- "http://localhost:3000",
196
205
  "http://localhost:5001",
197
- "http://127.0.0.1:5001"
206
+ "http://127.0.0.1:5001",
207
+ os.getenv('IATOOLKIT_BASE_URL')
198
208
  ]
199
209
 
200
210
  # Obtener origins adicionales desde configuración/env
@@ -364,7 +374,7 @@ class IAToolkit:
364
374
  def inject_globals():
365
375
  return {
366
376
  'url_for': url_for,
367
- 'iatoolkit_version': VERSION,
377
+ 'iatoolkit_version': self.version,
368
378
  'app_name': 'IAToolkit',
369
379
  'user': SessionManager.get('user'),
370
380
  'user_company': SessionManager.get('company_short_name'),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iatoolkit
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary: IAToolkit
5
5
  Author: Fernando Libedinsky
6
6
  License-Expression: MIT
@@ -1,7 +1,7 @@
1
1
  iatoolkit/__init__.py,sha256=JdcXIcvFFTMy2XI9ccEws_pCklilDkPPEb7RaQNf7oY,1444
2
2
  iatoolkit/base_company.py,sha256=VWfpNofFlmgHQQK8BCw2KSOPLd2DM9eA68lGQ3SDE7M,1639
3
3
  iatoolkit/company_registry.py,sha256=cRaez-VBo1icnUNKmkQqo_Xlr8UKWFoYEMZ70XP6Jgk,2702
4
- iatoolkit/iatoolkit.py,sha256=K7d8fKKTk-Q-sMW6Ip58oleiosRP4e-pdc3E5GSoSMw,16450
4
+ iatoolkit/iatoolkit.py,sha256=SHuCY9SAThT91qs9StTBwI4U-1ttYbVfRoma1j_7E8g,16793
5
5
  services/__init__.py,sha256=fSvSfIcPW1dHwTBY1hQ5dBEhaoorzk_GzR4G46gD8tY,173
6
6
  services/api_service.py,sha256=InIKTc64BWcp4U4tYKHz28x4ErPxIfvR9x3ZlxJZlXs,2911
7
7
  services/benchmark_service.py,sha256=g9JVrmAqIe_iI0D1DwdQ6DJ2_FJRCTndarESNSVfhbw,5907
@@ -21,7 +21,7 @@ services/sql_service.py,sha256=H7CIPpXTcxLXLojD2fBFr_mIAD0PW1vEJhKHLfJi4Hk,1418
21
21
  services/tasks_service.py,sha256=hHJDlcsSOPtEleD6_Vv3pocfxWNmthIhmZSdnoWFpEM,6861
22
22
  services/user_feedback_service.py,sha256=YtCndRBekDEWYEbac431Ksn2gMO5iBrI3WqKK0xtShE,2513
23
23
  services/user_session_context_service.py,sha256=5qn7fqpuiU8KgMpU4M5-iRUsETumz1raBw-EeZLuE1A,3868
24
- iatoolkit-0.3.6.dist-info/METADATA,sha256=njGTmLJWG0JmIXWV2d50TDtYlHIhGL7lS-6wgELu58Q,8801
25
- iatoolkit-0.3.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
- iatoolkit-0.3.6.dist-info/top_level.txt,sha256=dqlBbmgo9okD9d_WMR9uYzdup7Rxgj26yFF85jRGeu4,19
27
- iatoolkit-0.3.6.dist-info/RECORD,,
24
+ iatoolkit-0.3.7.dist-info/METADATA,sha256=9veR_--w5S2gN0OyGvai1N0BX7XVDwzaLmwT88IFmRU,8801
25
+ iatoolkit-0.3.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ iatoolkit-0.3.7.dist-info/top_level.txt,sha256=dqlBbmgo9okD9d_WMR9uYzdup7Rxgj26yFF85jRGeu4,19
27
+ iatoolkit-0.3.7.dist-info/RECORD,,