dbos 0.10.0a3__py3-none-any.whl → 0.11.0__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/cli.py +1 -10
- dbos/dbos-config.schema.json +1 -2
- dbos/dbos_config.py +21 -0
- dbos/system_database.py +8 -3
- dbos/templates/hello/dbos-config.yaml.dbos +0 -1
- dbos/templates/hello/migrations/env.py.dbos +8 -1
- {dbos-0.10.0a3.dist-info → dbos-0.11.0.dist-info}/METADATA +2 -2
- {dbos-0.10.0a3.dist-info → dbos-0.11.0.dist-info}/RECORD +11 -11
- {dbos-0.10.0a3.dist-info → dbos-0.11.0.dist-info}/WHEEL +0 -0
- {dbos-0.10.0a3.dist-info → dbos-0.11.0.dist-info}/entry_points.txt +0 -0
- {dbos-0.10.0a3.dist-info → dbos-0.11.0.dist-info}/licenses/LICENSE +0 -0
dbos/cli.py
CHANGED
|
@@ -17,6 +17,7 @@ from typing_extensions import Annotated
|
|
|
17
17
|
|
|
18
18
|
from dbos import load_config
|
|
19
19
|
from dbos.application_database import ApplicationDatabase
|
|
20
|
+
from dbos.dbos_config import is_valid_app_name
|
|
20
21
|
from dbos.system_database import SystemDatabase
|
|
21
22
|
|
|
22
23
|
app = typer.Typer()
|
|
@@ -125,11 +126,9 @@ def copy_template(src_dir: str, project_name: str, config_mode: bool) -> None:
|
|
|
125
126
|
dst_dir = path.abspath(".")
|
|
126
127
|
|
|
127
128
|
package_name = project_name.replace("-", "_")
|
|
128
|
-
db_name = package_name if not package_name[0].isdigit() else f"_{package_name}"
|
|
129
129
|
ctx = {
|
|
130
130
|
"project_name": project_name,
|
|
131
131
|
"package_name": package_name,
|
|
132
|
-
"db_name": db_name,
|
|
133
132
|
"migration_command": "alembic upgrade head",
|
|
134
133
|
}
|
|
135
134
|
|
|
@@ -167,14 +166,6 @@ def get_project_name() -> typing.Union[str, None]:
|
|
|
167
166
|
return name
|
|
168
167
|
|
|
169
168
|
|
|
170
|
-
def is_valid_app_name(name: str) -> bool:
|
|
171
|
-
name_len = len(name)
|
|
172
|
-
if name_len < 3 or name_len > 30:
|
|
173
|
-
return False
|
|
174
|
-
match = re.match("^[a-z0-9-_]+$", name)
|
|
175
|
-
return True if match != None else False
|
|
176
|
-
|
|
177
|
-
|
|
178
169
|
@app.command()
|
|
179
170
|
def init(
|
|
180
171
|
project_name: Annotated[
|
dbos/dbos-config.schema.json
CHANGED
dbos/dbos_config.py
CHANGED
|
@@ -167,6 +167,14 @@ def load_config(config_file_path: str = "dbos-config.yaml") -> ConfigFile:
|
|
|
167
167
|
|
|
168
168
|
data = cast(ConfigFile, data)
|
|
169
169
|
|
|
170
|
+
if not is_valid_app_name(data["name"]):
|
|
171
|
+
raise DBOSInitializationError(
|
|
172
|
+
f'Invalid app name {data["name"]}. App names must be between 3 and 30 characters and contain only alphanumeric characters, dashes, and underscores.'
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
if "app_db_name" not in data["database"]:
|
|
176
|
+
data["database"]["app_db_name"] = app_name_to_db_name(data["name"])
|
|
177
|
+
|
|
170
178
|
if "local_suffix" in data["database"] and data["database"]["local_suffix"]:
|
|
171
179
|
data["database"]["app_db_name"] = f"{data['database']['app_db_name']}_local"
|
|
172
180
|
|
|
@@ -174,6 +182,19 @@ def load_config(config_file_path: str = "dbos-config.yaml") -> ConfigFile:
|
|
|
174
182
|
return data # type: ignore
|
|
175
183
|
|
|
176
184
|
|
|
185
|
+
def is_valid_app_name(name: str) -> bool:
|
|
186
|
+
name_len = len(name)
|
|
187
|
+
if name_len < 3 or name_len > 30:
|
|
188
|
+
return False
|
|
189
|
+
match = re.match("^[a-z0-9-_]+$", name)
|
|
190
|
+
return True if match != None else False
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def app_name_to_db_name(app_name: str) -> str:
|
|
194
|
+
name = app_name.replace("-", "_")
|
|
195
|
+
return name if not name[0].isdigit() else f"_{name}"
|
|
196
|
+
|
|
197
|
+
|
|
177
198
|
def set_env_vars(config: ConfigFile) -> None:
|
|
178
199
|
for env, value in config.get("env", {}).items():
|
|
179
200
|
if value is not None:
|
dbos/system_database.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import os
|
|
3
|
+
import re
|
|
3
4
|
import threading
|
|
4
5
|
import time
|
|
5
6
|
from enum import Enum
|
|
@@ -203,9 +204,13 @@ class SystemDatabase:
|
|
|
203
204
|
)
|
|
204
205
|
alembic_cfg = Config()
|
|
205
206
|
alembic_cfg.set_main_option("script_location", migration_dir)
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
# Alembic requires the % in URL-escaped parameters to itself be escaped to %%.
|
|
208
|
+
escaped_conn_string = re.sub(
|
|
209
|
+
r"%(?=[0-9A-Fa-f]{2})",
|
|
210
|
+
"%%",
|
|
211
|
+
self.engine.url.render_as_string(hide_password=False),
|
|
208
212
|
)
|
|
213
|
+
alembic_cfg.set_main_option("sqlalchemy.url", escaped_conn_string)
|
|
209
214
|
command.upgrade(alembic_cfg, "head")
|
|
210
215
|
|
|
211
216
|
self.notification_conn: Optional[psycopg.connection.Connection] = None
|
|
@@ -793,7 +798,7 @@ class SystemDatabase:
|
|
|
793
798
|
self.notification_conn.execute("LISTEN dbos_workflow_events_channel")
|
|
794
799
|
|
|
795
800
|
while self._run_background_processes:
|
|
796
|
-
gen = self.notification_conn.notifies(
|
|
801
|
+
gen = self.notification_conn.notifies()
|
|
797
802
|
for notify in gen:
|
|
798
803
|
channel = notify.channel
|
|
799
804
|
dbos_logger.debug(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import re
|
|
1
2
|
from logging.config import fileConfig
|
|
2
3
|
|
|
3
4
|
from alembic import context
|
|
@@ -15,7 +16,13 @@ if config.config_file_name is not None:
|
|
|
15
16
|
fileConfig(config.config_file_name)
|
|
16
17
|
|
|
17
18
|
# programmatically set the sqlalchemy.url field from DBOS Config
|
|
18
|
-
|
|
19
|
+
# Alembic requires the % in URL-escaped parameters to itself be escaped to %%.
|
|
20
|
+
escaped_conn_string = re.sub(
|
|
21
|
+
r"%(?=[0-9A-Fa-f]{2})",
|
|
22
|
+
"%%",
|
|
23
|
+
get_dbos_database_url(),
|
|
24
|
+
)
|
|
25
|
+
config.set_main_option("sqlalchemy.url", escaped_conn_string)
|
|
19
26
|
|
|
20
27
|
# add your model's MetaData object here
|
|
21
28
|
# for 'autogenerate' support
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dbos
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
4
4
|
Summary: Ultra-lightweight durable execution in Python
|
|
5
5
|
Author-Email: "DBOS, Inc." <contact@dbos.dev>
|
|
6
6
|
License: MIT
|
|
@@ -18,7 +18,7 @@ Requires-Dist: python-dateutil>=2.9.0.post0
|
|
|
18
18
|
Requires-Dist: fastapi[standard]>=0.115.2
|
|
19
19
|
Requires-Dist: psutil>=6.0.0
|
|
20
20
|
Requires-Dist: tomlkit>=0.13.2
|
|
21
|
-
Requires-Dist: psycopg>=3.
|
|
21
|
+
Requires-Dist: psycopg[binary]>=3.1
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
|
|
24
24
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
dbos-0.
|
|
2
|
-
dbos-0.
|
|
3
|
-
dbos-0.
|
|
4
|
-
dbos-0.
|
|
1
|
+
dbos-0.11.0.dist-info/METADATA,sha256=BCU2LDLJouqv1i4thBsekD1wGX5bjGjR0PHiKo8YET0,5015
|
|
2
|
+
dbos-0.11.0.dist-info/WHEEL,sha256=pM0IBB6ZwH3nkEPhtcp50KvKNX-07jYtnb1g1m6Z4Co,90
|
|
3
|
+
dbos-0.11.0.dist-info/entry_points.txt,sha256=z6GcVANQV7Uw_82H9Ob2axJX6V3imftyZsljdh-M1HU,54
|
|
4
|
+
dbos-0.11.0.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
|
5
5
|
dbos/__init__.py,sha256=-h1QgWNL11CiLlHEKa2ycAJVJw5SXYZ4BGNNWBAiE9k,726
|
|
6
6
|
dbos/admin_sever.py,sha256=Qg5T3YRrbPW05PR_99yAaxgo1ugQrAp_uTeTqSfjm_k,3397
|
|
7
7
|
dbos/application_database.py,sha256=knFK8We8y6WrIpnFCKvFq5hvSuFQqUuJqOqDpSVMCPI,5521
|
|
8
|
-
dbos/cli.py,sha256=
|
|
8
|
+
dbos/cli.py,sha256=ll2fMPbabGVcLasVET-BUUIzjXjdKOAQk_WZshlSWs0,8321
|
|
9
9
|
dbos/context.py,sha256=4MsxZdoh1WIsgoUsaxo0B6caGN6xq2WC60MzbBppzGk,17738
|
|
10
10
|
dbos/core.py,sha256=ggsRC2XicvNI1qqruEFoqxoTU5oSSnhMZvDih3AG_3A,30879
|
|
11
|
-
dbos/dbos-config.schema.json,sha256=
|
|
11
|
+
dbos/dbos-config.schema.json,sha256=tgtiirOTEdIRI27eI75UAER9sAV84CDnv5lRPt0qiuQ,5672
|
|
12
12
|
dbos/dbos.py,sha256=4_jOtcjoJdIF27wjs_jpsrl-LsyhZ22rod8J1UgKo1E,31021
|
|
13
|
-
dbos/dbos_config.py,sha256=
|
|
13
|
+
dbos/dbos_config.py,sha256=DYiyODyfE6WdcAJec5hVp0qgQU0C_TcZQlU-qr9mk7A,6361
|
|
14
14
|
dbos/decorators.py,sha256=lbPefsLK6Cya4cb7TrOcLglOpGT3pc6qjZdsQKlfZLg,629
|
|
15
15
|
dbos/error.py,sha256=UETk8CoZL-TO2Utn1-E7OSWelhShWmKM-fOlODMR9PE,3893
|
|
16
16
|
dbos/fastapi.py,sha256=gx9hlpxYOiwbuhSlbY9bn5C-F_FsCbrJvkX9ZAvDG6U,3418
|
|
@@ -37,18 +37,18 @@ dbos/scheduler/scheduler.py,sha256=KpcBid6qIbqLqLdrQQqEQnRBTvo_XwtVuvUba3Ed5Go,1
|
|
|
37
37
|
dbos/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
38
|
dbos/schemas/application_database.py,sha256=KeyoPrF7hy_ODXV7QNike_VFSD74QBRfQ76D7QyE9HI,966
|
|
39
39
|
dbos/schemas/system_database.py,sha256=7iw7eHJzEvkatHMOaHORoSvtfisF73wW5j8hRt_Ph14,5126
|
|
40
|
-
dbos/system_database.py,sha256=
|
|
40
|
+
dbos/system_database.py,sha256=DIYy4Tawwvu4XnN2IxhBMmZXwUX2Em80guKhlUXYICA,48267
|
|
41
41
|
dbos/templates/hello/README.md,sha256=GhxhBj42wjTt1fWEtwNriHbJuKb66Vzu89G4pxNHw2g,930
|
|
42
42
|
dbos/templates/hello/__package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
43
|
dbos/templates/hello/__package/main.py,sha256=eI0SS9Nwj-fldtiuSzIlIG6dC91GXXwdRsoHxv6S_WI,2719
|
|
44
44
|
dbos/templates/hello/__package/schema.py,sha256=7Z27JGC8yy7Z44cbVXIREYxtUhU4JVkLCp5Q7UahVQ0,260
|
|
45
45
|
dbos/templates/hello/alembic.ini,sha256=VKBn4Gy8mMuCdY7Hip1jmo3wEUJ1VG1aW7EqY0_n-as,3695
|
|
46
|
-
dbos/templates/hello/dbos-config.yaml.dbos,sha256=
|
|
47
|
-
dbos/templates/hello/migrations/env.py.dbos,sha256=
|
|
46
|
+
dbos/templates/hello/dbos-config.yaml.dbos,sha256=7yu1q8FAgOZnwJtU-e_5qgV-wkHRn6cqo-GEmk9rK8U,577
|
|
47
|
+
dbos/templates/hello/migrations/env.py.dbos,sha256=GUV6sjkDzf9Vl6wkGEd0RSkK-ftRfV6EUwSQdd0qFXg,2392
|
|
48
48
|
dbos/templates/hello/migrations/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
|
|
49
49
|
dbos/templates/hello/migrations/versions/2024_07_31_180642_init.py,sha256=U5thFWGqNN4QLrNXT7wUUqftIFDNE5eSdqD8JNW1mec,942
|
|
50
50
|
dbos/templates/hello/start_postgres_docker.py,sha256=lQVLlYO5YkhGPEgPqwGc7Y8uDKse9HsWv5fynJEFJHM,1681
|
|
51
51
|
dbos/tracer.py,sha256=GaXDhdKKF_IQp5SAMipGXiDVwteRKjNbrXyYCH1mor0,2520
|
|
52
52
|
dbos/utils.py,sha256=lwRymY-y7GprAS8pKmbICQvOJd5eGxKGTxCMFn0OwaQ,1739
|
|
53
53
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
|
54
|
-
dbos-0.
|
|
54
|
+
dbos-0.11.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|