dbos 0.24.0a8__py3-none-any.whl → 0.24.0a9__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 dbos might be problematic. Click here for more details.

dbos/_dbos_config.py CHANGED
@@ -202,7 +202,7 @@ def translate_dbos_config_to_config_file(config: DBOSConfig) -> ConfigFile:
202
202
  return translated_config
203
203
 
204
204
 
205
- def _substitute_env_vars(content: str) -> str:
205
+ def _substitute_env_vars(content: str, silent: bool = False) -> str:
206
206
  regex = r"\$\{([^}]+)\}" # Regex to match ${VAR_NAME} style placeholders
207
207
 
208
208
  def replace_func(match: re.Match[str]) -> str:
@@ -210,7 +210,7 @@ def _substitute_env_vars(content: str) -> str:
210
210
  value = os.environ.get(
211
211
  var_name, ""
212
212
  ) # If the env variable is not set, return an empty string
213
- if value == "":
213
+ if value == "" and not silent:
214
214
  dbos_logger.warning(
215
215
  f"Variable {var_name} would be substituted from the process environment into dbos-config.yaml, but is not defined"
216
216
  )
@@ -233,7 +233,7 @@ def get_dbos_database_url(config_file_path: str = DBOS_CONFIG_PATH) -> str:
233
233
  str: Database URL for the application database
234
234
 
