dbos 0.6.0a0__py3-none-any.whl → 0.6.0a3__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.

@@ -2,13 +2,12 @@
2
2
 
3
3
  # This is a sample app built with DBOS and FastAPI.
4
4
  # It displays greetings to visitors and keeps track of how
5
- # many times each visitor has been greeted.
5
+ # many times visitors have been greeted.
6
6
 
7
7
  # First, let's do imports, create a FastAPI app, and initialize DBOS.
8
8
 
9
9
  from fastapi import FastAPI
10
10
  from fastapi.responses import HTMLResponse
11
- from sqlalchemy.dialects.postgresql import insert
12
11
 
13
12
  from dbos import DBOS
14
13
 
@@ -19,33 +18,26 @@ DBOS(fastapi=app)
19
18
 
20
19
  # Next, let's write a function that greets visitors.
21
20
  # To make it more interesting, we'll keep track of how
22
- # many times each visitor has been greeted and store
21
+ # many times visitors have been greeted and store
23
22
  # the count in the database.
24
23
 
25
- # We annotate this function with @DBOS.transaction to
26
- # access to an automatically-configured database client,
27
- # (DBOS.sql_sesion) then implement the database operations
28
- # using SQLAlchemy. We serve this function from a FastAPI endpoint.
24
+ # We implement the database operations using SQLAlchemy
25
+ # and serve the function from a FastAPI endpoint.
26
+ # We annotate it with @DBOS.transaction() to access
27
+ # an automatically-configured database client.
29
28
 
30
29
 
31
30
  @app.get("/greeting/{name}")
32
31
  @DBOS.transaction()
33
32
  def example_transaction(name: str) -> str:
34
- query = (
35
- insert(dbos_hello)
36
- .values(name="dbos", greet_count=1)
37
- .on_conflict_do_update(
38
- index_elements=["name"], set_={"greet_count": dbos_hello.c.greet_count + 1}
39
- )
40
- .returning(dbos_hello.c.greet_count)
41
- )
33
+ query = dbos_hello.insert().values(name=name).returning(dbos_hello.c.greet_count)
42
34
  greet_count = DBOS.sql_session.execute(query).scalar_one()
43
35
  greeting = f"Greetings, {name}! You have been greeted {greet_count} times."
44
36
  DBOS.logger.info(greeting)
45
37
  return greeting
46
38
 
47
39
 
48
- # Finally, let's use FastAPI to serve a simple HTML readme
40
+ # Finally, let's use FastAPI to serve an HTML + CSS readme
49
41
  # from the root path.
50
42
 
51
43
 
@@ -74,13 +66,14 @@ def readme() -> HTMLResponse:
74
66
  return HTMLResponse(readme)
75
67
 
76
68
 
77
- # To run this app locally:
78
- # - Make sure you have a Postgres database to connect
79
- # - "dbos migrate" to set up your database tables
80
- # - "dbos start" to start the app
81
- # - Visit localhost:8000 to see your app!
82
-
83
69
  # To deploy this app to DBOS Cloud:
84
70
  # - "npm i -g @dbos-inc/dbos-cloud@latest" to install the Cloud CLI (requires Node)
85
71
  # - "dbos-cloud app deploy" to deploy your app
86
72
  # - Deploy outputs a URL--visit it to see your app!
73
+
74
+
75
+ # To run this app locally:
76
+ # - Make sure you have a Postgres database to connect to
77
+ # - "dbos migrate" to set up your database tables
78
+ # - "dbos start" to start the app
79
+ # - Visit localhost:8000 to see your app!
@@ -5,6 +5,6 @@ metadata = MetaData()
5
5
  dbos_hello = Table(
6
6
  "dbos_hello",
7
7
  metadata,
8
- Column("name", String, primary_key=True),
9
- Column("greet_count", Integer, default=0),
8
+ Column("greet_count", Integer, primary_key=True, autoincrement=True),
9
+ Column("name", String, nullable=False),
10
10
  )
@@ -22,9 +22,9 @@ def upgrade() -> None:
22
22
  # ### commands auto generated by Alembic - please adjust! ###
23
23
  op.create_table(
24
24
  "dbos_hello",
25
+ sa.Column("greet_count", sa.Integer(), autoincrement=True, nullable=False),
25
26
  sa.Column("name", sa.String(), nullable=False),
26
- sa.Column("greet_count", sa.Integer(), nullable=True),
27
- sa.PrimaryKeyConstraint("name"),
27
+ sa.PrimaryKeyConstraint("greet_count"),
28
28
  )
29
29
  # ### end Alembic commands ###
