durable-actors 0.7.16 → 0.8.0

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 (56) hide show
  1. package/README.md +5 -5
  2. package/bin/durable-actors.js +2 -0
  3. package/dist/actor/actor.d.ts +2 -2
  4. package/dist/actor/actor.d.ts.map +1 -1
  5. package/dist/actor/actor.js +5 -3
  6. package/dist/actor/actor.js.map +1 -1
  7. package/dist/actor/database.d.ts +3 -2
  8. package/dist/actor/database.d.ts.map +1 -1
  9. package/dist/actor/database.js +21 -3
  10. package/dist/actor/database.js.map +1 -1
  11. package/dist/cli/dev.d.ts.map +1 -1
  12. package/dist/cli/dev.js +13 -42
  13. package/dist/cli/dev.js.map +1 -1
  14. package/dist/cli/python.d.ts.map +1 -1
  15. package/dist/cli/python.js +0 -1
  16. package/dist/cli/python.js.map +1 -1
  17. package/dist/cli.d.ts +1 -1
  18. package/dist/cli.js +9 -18
  19. package/dist/cli.js.map +1 -1
  20. package/dist/compiler/declarations.js +2648 -183
  21. package/dist/compiler/declarations.js.map +7 -1
  22. package/dist/host/actor-runtime.d.ts.map +1 -1
  23. package/dist/host/actor-runtime.js +2 -3
  24. package/dist/host/actor-runtime.js.map +1 -1
  25. package/dist/host/sqlite.d.ts.map +1 -1
  26. package/dist/host/sqlite.js +2 -0
  27. package/dist/host/sqlite.js.map +1 -1
  28. package/dist/projectSdk.js +1 -1
  29. package/dist/projectSdk.js.map +1 -1
  30. package/dist/templates/actor/README.md +7 -9
  31. package/dist/templates/actor/bunfig +2 -0
  32. package/dist/templates/actor/package.json +6 -3
  33. package/dist/templates/ai-chat/README.md +8 -8
  34. package/dist/templates/ai-chat/bunfig +2 -0
  35. package/dist/templates/ai-chat/package.json +7 -5
  36. package/dist/templates/chat/README.md +8 -8
  37. package/dist/templates/chat/bunfig +2 -0
  38. package/dist/templates/chat/package.json +7 -5
  39. package/dist/templates/documents/README.md +8 -8
  40. package/dist/templates/documents/bunfig +2 -0
  41. package/dist/templates/documents/package.json +7 -5
  42. package/package.json +110 -108
  43. package/dist/cli/actor-source-watcher.d.ts +0 -25
  44. package/dist/cli/actor-source-watcher.d.ts.map +0 -1
  45. package/dist/cli/actor-source-watcher.js +0 -129
  46. package/dist/cli/actor-source-watcher.js.map +0 -1
  47. package/dist/templates/actor/pnpm-workspace.yaml +0 -2
  48. package/dist/templates/ai-chat/pnpm-workspace.yaml +0 -2
  49. package/dist/templates/chat/pnpm-workspace.yaml +0 -2
  50. package/dist/templates/documents/pnpm-workspace.yaml +0 -2
  51. package/dist/templates/python/README.md +0 -7
  52. package/dist/templates/python/gitignore +0 -6
  53. package/dist/templates/python/package.json +0 -11
  54. package/dist/templates/python/pnpm-workspace.yaml +0 -2
  55. package/dist/templates/python/pyproject.toml +0 -8
  56. package/dist/templates/python/src/actors.py +0 -9