235
235
  """
236
- dbos_config = process_config(data=load_config(config_file_path))
236
+ dbos_config = load_config(config_file_path, run_process_config=True)
237
237
  db_url = URL.create(
238
238
  "postgresql+psycopg",
239
239
  username=dbos_config["database"]["username"],
@@ -267,7 +267,7 @@ def load_config(
267
267
 
268
268
  with open(config_file_path, "r") as file:
269
269
  content = file.read()
270
- substituted_content = _substitute_env_vars(content)
270
+ substituted_content = _substitute_env_vars(content, silent=silent)
271
271
  data = yaml.safe_load(substituted_content)
272
272
 
273
273
  if not isinstance(data, dict):
@@ -299,7 +299,6 @@ def process_config(
299
299
  data: ConfigFile,
300
300
  silent: bool = False,
301
301
  ) -> ConfigFile:
302
-
303
302
  if "name" not in data:
304
303
  raise DBOSInitializationError(f"Configuration must specify an application name")
305
304
 
@@ -337,25 +336,9 @@ def process_config(
337
336
  if "app_db_name" not in data["database"] or not (data["database"]["app_db_name"]):
338
337
  data["database"]["app_db_name"] = _app_name_to_db_name(data["name"])
339
338
 
340
- # Load the DB connection file. Use its values for missing fields from dbos-config.yaml. Use defaults otherwise.
339
+ # Load the DB connection file. Use its values for missing connection parameters. Use defaults otherwise.
341
340
  db_connection = load_db_connection()
342
- if not silent:
343
- if os.getenv("DBOS_DBHOST"):
344
- print(
345
- "[bold blue]Loading database connection parameters from debug environment variables[/bold blue]"
346
- )
347
- elif data["database"].get("hostname"):
348
- print(
349
- "[bold blue]Loading database connection parameters from dbos-config.yaml[/bold blue]"
350
- )
351
- elif db_connection.get("hostname"):
352
- print(
353
- "[bold blue]Loading database connection parameters from .dbos/db_connection[/bold blue]"
354
- )
355
- else:
356
- print(
357
- "[bold blue]Using default database connection parameters (localhost)[/bold blue]"
358
- )
341
+ connection_passed_in = data["database"].get("hostname", None) is not None
359
342
 
360
343
  dbos_dbport: Optional[int] = None
361
344
  dbport_env = os.getenv("DBOS_DBPORT")
@@ -424,6 +407,28 @@ def process_config(
424
407
  # Check the connectivity to the database and make sure it's properly configured
425
408
  # Note, never use db wizard if the DBOS is running in debug mode (i.e. DBOS_DEBUG_WORKFLOW_ID env var is set)
426
409
  debugWorkflowId = os.getenv("DBOS_DEBUG_WORKFLOW_ID")
410
+
411
+ # Pretty-print where we've loaded database connection information from, respecting the log level
412
+ if not silent and logs["logLevel"] == "INFO" or logs["logLevel"] == "DEBUG":
413
+ d = data["database"]
414
+ conn_string = f"postgresql://{d['username']}:*****@{d['hostname']}:{d['port']}/{d['app_db_name']}"
415
+ if os.getenv("DBOS_DBHOST"):
416
+ print(
417
+ f"[bold blue]Loading database connection string from debug environment variables: {conn_string}[/bold blue]"
418
+ )
419
+ elif connection_passed_in:
420
+ print(
421
+ f"[bold blue]Using database connection string: {conn_string}[/bold blue]"
422
+ )
423
+ elif db_connection.get("hostname"):
424
+ print(
425
+ f"[bold blue]Loading database connection string from .dbos/db_connection: {conn_string}[/bold blue]"
426
+ )
427
+ else:
428
+ print(
429
+ f"[bold blue]Using default database connection string: {conn_string}[/bold blue]"
430
+ )
431
+
427
432
  if use_db_wizard and debugWorkflowId is None:
428
433
  data = db_wizard(data)
429
434
 
@@ -539,7 +544,7 @@ def check_config_consistency(
539
544
  ) -> None:
540
545
  # First load the config file and check whether it is present
541
546
  try:
542
- config = load_config(config_file_path)
547
+ config = load_config(config_file_path, silent=True, run_process_config=False)
543
548
  except FileNotFoundError:
544
549
  dbos_logger.debug(
545
550
  f"No configuration file {config_file_path} found. Skipping consistency check with provided config."
dbos/cli/cli.py CHANGED
@@ -41,7 +41,7 @@ def _on_windows() -> bool:
41
41
  help="Start your DBOS application using the start commands in 'dbos-config.yaml'"
42
42
  )
43
43
  def start() -> None:
44
- config = load_config()
44
+ config = load_config(run_process_config=False, silent=True)
45
45
  start_commands = config["runtimeConfig"]["start"]
46
46
  typer.echo("Executing start commands from 'dbos-config.yaml'")
47
47
  for command in start_commands:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 0.24.0a8
3
+ Version: 0.24.0a9
4
4
  Summary: Ultra-lightweight durable execution in Python
5
5
  Author-Email: "DBOS, Inc." <contact@dbos.dev>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
- dbos-0.24.0a8.dist-info/METADATA,sha256=XsFBfl6GM7-vBod-qlcQ0QphxHaMNGPaeYloFB02pLE,5555
2
- dbos-0.24.0a8.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- dbos-0.24.0a8.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-0.24.0a8.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-0.24.0a9.dist-info/METADATA,sha256=y4HayRlu1LoigxYjjz8rYWsgIHS6j47Yb4EWDGQQ4fE,5555
2
+ dbos-0.24.0a9.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ dbos-0.24.0a9.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-0.24.0a9.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=uq9LP5uY96kIS9N0yKqlvDwADmtg_Hl30uSUhyuUr-4,754
6
6
  dbos/__main__.py,sha256=P7jAr-7L9XE5mrsQ7i4b-bLr2ap1tCQfhMByLCRWDj0,568
7
7
  dbos/_admin_server.py,sha256=YiVn5lywz2Vg8_juyNHOYl0HVEy48--7b4phwK7r92o,5732
@@ -17,7 +17,7 @@ dbos/_core.py,sha256=8TTIj5shcm5hpKjouMA4VzMWl7R7MJlU-mAHB6xQBxE,37585
17
17
  dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
18
18
  dbos/_db_wizard.py,sha256=YEW2qoy6hfHQv2fZ_4nHiPUeHMFofPpNTolJ1Kvw7AQ,8394
19
19
  dbos/_dbos.py,sha256=AiTuQYoaq9H5qH2dMsIVwNsF645PjBWzj9rjpa9snwo,42824
20
- dbos/_dbos_config.py,sha256=GEjS_EfRIVHBiQDn0tcVftg8pesKFkIP5HuqajAJ9rA,19751
20
+ dbos/_dbos_config.py,sha256=-DnOQ5gk3I8RPxNkL3GsAkaYvL8jv5umS8Xv5V7UQkw,20217
21
21
  dbos/_debug.py,sha256=mmgvLkqlrljMBBow9wk01PPur9kUf2rI_11dTJXY4gw,1822
22
22
  dbos/_error.py,sha256=B6Y9XLS1f6yrawxB2uAEYFMxFwk9BHhdxPNddKco-Fw,5399
23
23
  dbos/_fastapi.py,sha256=ke03vqsSYDnO6XeOtOVFXj0-f-v1MGsOxa9McaROvNc,3616
@@ -61,8 +61,8 @@ dbos/_utils.py,sha256=wjOJzxN66IzL9p4dwcEmQACRQah_V09G6mJI2exQfOM,155
61
61
  dbos/_workflow_commands.py,sha256=CEzR5XghoZscbc2RHb9G-7Eoo4MMuzfeTo-QBZu4VPY,4690
62
62
  dbos/cli/_github_init.py,sha256=Y_bDF9gfO2jB1id4FV5h1oIxEJRWyqVjhb7bNEa5nQ0,3224
63
63
  dbos/cli/_template_init.py,sha256=AfuMaO8bmr9WsPNHr6j2cp7kjVVZDUpH7KpbTg0hhFs,2722
64
- dbos/cli/cli.py,sha256=ThomRytw7EP5iOcrjEgwnpaWgXNTLfnFEBBvCGHxtJs,15590
64
+ dbos/cli/cli.py,sha256=pet2vf4GLlSDfxfQbsplM9uewD6pJK2ZpLgZlwgBU5w,15627
65
65
  dbos/dbos-config.schema.json,sha256=HtF_njVTGHLdzBGZ4OrGQz3qbPPT0Go-iwd1PgFVTNg,5847
66
66
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
67
67
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
68
- dbos-0.24.0a8.dist-info/RECORD,,
68
+ dbos-0.24.0a9.dist-info/RECORD,,