30
30
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 0.6.0a0
3
+ Version: 0.6.0a3
4
4
  Summary: Ultra-lightweight durable execution in Python
5
5
  Author-Email: "DBOS, Inc." <contact@dbos.dev>
6
6
  License: MIT
@@ -21,20 +21,17 @@ Requires-Dist: psutil>=6.0.0
21
21
  Requires-Dist: tomlkit>=0.13.2
22
22
  Description-Content-Type: text/markdown
23
23
 
24
- ## 🚀 DBOS Transact - Ultra-Lightweight Durable Execution in Python 🚀
25
24
 
26
- ---
25
+ <div align="center">
27
26
 
28
- 📚 **Documentation**: Under Construction 🚧
27
+ # DBOS Transact: Ultra-Lightweight Durable Execution
29
28
 
30
- 💬 **Join the Discussion**: [Discord Community](https://discord.gg/fMwQjeW5zg)
29
+ #### [Documentation](https://docs.dbos.dev/) &nbsp;&nbsp;•&nbsp;&nbsp; [Examples](https://docs.dbos.dev/examples) &nbsp;&nbsp;•&nbsp;&nbsp; [Github](https://github.com/dbos-inc) &nbsp;&nbsp;•&nbsp;&nbsp; [Discord](https://discord.com/invite/jsmC6pXGgX)
30
+ </div>
31
31
 
32
32
  ---
33
33
 
34
-
35
- **DBOS Python is under construction! 🚧🚧🚧 Check back regularly for updates, release coming in mid-September!**
36
-
37
- DBOS Transact is a **Python library** providing ultra-lightweight durable execution.
34
+ DBOS Transact is a Python library providing **ultra-lightweight durable execution**.
38
35
  For example:
39
36
 
40
37
  ```python
@@ -69,14 +66,14 @@ Some more cool features include:
69
66
 
70
67
  ## Getting Started
71
68
 
72
- To try out the latest pre-release version, install and configure with:
69
+ Install and configure with:
73
70
 
74
71
  ```shell
75
- pip install --pre dbos
72
+ pip install dbos
76
73
  dbos init --config
77
74
  ```
78
75
 
79
- Try it out with this simple program (requires Postgres):
76
+ Then, try it out with this simple program (requires Postgres):
80
77
 
81
78
  ```python
82
79
  from fastapi import FastAPI
@@ -106,22 +103,27 @@ def endpoint():
106
103
  workflow()
107
104
  ```
108
105
 
109
- Save the program into `main.py`, tell it your local Postgres password via `export PGPASSWORD=<your password>` and start it with `fastapi run`.
110
- Visit `localhost:8000` in your browser (or curl it) to start the workflow.
106
+ Save the program into `main.py`, edit `dbos-config.yaml` to configure your Postgres connection settings, and start it with `fastapi run`.
107
+ Visit `localhost:8000` in your browser to start the workflow.
111
108
  When prompted, press `Control + \` to force quit your application.
112
109
  It should crash midway through the workflow, having completed step one but not step two.
113
110
  Then, restart your app with `fastapi run`.
114
111
  It should resume the workflow from where it left off, completing step two without re-executing step one.
115
112
 
116
- To learn how to build more complex examples, see our programming guide (coming soon).
113
+ To learn how to build more complex workflows, see our [programming guide](https://docs.dbos.dev/python/programming-guide) or [examples](https://docs.dbos.dev/examples).
117
114
 
118
115
  ## Documentation
119
116
 
120
- Coming soon! 🚧
117
+ [https://docs.dbos.dev](https://docs.dbos.dev)
121
118
 
122
119
  ## Examples
123
120
 
124
- Check out some cool demo apps here: [https://github.com/dbos-inc/dbos-demo-apps/tree/main/python](https://github.com/dbos-inc/dbos-demo-apps/tree/main/python)
121
+
122
+ - [**AI-Powered Slackbot**](https://docs.dbos.dev/python/examples/rag-slackbot) &mdash; A Slackbot that answers questions about previous Slack conversations, using DBOS to durably orchestrate its RAG pipeline.
123
+ - [**Widget Store**](https://docs.dbos.dev/python/examples/widget-store) &mdash; An online storefront that uses DBOS durable workflows to be resilient to any failure.
124
+ - [**Earthquake Tracker**](https://docs.dbos.dev/python/examples/earthquake-tracker) &mdash; A real-time earthquake dashboard that uses DBOS to stream data from the USGS into Postgres, then visualizes it with Streamlit.
125
+
126
+ More examples [here](https://docs.dbos.dev/examples)!
125
127
 
126
128
  ## Community
127
129
 
@@ -1,7 +1,7 @@
1
- dbos-0.6.0a0.dist-info/METADATA,sha256=yZxiID1qC-U9PUOX1bPV0Dt1ve_jEI2VCxiasiSxvQM,4443
2
- dbos-0.6.0a0.dist-info/WHEEL,sha256=rSwsxJWe3vzyR5HCwjWXQruDgschpei4h_giTm0dJVE,90
3
- dbos-0.6.0a0.dist-info/entry_points.txt,sha256=3PmOPbM4FYxEmggRRdJw0oAsiBzKR8U0yx7bmwUmMOM,39
4
- dbos-0.6.0a0.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-0.6.0a3.dist-info/METADATA,sha256=6YdSITRGDjunFt92A4EPg9RDR__piiogGZ8NsEXYrKM,5000
2
+ dbos-0.6.0a3.dist-info/WHEEL,sha256=rSwsxJWe3vzyR5HCwjWXQruDgschpei4h_giTm0dJVE,90
3
+ dbos-0.6.0a3.dist-info/entry_points.txt,sha256=3PmOPbM4FYxEmggRRdJw0oAsiBzKR8U0yx7bmwUmMOM,39
4
+ dbos-0.6.0a3.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=s3nYPf5yGR4XxiXS_JQbL8WVTjnnwr5EpFoCaCMrFxg,582
6
6
  dbos/admin_sever.py,sha256=Qg5T3YRrbPW05PR_99yAaxgo1ugQrAp_uTeTqSfjm_k,3397
7
7
  dbos/application_database.py,sha256=1K3kE96BgGi_QWOd2heXluyNTwFAwlUVuAR6JKKUqf0,5659
@@ -33,15 +33,15 @@ dbos/schemas/system_database.py,sha256=5V3vqnEzry0Hn7ZbVS9Gs_dJKia8uX8p7mGC82Ru8
33
33
  dbos/system_database.py,sha256=BZ8yE79FH9NZhEt8AAYNXy0-wMcKLBAq8VPdZbfidR4,40564
34
34
  dbos/templates/hello/README.md,sha256=GhxhBj42wjTt1fWEtwNriHbJuKb66Vzu89G4pxNHw2g,930
35
35
  dbos/templates/hello/__package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- dbos/templates/hello/__package/main.py,sha256=LFN48qBWt-xsf21Cg1llf5Grr0e7Il_7lcyi60sK4ec,2984
37
- dbos/templates/hello/__package/schema.py,sha256=XOSeq_vFG0vN1LxWPob-L9K65jq9OMCz2qOmvw5CKN8,235
36
+ dbos/templates/hello/__package/main.py,sha256=eI0SS9Nwj-fldtiuSzIlIG6dC91GXXwdRsoHxv6S_WI,2719
37
+ dbos/templates/hello/__package/schema.py,sha256=7Z27JGC8yy7Z44cbVXIREYxtUhU4JVkLCp5Q7UahVQ0,260
38
38
  dbos/templates/hello/alembic.ini,sha256=VKBn4Gy8mMuCdY7Hip1jmo3wEUJ1VG1aW7EqY0_n-as,3695
39
39
  dbos/templates/hello/dbos-config.yaml.dbos,sha256=8wxCf_MIEFNWqMXj0nAHUwg1U3YaKz4xcUN6g51WkDE,603
40
40
  dbos/templates/hello/migrations/env.py.dbos,sha256=CsiFOea3ZIsahqkfYtioha0ewmlGR78Ng0wOB2t5LQg,2208
41
41
  dbos/templates/hello/migrations/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
42
- dbos/templates/hello/migrations/versions/2024_07_31_180642_init.py,sha256=rcubrMdw-NUKnrY0Qsftgz4is1OEqWXf6Skcv4PVdME,914
42
+ dbos/templates/hello/migrations/versions/2024_07_31_180642_init.py,sha256=U5thFWGqNN4QLrNXT7wUUqftIFDNE5eSdqD8JNW1mec,942
43
43
  dbos/templates/hello/start_postgres_docker.py,sha256=lQVLlYO5YkhGPEgPqwGc7Y8uDKse9HsWv5fynJEFJHM,1681
44
44
  dbos/tracer.py,sha256=GaXDhdKKF_IQp5SAMipGXiDVwteRKjNbrXyYCH1mor0,2520
45
45
  dbos/utils.py,sha256=hWj9iWDrby2cVEhb0pG-IdnrxLqP64NhkaWUXiLc8bA,402
46
46
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
47
- dbos-0.6.0a0.dist-info/RECORD,,
47
+ dbos-0.6.0a3.dist-info/RECORD,,
File without changes