package/package.json CHANGED
@@ -1,116 +1,118 @@
1
1
  {
2
- "name": "durable-actors",
3
- "version": "0.7.16",
4
- "description": "Provider-neutral actors for sandbox compute",
5
- "type": "module",
6
- "license": "MIT",
7
- "sideEffects": false,
8
- "engines": {
9
- "node": "^20.19.0 || >=22.12.0"
10
- },
11
- "keywords": [
12
- "actors",
13
- "distributed-systems",
14
- "durable-actors",
15
- "kubernetes",
16
- "serverless"
17
- ],
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/TerseAI/durable-actors.git",
21
- "directory": "sdk"
22
- },
23
- "homepage": "https://github.com/TerseAI/durable-actors#readme",
24
- "bugs": {
25
- "url": "https://github.com/TerseAI/durable-actors/issues"
26
- },
27
- "publishConfig": {
28
- "access": "public"
29
- },
30
- "main": "dist/index.js",
31
- "types": "dist/index.d.ts",
32
- "bin": {
33
- "durable-actors": "dist/cli.js"
34
- },
35
- "exports": {
36
- "./backend": {
37
- "types": "./dist/backend.d.ts",
38
- "import": "./dist/backend.js",
39
- "default": "./dist/backend.js"
2
+ "name": "durable-actors",
3
+ "version": "0.8.0",
4
+ "description": "Provider-neutral actors for sandbox compute",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "sideEffects": false,
8
+ "engines": {
9
+ "bun": ">=1.4.2"
40
10
  },
41
- "./dev": {
42
- "types": "./dist/localRuntime.d.ts",
43
- "import": "./dist/localRuntime.js",
44
- "default": "./dist/localRuntime.js"
11
+ "packageManager": "bun@1.4.2",
12
+ "keywords": [
13
+ "actors",
14
+ "distributed-systems",
15
+ "durable-actors",
16
+ "kubernetes",
17
+ "serverless"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/TerseAI/durable-actors.git",
22
+ "directory": "sdk"
45
23
  },
46
- "./proxy": {
47
- "types": "./dist/proxy.d.ts",
48
- "import": "./dist/proxy.js",
49
- "default": "./dist/proxy.js"
24
+ "homepage": "https://github.com/TerseAI/durable-actors#readme",
25
+ "bugs": {
26
+ "url": "https://github.com/TerseAI/durable-actors/issues"
50
27
  },
51
- ".": {
52
- "types": "./dist/index.d.ts",
53
- "import": "./dist/index.js",
54
- "default": "./dist/index.js"
28
+ "publishConfig": {
29
+ "access": "public"
55
30
  },
56
- "./host": {
57
- "types": "./dist/host.d.ts",
58
- "import": "./dist/host.js",
59
- "default": "./dist/host.js"
31
+ "main": "dist/index.js",
32
+ "types": "dist/index.d.ts",
33
+ "bin": {
34
+ "durable-actors": "bin/durable-actors.js"
60
35
  },
61
- "./compiler": {
62
- "types": "./dist/compiler/actor-compiler.d.ts",
63
- "import": "./dist/compiler/actor-compiler.js",
64
- "default": "./dist/compiler/actor-compiler.js"
36
+ "exports": {
37
+ "./backend": {
38
+ "types": "./dist/backend.d.ts",
39
+ "import": "./dist/backend.js",
40
+ "default": "./dist/backend.js"
41
+ },
42
+ "./dev": {
43
+ "types": "./dist/localRuntime.d.ts",
44
+ "import": "./dist/localRuntime.js",
45
+ "default": "./dist/localRuntime.js"
46
+ },
47
+ "./proxy": {
48
+ "types": "./dist/proxy.d.ts",
49
+ "import": "./dist/proxy.js",
50
+ "default": "./dist/proxy.js"
51
+ },
52
+ ".": {
53
+ "types": "./dist/index.d.ts",
54
+ "import": "./dist/index.js",
55
+ "default": "./dist/index.js"
56
+ },
57
+ "./host": {
58
+ "types": "./dist/host.d.ts",
59
+ "import": "./dist/host.js",
60
+ "default": "./dist/host.js"
61
+ },
62
+ "./compiler": {
63
+ "types": "./dist/compiler/actor-compiler.d.ts",
64
+ "import": "./dist/compiler/actor-compiler.js",
65
+ "default": "./dist/compiler/actor-compiler.js"
66
+ },
67
+ "./codegen": {
68
+ "types": "./dist/compiler/generators/client-artifacts.d.ts",
69
+ "import": "./dist/compiler/generators/client-artifacts.js",
70
+ "default": "./dist/compiler/generators/client-artifacts.js"
71
+ }
65
72
  },
66
- "./codegen": {
67
- "types": "./dist/compiler/generators/client-artifacts.d.ts",
68
- "import": "./dist/compiler/generators/client-artifacts.js",
69
- "default": "./dist/compiler/generators/client-artifacts.js"
73
+ "files": [
74
+ "bin",
75
+ "dist",
76
+ "README.md",
77
+ "LICENSE.md"
78
+ ],
79
+ "scripts": {
80
+ "build": "bun run --bun build:observer && bun run --bun build:client && tsc -p tsconfig.build.json && bun run --bun build:declarations && bun scripts/build-template.mjs",
81
+ "check": "bun run --bun format:check && bun run --bun test && bun run --bun package:check",
82
+ "clean": "rm -rf dist .test-dist",
83
+ "package:check": "bun test --timeout 60000 tests/scripts/codegen-api.test.mjs tests/scripts/build-artifact.test.mjs tests/scripts/standalone-client.test.mjs tests/scripts/host-runtime.test.mjs",
84
+ "prepack": "bun run --bun clean && bun run --bun build && bun run --bun package:check",
85
+ "test": "bun run --bun clean && bun run --bun build && bun tests/prepare.mjs && tsc -p tsconfig.test.json && bun test --parallel=1 --timeout 60000 ./.test-dist/tests",
86
+ "format": "prettier --config ../.prettierrc --write \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/*.mjs\" \"tests/**/*.mjs\"",
87
+ "format:check": "prettier --config ../.prettierrc --check \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/*.mjs\" \"tests/**/*.mjs\"",
88
+ "build:observer": "bun run --bun --cwd ../packages/observer-ui build",
89
+ "docs": "typedoc --options typedoc.json",
90
+ "build:client": "bun scripts/build-client-runtime.mjs",
91
+ "build:declarations": "bun scripts/build-declaration-compiler.mjs"
92
+ },
93
+ "dependencies": {
94
+ "@types/json-schema": "^7.0.15",
95
+ "ajv": "^8.20.0",
96
+ "commander": "^14.0.3",
97
+ "durable-actors-observer": "0.8.0",
98
+ "esbuild": "^0.28.2",
99
+ "import-meta-resolve": "^4.2.0",
100
+ "open": "^10.2.0",
101
+ "prettier": "^3.9.6",
102
+ "tar": "^7.5.22",
103
+ "typescript": "~5.9.3",
104
+ "typescript-json-schema": "^0.68.0",
105
+ "validate-npm-package-name": "^6.0.2",
106
+ "vite": "^8.3.0",
107
+ "ws": "^8.18.3",
108
+ "zod": "^4.3.6"
109
+ },
110
+ "devDependencies": {
111
+ "@types/node": "^22.0.0",
112
+ "@types/validate-npm-package-name": "^4.0.2",
113
+ "@types/ws": "^8.18.1",
114
+ "dts-bundle-generator": "9.5.1",
115
+ "typedoc": "^0.28.20",
116
+ "typedoc-plugin-missing-exports": "^4.1.4"
70
117
  }
71
- },
72
- "files": [
73
- "dist",
74
- "README.md",
75
- "LICENSE.md"
76
- ],
77
- "dependencies": {
78
- "@types/json-schema": "^7.0.15",
79
- "ajv": "^8.20.0",
80
- "chokidar": "^4.0.3",
81
- "commander": "^14.0.3",
82
- "dotenv": "^18.0.0",
83
- "dts-bundle-generator": "9.5.1",
84
- "esbuild": "^0.28.2",
85
- "import-meta-resolve": "^4.2.0",
86
- "open": "^10.2.0",
87
- "prettier": "^3.9.6",
88
- "tar": "^7.5.22",
89
- "typescript": "~5.9.3",
90
- "typescript-json-schema": "^0.68.0",
91
- "validate-npm-package-name": "^6.0.2",
92
- "vite": "^8.3.0",
93
- "ws": "^8.18.3",
94
- "zod": "^4.3.6",
95
- "durable-actors-observer": "0.7.16"
96
- },
97
- "devDependencies": {
98
- "@types/node": "^22.0.0",
99
- "@types/validate-npm-package-name": "^4.0.2",
100
- "@types/ws": "^8.18.1",
101
- "typedoc": "^0.28.20",
102
- "typedoc-plugin-missing-exports": "^4.1.4"
103
- },
104
- "scripts": {
105
- "build": "pnpm run build:observer && pnpm run build:client && tsc -p tsconfig.build.json && node scripts/build-template.mjs && pnpm --dir .. install --offline --frozen-lockfile --ignore-scripts",
106
- "check": "pnpm run format:check && pnpm run test && pnpm run package:check",
107
- "clean": "rm -rf dist .test-dist",
108
- "package:check": "node --test tests/scripts/codegen-api.test.mjs tests/scripts/build-artifact.test.mjs tests/scripts/standalone-client.test.mjs",
109
- "test": "pnpm run clean && pnpm run build && node tests/prepare.mjs && tsc -p tsconfig.test.json && node scripts/test.mjs",
110
- "format": "prettier --config ../.prettierrc --write \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/*.mjs\" \"tests/**/*.mjs\"",
111
- "format:check": "prettier --config ../.prettierrc --check \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/*.mjs\" \"tests/**/*.mjs\"",
112
- "build:observer": "pnpm --filter durable-actors-observer build",
113
- "docs": "typedoc --options typedoc.json",
114
- "build:client": "node scripts/build-client-runtime.mjs"
115
- }
116
- }
118
+ }
@@ -1,25 +0,0 @@
1
- import { watch } from "chokidar";
2
- interface ActorSourceWatcherOptions {
3
- projectDirectory: string;
4
- dataDirectory?: string;
5
- }
6
- declare function watchActorSources(options: ActorSourceWatcherOptions, refresh: () => Promise<void>): Promise<ActorSourceWatcher>;
7
- declare class ActorSourceWatcher {
8
- private readonly options;
9
- private readonly refresh;
10
- private readonly createWatcher;
11
- private readonly warn;
12
- private watcher?;
13
- private timer?;
14
- private updates;
15
- private closing?;
16
- private disabled;
17
- constructor(options: ActorSourceWatcherOptions, refresh: () => Promise<void>, createWatcher: typeof watch, warn: (message: string) => void);
18
- start(): Promise<void>;
19
- close(): Promise<void>;
20
- private scheduleRefresh;
21
- private waitUntilReady;
22
- private disable;
23
- }
24
- export { ActorSourceWatcher, watchActorSources };
25
- //# sourceMappingURL=actor-source-watcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor-source-watcher.d.ts","sourceRoot":"","sources":["../../src/cli/actor-source-watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,EAAE,MAAM,UAAU,CAAA;AAIhD,UAAU,yBAAyB;IAC/B,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,iBAAe,iBAAiB,CAC5B,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CAI7B;AAED,cAAM,kBAAkB;IAQhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAVzB,OAAO,CAAC,OAAO,CAAC,CAAW;IAC3B,OAAO,CAAC,KAAK,CAAC,CAA+B;IAC7C,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,OAAO,CAAC,CAAe;IAC/B,OAAO,CAAC,QAAQ,CAAQ;gBAGH,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,aAAa,EAAE,OAAO,KAAK,EAC3B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI;IAG9C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,cAAc;YAgBR,OAAO;CAUxB;AA0CD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,129 +0,0 @@
1
- import { watch } from "chokidar";
2
- import { existsSync } from "node:fs";
3
- import path from "node:path";
4
- async function watchActorSources(options, refresh) {
5
- const watcher = new ActorSourceWatcher(options, refresh, watch, message => console.warn(message));
6
- await watcher.start();
7
- return watcher;
8
- }
9
- class ActorSourceWatcher {
10
- options;
11
- refresh;
12
- createWatcher;
13
- warn;
14
- watcher;
15
- timer;
16
- updates = Promise.resolve();
17
- closing;
18
- disabled = false;
19
- constructor(options, refresh, createWatcher, warn) {
20
- this.options = options;
21
- this.refresh = refresh;
22
- this.createWatcher = createWatcher;
23
- this.warn = warn;
24
- }
25
- async start() {
26
- try {
27
- this.watcher = this.createWatcher(this.options.projectDirectory, {
28
- ignored: (watchedPath, stats) => ignoredActorPath(watchedPath, this.options) ||
29
- (stats?.isDirectory() === true && existsSync(path.join(watchedPath, "pyvenv.cfg"))) ||
30
- (stats !== undefined && !stats.isDirectory() && (!stats.isFile() || !isActorSource(watchedPath))),
31
- ignoreInitial: true,
32
- followSymlinks: false,
33
- atomic: true,
34
- awaitWriteFinish: { stabilityThreshold: 100, pollInterval: 20 }
35
- });
36
- this.watcher.on("all", (_event, changedPath) => this.scheduleRefresh(changedPath));
37
- await this.waitUntilReady(this.watcher);
38
- }
39
- catch (error) {
40
- if (isWatchLimit(error))
41
- await this.disable(error);
42
- else {
43
- await this.close();
44
- throw error;
45
- }
46
- }
47
- }
48
- async close() {
49
- this.disabled = true;
50
- clearTimeout(this.timer);
51
- if (!this.closing) {
52
- this.closing = this.watcher?.close() ?? Promise.resolve();
53
- // Chokidar removes listeners on close, but pending filesystem operations can still emit errors.
54
- this.watcher?.on("error", () => { });
55
- }
56
- await this.closing;
57
- await this.updates;
58
- }
59
- scheduleRefresh(changedPath) {
60
- if (this.disabled || !isActorSource(changedPath))
61
- return;
62
- clearTimeout(this.timer);
63
- this.timer = setTimeout(() => {
64
- this.updates = this.updates.then(this.refresh).catch(reportWatchError);
65
- }, 75);
66
- }
67
- waitUntilReady(watcher) {
68
- return new Promise((resolve, reject) => {
69
- let ready = false;
70
- watcher.once("ready", () => {
71
- ready = true;
72
- resolve();
73
- });
74
- watcher.on("error", error => {
75
- if (this.disabled)
76
- return;
77
- if (isWatchLimit(error))
78
- void this.disable(error).then(resolve, reject);
79
- else if (!ready)
80
- reject(error);
81
- else
82
- reportWatchError(error);
83
- });
84
- });
85
- }
86
- async disable(error) {
87
- if (!this.disabled)
88
- this.warn(`Actor source watcher reached the OS file/watch limit (${error.code}). Automatic reload is disabled; ` +
89
- "the development server will continue running. Restart it to apply source changes. " +
90
- "Close other watchers or raise your OS file/watch limit, then restart to restore automatic reload. " +
91
- "Use --no-watch to disable watching explicitly.");
92
- await this.close();
93
- }
94
- }
95
- function isWatchLimit(error) {
96
- return error instanceof Error && "code" in error && ["EMFILE", "ENFILE", "ENOSPC"].includes(String(error.code));
97
- }
98
- function ignoredActorPath(candidate, options) {
99
- const relative = path.relative(options.projectDirectory, candidate);
100
- if (!relative || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
101
- return false;
102
- const components = relative.split(path.sep);
103
- if (components.some(component => [
104
- ".git",
105
- "node_modules",
106
- ".venv",
107
- "venv",
108
- "__pycache__",
109
- ".mypy_cache",
110
- ".pytest_cache",
111
- ".ruff_cache"
112
- ].includes(component)))
113
- return true;
114
- if ([".durable-actors", "generated"].includes(components[0]))
115
- return true;
116
- if (!options.dataDirectory)
117
- return false;
118
- const state = path.resolve(options.dataDirectory);
119
- return candidate === state || candidate.startsWith(`${state}${path.sep}`);
120
- }
121
- function isActorSource(candidate) {
122
- return (/\.(?:[cm]?[jt]sx?|json|ya?ml|py|toml)$/u.test(candidate) ||
123
- ["bun.lock", "uv.lock", "requirements.txt"].includes(path.basename(candidate)));
124
- }
125
- function reportWatchError(error) {
126
- console.error(`Actor source update failed: ${error instanceof Error ? error.message : String(error)}`);
127
- }
128
- export { ActorSourceWatcher, watchActorSources };
129
- //# sourceMappingURL=actor-source-watcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor-source-watcher.js","sourceRoot":"","sources":["../../src/cli/actor-source-watcher.ts"],"names":[],"mappings":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AAS,aAAa,CAAC,SAAiB;IACpC,OAAO,CACH,yCAAyC,CAAC,IAAI,CAAC,SAAS,CAAC;QACzD,CAAC,UAAU,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CACjF,CAAA;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACpC,OAAO,CAAC,KAAK,CAAC,+BAA+B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAC1G,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,2 +0,0 @@
1
- allowBuilds:
2
- esbuild: true
@@ -1,2 +0,0 @@
1
- allowBuilds:
2
- esbuild: true
@@ -1,2 +0,0 @@
1
- allowBuilds:
2
- esbuild: true
@@ -1,2 +0,0 @@
1
- allowBuilds:
2
- esbuild: true
@@ -1,7 +0,0 @@
1
- # Python actors
2
-
3
- Install Node.js 22+, Python 3.11+, and uv. Run `pnpm install`, `uv sync`, then `pnpm exec durable-actors dev`. The shared TypeScript CLI selects `.venv` and checks actor types before starting and reloading.
4
-
5
- Edit `src/actors.py`. Write synchronous actor methods with ordinary `def`. Every instance field must use `persisted()` or `ephemeral()`. Use `emitted(persisted(...))` for state broadcasts and `ephemeral()` for temporary values such as caches and service clients. From your client application, install `durable-actors[codegen]` and run `pnpm exec durable-actors generate` against the running server. Generated Python clients include synchronous typed methods and models. Import `actors` from the generated package and use `actors.Counter.get("one")`; the SDK manages the HTTP connection pool. Actors with emitted fields also expose `actor.subscribe(callback)` for typed live state; close the returned subscription when finished. The CLI runs strict mypy after generation.
6
-
7
- Set `DURABLE_ACTORS_PYTHON` to select another interpreter. `DURABLE_ACTORS_BINARY` selects a locally built runtime.
@@ -1,6 +0,0 @@
1
- node_modules/
2
- .venv/
3
- .durable-actors/
4
- .mypy_cache/
5
- __pycache__/
6
- generated/
@@ -1,11 +0,0 @@
1
- {
2
- "name": "durable-actors-example-python",
3
- "private": true,
4
- "dependencies": {
5
- "durable-actors": "0.7.16"
6
- },
7
- "scripts": {
8
- "dev": "durable-actors dev",
9
- "generate": "durable-actors generate"
10
- }
11
- }
@@ -1,2 +0,0 @@
1
- allowBuilds:
2
- esbuild: true
@@ -1,8 +0,0 @@
1
- [project]
2
- name = "durable-actors-example"
3
- version = "0.1.0"
4
- requires-python = ">=3.11"
5
- dependencies = ["durable-actors[codegen]==0.7.16"]
6
-
7
- [tool.mypy]
8
- strict = true
@@ -1,9 +0,0 @@
1
- from durable_actors import Actor, persisted
2
-
3
-
4
- class Counter(Actor):
5
- count: int = persisted(0)
6
-
7
- def increment(self, amount: int = 1) -> int:
8
- self.count += amount
9
- return self.count