satisfactoscript 0.5.2__tar.gz → 0.5.4__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 (24) hide show
  1. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/PKG-INFO +1 -1
  2. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/pyproject.toml +1 -1
  3. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/core/core.py +37 -28
  4. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript.egg-info/PKG-INFO +1 -1
  5. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/README.md +0 -0
  6. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/setup.cfg +0 -0
  7. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/__init__.py +0 -0
  8. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/agentic/__init__.py +0 -0
  9. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/agentic/agent.py +0 -0
  10. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/core/__init__.py +0 -0
  11. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/core/config.py +0 -0
  12. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/core/loaders.py +0 -0
  13. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/core/registry.py +0 -0
  14. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/semantic/__init__.py +0 -0
  15. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript/semantic/semantic.py +0 -0
  16. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript.egg-info/SOURCES.txt +0 -0
  17. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript.egg-info/dependency_links.txt +0 -0
  18. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript.egg-info/requires.txt +0 -0
  19. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/src/satisfactoscript.egg-info/top_level.txt +0 -0
  20. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/tests/test_config.py +0 -0
  21. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/tests/test_core.py +0 -0
  22. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/tests/test_dummy.py +0 -0
  23. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/tests/test_loaders.py +0 -0
  24. {satisfactoscript-0.5.2 → satisfactoscript-0.5.4}/tests/test_registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: satisfactoscript
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: An Enterprise-Ready, Declarative Data Engineering Framework for Databricks Lakehouse.
5
5
  Author: julhouba
6
6
  Classifier: Programming Language :: Python :: 3
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "satisfactoscript"
7
- version = "0.5.2"
7
+ version = "0.5.4"
8
8
  description = "An Enterprise-Ready, Declarative Data Engineering Framework for Databricks Lakehouse."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -159,15 +159,14 @@ class SatisfactoEngine:
159
159
  # ======================================================================
160
160
  # 0. CHARGEMENT DES VARIABLES D'ENVIRONNEMENT (.env)
161
161
  # ======================================================================
162
- current_file_path = os.path.abspath(__file__)
163
- project_root = os.path.dirname(os.path.dirname(current_file_path))
164
- env_path = os.path.join(project_root, ".env")
162
+ # Dynamically find the .env file starting from the current working directory
163
+ env_path = self._find_file_upwards(".env")
165
164
 
166
- if os.path.exists(env_path):
165
+ if env_path:
167
166
  load_dotenv(env_path)
168
- print(" 🔒 [Init] Sécurité : Variables d'environnement chargées depuis .env")
167
+ print(f" 🔒 [Init] Sécurité : Variables d'environnement chargées depuis {env_path}")
169
168
  else:
170
- print(" ⚠️ [Init] Aucun fichier .env trouvé à la racine.")
169
+ print(" ⚠️ [Init] Aucun fichier .env trouvé dans le répertoire courant ou ses parents.")
171
170
 
172
171
  # ======================================================================
173
172
  # 1. AUTO-DÉTECTION DE SPARK (Compatible Web & PyCharm/Local)
@@ -193,7 +192,12 @@ class SatisfactoEngine:
193
192
  # This relies on the environment having valid Databricks configuration
194
193
  # e.g., DATABRICKS_HOST, DATABRICKS_TOKEN, DATABRICKS_CLUSTER_ID
195
194
  # or a valid ~/.databrickscfg file.
196
- self.spark = DatabricksSession.builder.sdkConfig(Config()).getOrCreate()
195
+ # We pass a specific cluster_id if it exists in env, else it relies on profile
196
+ conf = Config()
197
+ if os.getenv("DATABRICKS_CLUSTER_ID"):
198
+ conf.cluster_id = os.getenv("DATABRICKS_CLUSTER_ID")
199
+
200
+ self.spark = DatabricksSession.builder.sdkConfig(conf).getOrCreate()
197
201
  print(" [Init] 🚀 Remote DatabricksSession (Databricks Connect) initialized.")
198
202
  except Exception as e:
199
203
  print(f" [Init] ⚠️ Databricks Connect detection failed: {e}. Falling back to standard Spark.")
@@ -212,28 +216,14 @@ class SatisfactoEngine:
212
216
  if config_path:
213
217
  self._load_config_from_yaml(config_path)
214
218
  else:
215
- # Recherche automatique basée sur l'emplacement de ce fichier core.py
216
- current_file_path = os.path.abspath(__file__)
217
- framework_dir = os.path.dirname(current_file_path)
218
- project_root = os.path.dirname(framework_dir)
219
-
220
- # Liste des candidats
221
- candidates = [
222
- os.path.join(project_root, "config.yaml"), # ../config.yaml (Standard)
223
- os.path.join(os.getcwd(), "config.yaml"), # ./config.yaml
224
- os.path.join(os.getcwd(), "../..", "config.yaml") # ../config.yaml
225
- ]
226
-
227
- found = False
228
- for path in candidates:
229
- if os.path.exists(path):
230
- self._load_config_from_yaml(path)
231
- found = True
232
- break
233
-
234
- if not found:
219
+ # Recherche automatique basée sur l'emplacement d'exécution
220
+ found_config_path = self._find_file_upwards("config.yaml")
221
+
222
+ if found_config_path:
223
+ self._load_config_from_yaml(found_config_path)
224
+ else:
235
225
  raise FileNotFoundError(
236
- f"CRITICAL: 'config.yaml' not found. Searched in: {candidates}. "
226
+ "CRITICAL: 'config.yaml' not found in current directory or any parent directory. "
237
227
  "Please check file location or pass 'config_path' explicitly."
238
228
  )
239
229
 
@@ -259,6 +249,25 @@ class SatisfactoEngine:
259
249
 
260
250
  print(f"✅ Framework Ready. Env: {self.env} | DB: {self.db} | Suffix: '{self.schema_suffix}'")
261
251
 
252
+ def _find_file_upwards(self, filename):
253
+ """
254
+ Searches for a file starting from current working directory and moving up.
255
+ Returns absolute path if found, else None.
256
+ """
257
+ current_dir = os.getcwd()
258
+
259
+ # Loop until we hit the root of the filesystem
260
+ while True:
261
+ check_path = os.path.join(current_dir, filename)
262
+ if os.path.exists(check_path):
263
+ return check_path
264
+
265
+ parent_dir = os.path.dirname(current_dir)
266
+ if parent_dir == current_dir:
267
+ # We hit the filesystem root (e.g. /) without finding the file
268
+ return None
269
+ current_dir = parent_dir
270
+
262
271
  def _load_config_from_yaml(self, config_path):
263
272
  """
264
273
  Loads configuration from YAML and determines the active environment.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: satisfactoscript
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: An Enterprise-Ready, Declarative Data Engineering Framework for Databricks Lakehouse.
5
5
  Author: julhouba
6
6
  Classifier: Programming Language :: Python :: 3