continuo-python-runtime 0.2.0__tar.gz → 0.3.0__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 (102) hide show
  1. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/.dockerignore +2 -1
  2. continuo_python_runtime-0.3.0/.github/workflows/ci.yml +61 -0
  3. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/.github/workflows/images.yml +44 -13
  4. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/.github/workflows/publish-pypi.yml +27 -18
  5. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/.gitignore +2 -0
  6. continuo_python_runtime-0.3.0/Dockerfile.postgres +22 -0
  7. continuo_python_runtime-0.3.0/Dockerfile.trino +22 -0
  8. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/PKG-INFO +75 -53
  9. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/README.md +71 -50
  10. continuo_python_runtime-0.3.0/adapters/postgres/README.md +36 -0
  11. continuo_python_runtime-0.3.0/adapters/postgres/continuo_python_runtime_postgres/adapter.py +700 -0
  12. {continuo_python_runtime-0.2.0/python-runtime-postgres → continuo_python_runtime-0.3.0/adapters/postgres}/pyproject.toml +12 -4
  13. continuo_python_runtime-0.3.0/adapters/postgres/tests/test_adapter_postgres_validation.py +199 -0
  14. {continuo_python_runtime-0.2.0/python-runtime-postgres → continuo_python_runtime-0.3.0/adapters/postgres}/tests/test_adapter_runtime_postgres.py +49 -41
  15. continuo_python_runtime-0.3.0/adapters/postgres/tests/test_integration_postgres_validation.py +450 -0
  16. {continuo_python_runtime-0.2.0/python-runtime-postgres → continuo_python_runtime-0.3.0/adapters/postgres}/tests/test_integration_runtime_postgres.py +34 -6
  17. {continuo_python_runtime-0.2.0/python-runtime-trino → continuo_python_runtime-0.3.0/adapters/trino}/README.md +15 -6
  18. {continuo_python_runtime-0.2.0/python-runtime-trino → continuo_python_runtime-0.3.0/adapters/trino}/continuo_python_runtime_trino/adapter.py +194 -62
  19. {continuo_python_runtime-0.2.0/python-runtime-trino → continuo_python_runtime-0.3.0/adapters/trino}/pyproject.toml +12 -4
  20. {continuo_python_runtime-0.2.0/python-runtime-trino → continuo_python_runtime-0.3.0/adapters/trino}/tests/test_adapter_runtime_trino.py +19 -19
  21. continuo_python_runtime-0.3.0/adapters/trino/tests/test_adapter_trino_validation.py +120 -0
  22. {continuo_python_runtime-0.2.0/python-runtime-trino → continuo_python_runtime-0.3.0/adapters/trino}/tests/test_integration_runtime_trino.py +18 -14
  23. continuo_python_runtime-0.3.0/adapters/trino/tests/test_integration_trino_validation.py +469 -0
  24. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/cli.py +11 -0
  25. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/context.py +2 -2
  26. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/contract/loader.py +3 -3
  27. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/harness.py +9 -10
  28. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/types.py +2 -2
  29. continuo_python_runtime-0.3.0/continuo_python_runtime/validation/__init__.py +1 -0
  30. continuo_python_runtime-0.3.0/continuo_python_runtime/validation/runner.py +245 -0
  31. continuo_python_runtime-0.3.0/continuo_python_runtime/validation/s3.py +45 -0
  32. continuo_python_runtime-0.3.0/contract/README.md +51 -0
  33. continuo_python_runtime-0.3.0/contract/continuo_engine_contract/__init__.py +1 -0
  34. continuo_python_runtime-0.3.0/contract/continuo_engine_contract/config.py +50 -0
  35. continuo_python_runtime-0.3.0/contract/continuo_engine_contract/port.py +189 -0
  36. continuo_python_runtime-0.3.0/contract/continuo_engine_contract/result.py +34 -0
  37. continuo_python_runtime-0.3.0/contract/continuo_engine_contract/sql.py +86 -0
  38. continuo_python_runtime-0.3.0/contract/continuo_engine_contract/types.py +23 -0
  39. continuo_python_runtime-0.3.0/contract/pyproject.toml +19 -0
  40. continuo_python_runtime-0.3.0/contract/tests/test_config.py +55 -0
  41. continuo_python_runtime-0.3.0/contract/tests/test_contract_types.py +25 -0
  42. continuo_python_runtime-0.3.0/contract/tests/test_port.py +349 -0
  43. continuo_python_runtime-0.3.0/contract/tests/test_result.py +40 -0
  44. continuo_python_runtime-0.3.0/contract/tests/test_sql.py +103 -0
  45. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/docs/boundary-contract.md +23 -22
  46. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/pyproject.toml +25 -9
  47. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/template/Dockerfile +7 -5
  48. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/conftest.py +7 -7
  49. continuo_python_runtime-0.3.0/tests/contract/__init__.py +0 -0
  50. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/contract/test_loader.py +1 -1
  51. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/smoke/postgres-stack/docker-compose.yml +1 -1
  52. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/smoke/trino-stack/docker-compose.yml +4 -4
  53. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_cli.py +15 -3
  54. continuo_python_runtime-0.3.0/tests/test_contract_pin_consistency.py +49 -0
  55. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_harness.py +33 -33
  56. continuo_python_runtime-0.3.0/tests/test_image_smoke_validation.py +69 -0
  57. continuo_python_runtime-0.3.0/tests/test_no_legacy_names.py +46 -0
  58. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_template.py +18 -5
  59. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_types.py +2 -2
  60. continuo_python_runtime-0.3.0/tests/test_validation_runner.py +880 -0
  61. continuo_python_runtime-0.3.0/tests/test_validation_s3.py +41 -0
  62. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/uv.lock +72 -21
  63. continuo_python_runtime-0.2.0/.github/workflows/ci.yml +0 -25
  64. continuo_python_runtime-0.2.0/Dockerfile.postgres +0 -17
  65. continuo_python_runtime-0.2.0/Dockerfile.trino +0 -17
  66. continuo_python_runtime-0.2.0/python-runtime-postgres/README.md +0 -18
  67. continuo_python_runtime-0.2.0/python-runtime-postgres/continuo_python_runtime_postgres/adapter.py +0 -442
  68. {continuo_python_runtime-0.2.0/python-runtime-postgres → continuo_python_runtime-0.3.0/adapters/postgres}/continuo_python_runtime_postgres/__init__.py +0 -0
  69. {continuo_python_runtime-0.2.0/python-runtime-postgres → continuo_python_runtime-0.3.0/adapters/postgres}/tests/__init__.py +0 -0
  70. {continuo_python_runtime-0.2.0/python-runtime-trino → continuo_python_runtime-0.3.0/adapters/trino}/continuo_python_runtime_trino/__init__.py +0 -0
  71. {continuo_python_runtime-0.2.0/python-runtime-trino → continuo_python_runtime-0.3.0/adapters/trino}/tests/__init__.py +0 -0
  72. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/__init__.py +0 -0
  73. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/closure.py +0 -0
  74. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/conform.py +0 -0
  75. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/contract/__init__.py +0 -0
  76. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/contract/merge.py +0 -0
  77. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/contract/model.py +0 -0
  78. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/contract/paths.py +0 -0
  79. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/errors.py +0 -0
  80. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/hashing.py +0 -0
  81. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/continuo_python_runtime/lint.py +0 -0
  82. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0/contract}/tests/__init__.py +0 -0
  83. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/docs/superpowers/plans/2026-07-31-python-runtime.md +0 -0
  84. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/docs/superpowers/plans/2026-08-07-step-3b-config-three-part-hash.md +0 -0
  85. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/docs/superpowers/specs/2026-07-31-python-runtime-design.md +0 -0
  86. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/template/.github/workflows/release.yml +0 -0
  87. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/template/README.md +0 -0
  88. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/template/contracts/example.yml +0 -0
  89. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/template/scripts/example.py +0 -0
  90. {continuo_python_runtime-0.2.0/tests/contract → continuo_python_runtime-0.3.0/tests}/__init__.py +0 -0
  91. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/contract/test_merge.py +0 -0
  92. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/contract/test_model.py +0 -0
  93. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/smoke/node_smoke/contracts/smoke.yml +0 -0
  94. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/smoke/node_smoke/scripts/smoke.py +0 -0
  95. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/smoke/trino-stack/catalog/iceberg.properties +0 -0
  96. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_closure.py +0 -0
  97. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_conform.py +0 -0
  98. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_context.py +0 -0
  99. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_errors.py +0 -0
  100. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_hashing.py +0 -0
  101. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_lint.py +0 -0
  102. {continuo_python_runtime-0.2.0 → continuo_python_runtime-0.3.0}/tests/test_package.py +0 -0
@@ -11,4 +11,5 @@ dist/
11
11
  docs/
12
12
  template/
13
13
  tests/
14
- python-runtime-*/tests/
14
+ adapters/*/tests/
15
+ contract/tests/
@@ -0,0 +1,61 @@
1
+ name: ci
2
+ on:
3
+ push: { branches: [main] }
4
+ pull_request:
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v4
10
+ - uses: astral-sh/setup-uv@v5
11
+ - name: Sync
12
+ run: uv sync --all-packages --all-groups
13
+ - name: Lint
14
+ run: uv run ruff check .
15
+ - name: Lint (contract)
16
+ run: uv run ruff check contract
17
+ - name: Types (runtime)
18
+ run: uv run mypy continuo_python_runtime
19
+ - name: Types (contract)
20
+ run: uv run mypy contract/continuo_engine_contract
21
+ - name: Types (postgres adapter)
22
+ run: uv run --package continuo-python-runtime-postgres mypy adapters/postgres/continuo_python_runtime_postgres
23
+ - name: Types (trino adapter)
24
+ run: uv run --package continuo-python-runtime-trino mypy adapters/trino/continuo_python_runtime_trino
25
+ # `-m "not image"` deselects tests/test_image_smoke_validation.py, which
26
+ # needs a built engine image and the env naming it. Those tests run in
27
+ # images.yml's smoke jobs, where an image actually exists.
28
+ - name: Tests (runtime)
29
+ run: uv run pytest --cov=continuo_python_runtime -m "not image" -v
30
+ - name: Tests (contract)
31
+ run: uv run pytest contract/tests -v
32
+ - name: Tests (adapter units)
33
+ run: uv run pytest adapters/postgres/tests adapters/trino/tests -m "not integration" -v
34
+
35
+ integration-postgres:
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+ - uses: astral-sh/setup-uv@v5
40
+ - run: uv sync --all-packages --all-groups
41
+ - name: Start postgres stack
42
+ run: docker compose -f tests/smoke/postgres-stack/docker-compose.yml up -d --wait
43
+ - name: Tests (postgres integration)
44
+ run: uv run pytest adapters/postgres/tests -m integration -v
45
+ - name: Tear down postgres stack
46
+ if: always()
47
+ run: docker compose -f tests/smoke/postgres-stack/docker-compose.yml down -v
48
+
49
+ integration-trino:
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+ - uses: astral-sh/setup-uv@v5
54
+ - run: uv sync --all-packages --all-groups
55
+ - name: Start trino stack
56
+ run: docker compose -f tests/smoke/trino-stack/docker-compose.yml up -d --wait
57
+ - name: Tests (trino integration)
58
+ run: uv run pytest adapters/trino/tests -m integration -v
59
+ - name: Tear down trino stack
60
+ if: always()
61
+ run: docker compose -f tests/smoke/trino-stack/docker-compose.yml down -v
@@ -5,8 +5,8 @@ on:
5
5
  - "Dockerfile.*"
6
6
  - "tests/smoke/**"
7
7
  - "continuo_python_runtime/**"
8
- - "python-runtime-postgres/**"
9
- - "python-runtime-trino/**"
8
+ - "contract/**"
9
+ - "adapters/**"
10
10
  - "pyproject.toml"
11
11
  - ".github/workflows/images.yml"
12
12
  push:
@@ -56,6 +56,16 @@ jobs:
56
56
  path: /tmp
57
57
  - name: Load image
58
58
  run: docker load -i /tmp/cpr-smoke-postgres.tar
59
+ - uses: astral-sh/setup-uv@v5
60
+ - name: Sync
61
+ run: uv sync --all-packages --all-groups
62
+ - name: Image smoke tests (postgres)
63
+ env:
64
+ VALIDATION_IMAGE_UNDER_TEST: cpr-smoke-postgres
65
+ VALIDATION_IMAGE_ENGINE: postgres
66
+ # PostgresAdapter.required_env()[0]
67
+ VALIDATION_IMAGE_REQUIRED_ENV: POSTGRES_HOST
68
+ run: uv run pytest tests/test_image_smoke_validation.py -m image -v
59
69
  - name: Install psql client
60
70
  run: |
61
71
  sudo apt-get update
@@ -101,6 +111,16 @@ jobs:
101
111
  path: /tmp
102
112
  - name: Load image
103
113
  run: docker load -i /tmp/cpr-smoke-trino.tar
114
+ - uses: astral-sh/setup-uv@v5
115
+ - name: Sync
116
+ run: uv sync --all-packages --all-groups
117
+ - name: Image smoke tests (trino)
118
+ env:
119
+ VALIDATION_IMAGE_UNDER_TEST: cpr-smoke-trino
120
+ VALIDATION_IMAGE_ENGINE: trino
121
+ # TrinoAdapter.required_env()[0]
122
+ VALIDATION_IMAGE_REQUIRED_ENV: TRINO_HOST
123
+ run: uv run pytest tests/test_image_smoke_validation.py -m image -v
104
124
  - name: Start trino stack
105
125
  run: docker compose -f tests/smoke/trino-stack/docker-compose.yml up -d --wait
106
126
  - name: Seed source table
@@ -133,13 +153,20 @@ jobs:
133
153
  if: always()
134
154
  run: docker compose -f tests/smoke/trino-stack/docker-compose.yml down -v
135
155
 
136
- # On tag push: log in to ghcr.io and push ghcr.io/${{ github.repository }}:<tag>-postgres
137
- # and :<tag>-trino. continuo-validation-contract, continuo-python-runtime-postgres,
138
- # and continuo-python-runtime-trino are all installed from the build context /
139
- # PyPI already (see Dockerfile.postgres / Dockerfile.trino and
140
- # publish-pypi.yml) — nothing pending here.
156
+ # On tag push: build both engine images for linux/amd64 and linux/arm64 and
157
+ # push them to ghcr.io/<owner>/continuo-python-runtime-<engine>:<tag>. The
158
+ # engine belongs in the image NAME, not the tag: Continuo's Helm chart pins an
159
+ # image as `<name>:vX.Y.Z@sha256:<digest>`, so the tag must be the bare
160
+ # version. Both platforms are required: domain repos build their own images
161
+ # FROM these, and Continuo's e2e runs them in a kind cluster on aarch64
162
+ # developer machines as well as on amd64 CI runners, so a single-arch publish
163
+ # is unusable off amd64. The smoke jobs above stay single-arch — they load a
164
+ # `docker save` tarball, which has no multi-platform equivalent.
165
+ # continuo-engine-contract and the two engine adapters are installed from the
166
+ # build context (see Dockerfile.postgres / Dockerfile.trino) — nothing pending
167
+ # here.
141
168
  publish:
142
- if: startsWith(github.ref, 'refs/tags/v')
169
+ if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-test')
143
170
  needs: [smoke-postgres, smoke-trino]
144
171
  strategy:
145
172
  matrix:
@@ -150,6 +177,8 @@ jobs:
150
177
  packages: write
151
178
  steps:
152
179
  - uses: actions/checkout@v4
180
+ - uses: docker/setup-qemu-action@v3
181
+ - uses: docker/setup-buildx-action@v3
153
182
  - name: Log in to ghcr.io
154
183
  uses: docker/login-action@v3
155
184
  with:
@@ -157,8 +186,10 @@ jobs:
157
186
  username: ${{ github.actor }}
158
187
  password: ${{ secrets.GITHUB_TOKEN }}
159
188
  - name: Build and push ${{ matrix.engine }} image
160
- run: |
161
- tag="${GITHUB_REF_NAME}"
162
- image="ghcr.io/${{ github.repository }}:${tag}-${{ matrix.engine }}"
163
- docker build -f Dockerfile.${{ matrix.engine }} -t "$image" .
164
- docker push "$image"
189
+ uses: docker/build-push-action@v6
190
+ with:
191
+ context: .
192
+ file: Dockerfile.${{ matrix.engine }}
193
+ platforms: linux/amd64,linux/arm64
194
+ push: true
195
+ tags: ghcr.io/${{ github.repository_owner }}/continuo-python-runtime-${{ matrix.engine }}:${{ github.ref_name }}
@@ -1,37 +1,42 @@
1
1
  name: publish-pypi
2
2
 
3
- # Publishes the continuo-python-runtime package via PyPI Trusted Publishing
4
- # (OIDC, no stored token).
3
+ # Publishes both PyPI distributions this repo owns — continuo-python-runtime
4
+ # (the harness) and continuo-engine-contract (the port, result-block format,
5
+ # and shared guards) — via PyPI Trusted Publishing (OIDC, no stored token).
5
6
  #
6
7
  # The two engine adapters (continuo-python-runtime-postgres /
7
8
  # continuo-python-runtime-trino) are deliberately NOT published here. Nothing
8
- # installs them from an index: the runtime images build them from the build
9
+ # installs them from an index: the engine images build them from the build
9
10
  # context (see Dockerfile.postgres / Dockerfile.trino and images.yml), and the
10
11
  # harness package does not depend on them — adapters are found at run time
11
- # through the `continuo_runtime.adapters` entry-point group, inside the image
12
+ # through the `continuo_engine.adapters` entry-point group, inside the image
12
13
  # that installed exactly one. Publishing them would only add releases with no
13
14
  # consumer. They remain uv workspace members and are still built, typed, and
14
15
  # tested by ci.yml.
15
16
  #
16
- # Tag glob note: "python-runtime-v*" requires a literal "v" immediately after
17
- # the dash, so it matches only the harness tag (python-runtime-v1.2.3[-testN]).
18
- # Tag `<pkg>-v<ver>-test<n>` publishes to TestPyPI; `<pkg>-v<ver>` publishes to
19
- # real PyPI. The GitHub environment name is what the PyPI "pending publisher"
20
- # is registered against.
17
+ # Tag glob note: `v*` is the repository's single release pattern — the same tag
18
+ # that images.yml builds and pushes both engine images from, so one tag ships
19
+ # the whole release. GitHub Actions tag globs anchor at character 1, so `v*`
20
+ # claims every tag beginning with "v"; no other pattern may be introduced.
21
+ # Tag `v<ver>-test<n>` publishes to TestPyPI; `v<ver>` publishes to real PyPI.
22
+ # The GitHub environment name is what the PyPI "pending publisher" is
23
+ # registered against — both project names need one on each index.
21
24
  #
22
- # Ordering: continuo-validation-contract==0.4.0 must exist on the target index
23
- # before publishing here — consumers of the wheel resolve it from that index
24
- # ([tool.uv.sources] is dev-only and not embedded in the wheel).
25
+ # Both distributions are built into a single `dist/` and uploaded in one
26
+ # publish call, so there is no ordering constraint between them. The runtime
27
+ # wheel declares continuo-engine-contract as a dependency and resolves it from
28
+ # the index at install time ([tool.uv.sources] is dev-only and is not embedded
29
+ # in the wheel).
25
30
  on:
26
31
  push:
27
32
  tags:
28
- - "python-runtime-v*"
33
+ - "v*"
29
34
 
30
35
  permissions: {}
31
36
 
32
37
  jobs:
33
- publish-runtime:
34
- if: startsWith(github.ref_name, 'python-runtime-v')
38
+ publish-packages:
39
+ if: startsWith(github.ref_name, 'v')
35
40
  runs-on: ubuntu-latest
36
41
  environment: ${{ contains(github.ref_name, '-test') && 'testpypi' || 'pypi' }}
37
42
  permissions:
@@ -41,10 +46,14 @@ jobs:
41
46
  - uses: actions/checkout@v4
42
47
  - uses: astral-sh/setup-uv@v5
43
48
  - name: Test before publishing
49
+ # `-m "not image"` deselects the image smoke tests; images.yml runs
50
+ # those against a built engine image.
44
51
  run: |
45
- uv sync --all-groups
46
- uv run pytest -q
47
- - name: Build the sdist + wheel
52
+ uv sync --all-packages --all-groups
53
+ uv run pytest tests contract/tests -m "not image" -q
54
+ - name: Build the contract sdist + wheel
55
+ run: uv build --package continuo-engine-contract -o dist
56
+ - name: Build the runtime sdist + wheel
48
57
  run: uv build -o dist
49
58
  - name: Publish to TestPyPI
50
59
  if: contains(github.ref_name, '-test')
@@ -7,3 +7,5 @@ dist/
7
7
  .pytest_cache/
8
8
  .mypy_cache/
9
9
  .ruff_cache/
10
+ .coverage
11
+ .worktrees/
@@ -0,0 +1,22 @@
1
+ FROM python:3.14-slim
2
+ # One dual-role image per engine: the python-node runtime harness (default
3
+ # command `run`, domain repos build FROM this) and the blue/green validation
4
+ # runner (`validation-op`, continuo's executor sets it as the container
5
+ # command). Everything installs from this repo's own workspace paths in one
6
+ # pip transaction — no PyPI propagation lag; images always build from repo head.
7
+ # docker build -f Dockerfile.postgres .
8
+ COPY pyproject.toml README.md /src/
9
+ COPY contract /src/contract
10
+ COPY continuo_python_runtime /src/continuo_python_runtime
11
+ COPY adapters/postgres /src/adapters/postgres
12
+ RUN pip install --no-cache-dir /src/contract /src/adapters/postgres /src \
13
+ && rm -rf /src
14
+ # PYTHONPATH is belt-and-braces: the harness also inserts APP_ROOT and the
15
+ # node script's own directory at the front of sys.path before executing it.
16
+ ENV CONTRACT_DIR=/app/contracts APP_ROOT=/app PYTHONPATH=/app
17
+ WORKDIR /app
18
+ # uid 65532 matches continuo's executor securityContext expectation.
19
+ RUN useradd --uid 65532 --no-create-home --shell /usr/sbin/nologin nonroot
20
+ USER 65532:65532
21
+ ENTRYPOINT ["continuo-runtime"]
22
+ CMD ["run"]
@@ -0,0 +1,22 @@
1
+ FROM python:3.14-slim
2
+ # One dual-role image per engine: the python-node runtime harness (default
3
+ # command `run`, domain repos build FROM this) and the blue/green validation
4
+ # runner (`validation-op`, continuo's executor sets it as the container
5
+ # command). Everything installs from this repo's own workspace paths in one
6
+ # pip transaction — no PyPI propagation lag; images always build from repo head.
7
+ # docker build -f Dockerfile.trino .
8
+ COPY pyproject.toml README.md /src/
9
+ COPY contract /src/contract
10
+ COPY continuo_python_runtime /src/continuo_python_runtime
11
+ COPY adapters/trino /src/adapters/trino
12
+ RUN pip install --no-cache-dir /src/contract /src/adapters/trino /src \
13
+ && rm -rf /src
14
+ # PYTHONPATH is belt-and-braces: the harness also inserts APP_ROOT and the
15
+ # node script's own directory at the front of sys.path before executing it.
16
+ ENV CONTRACT_DIR=/app/contracts APP_ROOT=/app PYTHONPATH=/app
17
+ WORKDIR /app
18
+ # uid 65532 matches continuo's executor securityContext expectation.
19
+ RUN useradd --uid 65532 --no-create-home --shell /usr/sbin/nologin nonroot
20
+ USER 65532:65532
21
+ ENTRYPOINT ["continuo-runtime"]
22
+ CMD ["run"]
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: continuo-python-runtime
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Runtime harness, contract tooling, and CI lint for Continuo python nodes.
5
5
  Author: Simone Carolini
6
6
  Maintainer: Simone Carolini
@@ -8,7 +8,8 @@ Classifier: Development Status :: 4 - Beta
8
8
  Classifier: Intended Audience :: Developers
9
9
  Classifier: Programming Language :: Python :: 3.14
10
10
  Requires-Python: >=3.14
11
- Requires-Dist: continuo-validation-contract==0.4.0
11
+ Requires-Dist: boto3==1.43.59
12
+ Requires-Dist: continuo-engine-contract==0.7.0
12
13
  Requires-Dist: pyarrow==25.0.0
13
14
  Requires-Dist: pyyaml==6.0.3
14
15
  Requires-Dist: sqlglot==30.15.0
@@ -24,53 +25,69 @@ and register the release with Continuo.
24
25
 
25
26
  ## What this repo is
26
27
 
27
- Three artifacts come out of this repository:
28
+ Four artifacts come out of this repository:
28
29
 
29
30
  - **The `continuo-python-runtime` PyPI package** — the `continuo-runtime` CLI
30
- (`validate` / `merge` / `hash` / `lint` / `run`) and the harness library
31
- (`conform()`, `RunContext`, the error taxonomy) that domain repos install.
32
- - **Per-engine base images**, one per warehouse engine (`...-postgres`,
33
- `...-trino`), that domain repos build `FROM`. Each image bakes in the
34
- runtime, a single `RuntimeAdapter` for that engine, and the
35
- `continuo-runtime run` entrypoint.
31
+ (`validate` / `merge` / `hash` / `lint` / `run` / `validation-op`) and the
32
+ harness library (`conform()`, `RunContext`, the error taxonomy) that domain
33
+ repos install.
34
+ - **The `continuo-engine-contract` PyPI package** — the `WarehouseAdapter`
35
+ port, the contract schema, the shared SQL/type/config guards, and the
36
+ sentinel result-block format. Adapter authors outside this repo pin it.
37
+ - **Per-engine base images**, one per warehouse engine
38
+ (`continuo-python-runtime-postgres`, `continuo-python-runtime-trino`), that
39
+ domain repos build `FROM`. Each image bakes in the runtime and a single
40
+ `WarehouseAdapter` for that engine, and serves both roles that adapter has:
41
+ the node harness (`ENTRYPOINT ["continuo-runtime"]`, `CMD ["run"]`) and the
42
+ validation runner (`continuo-runtime validation-op`).
36
43
  - **`template/`** — a copy-ready domain repo: `Dockerfile`, `contracts/`,
37
44
  `scripts/`, and the `release.yml` CI/CD workflow.
38
45
 
39
- Base images and the PyPI publication of this package land with this repo's
40
- PR 9 (the image pipeline); until then, install the runtime from git as noted
41
- in `template/.github/workflows/release.yml`.
46
+ One `vX.Y.Z` git tag releases all of it: `publish-pypi.yml` builds both
47
+ distributions into a single `dist/` and publishes them together, and
48
+ `images.yml` builds and pushes both engine images multi-arch under the same
49
+ tag.
42
50
 
43
- ### Package map
51
+ ### What this repo owns
44
52
 
45
- Each per-engine base image bakes together three PyPI packages: the harness,
46
- the engine adapter, and the published contract. The harness and both engine
47
- adapters live in *this* repo (`continuo-python-runtime`) as a uv workspace;
48
- `continuo-validation-runners` owns the *validation-side* (offline lint/merge)
49
- counterparts of the same engines, which is a separate concern from the
50
- data-plane adapters here.
53
+ This repository owns the entire python-node surface: the engine contract, both
54
+ engine adapters, the validation runner, and the node harness. The former
55
+ `continuo-validation` repository was merged in — there is no longer a separate
56
+ validation-side port, adapter class, entry-point group, or image. One
57
+ `WarehouseAdapter` per engine serves both the data plane (`fetch` /
58
+ `ensure_table` / `load`) and validation (`ensure_schema` / `drop_schema` /
59
+ `build_empty_from_sql` / `build_empty_from_columns` / `clone_empty_from_prod` /
60
+ `check_binds`), and one image per engine runs both roles.
51
61
 
52
62
  | Package (distribution name) | Module | Lives in | Role |
53
63
  | --- | --- | --- | --- |
54
- | `continuo-python-runtime` | `continuo_python_runtime` | this repo (root) | Harness: CLI, `conform()`, `RunContext`, error taxonomy. |
55
- | `continuo-python-runtime-postgres` | `continuo_python_runtime_postgres` | this repo, `python-runtime-postgres/` | Data-plane `RuntimeAdapter` for Postgres (`fetch`/`ensure_table`/`load`). **Not published to PyPI** — built from source into the image. |
56
- | `continuo-python-runtime-trino` | `continuo_python_runtime_trino` | this repo, `python-runtime-trino/` | Data-plane `RuntimeAdapter` for Trino/Iceberg. **Not published to PyPI** — built from source into the image. |
57
- | `continuo-validation-contract` | `continuo_validation_contract` | `continuo-validation-runners` | The published contract (schema, `RuntimeAdapter` port, result-block format) both sides depend on. |
58
- | `continuo-validation-postgres` / `continuo-validation-trino` | `continuo_validation_postgres` / `continuo_validation_trino` | `continuo-validation-runners` | Validation-side (lint/merge, no live warehouse I/O) adapters — not to be confused with the data-plane adapters above. |
59
-
60
- All three packages built in this repo resolve `continuo-validation-contract`
61
- from PyPI (`==0.4.0`); the two adapter packages are uv workspace members
62
- (`[tool.uv.workspace]` in the root `pyproject.toml`), so `uv sync
63
- --all-packages --all-groups` at the repo root installs everything for local
64
- development.
65
-
66
- **Only `continuo-python-runtime` is published to PyPI.** The two engine
67
- adapters are built **from source into the runtime images**: `Dockerfile.postgres`
68
- and `Dockerfile.trino` `pip install` them out of the build context, so each
69
- image ships exactly one adapter and the harness discovers it through the
70
- `continuo_runtime.adapters` entry-point group at run time. Nothing installs
71
- them from an index — the harness package does not depend on them, and domain
72
- repos get their adapter by building `FROM` a published base image. They are
73
- still built, type-checked, and tested by CI on every change.
64
+ | `continuo-python-runtime` | `continuo_python_runtime` | this repo (root) | Harness (CLI, `conform()`, `RunContext`, error taxonomy) **and** the validation runner (`continuo-runtime validation-op`). Published to PyPI. |
65
+ | `continuo-engine-contract` | `continuo_engine_contract` | this repo, `contract/` | The `WarehouseAdapter` port, contract schema, the SQL/type/config guards adapters must run, and the result-block format. Published to PyPI. |
66
+ | `continuo-python-runtime-postgres` | `continuo_python_runtime_postgres` | this repo, `adapters/postgres/` | `PostgresAdapter` — one class, both roles. **Not published to PyPI** — built from source into the image. |
67
+ | `continuo-python-runtime-trino` | `continuo_python_runtime_trino` | this repo, `adapters/trino/` | `TrinoAdapter` — one class, both roles, for Trino/Iceberg. **Not published to PyPI** — built from source into the image. |
68
+
69
+ All four are uv workspace members (`[tool.uv.workspace]` in the root
70
+ `pyproject.toml`), so `uv sync --all-packages --all-groups` at the repo root
71
+ installs everything for local development.
72
+
73
+ **Only `continuo-python-runtime` and `continuo-engine-contract` are published
74
+ to PyPI.** The two engine adapters are built **from source into the engine
75
+ images**: `Dockerfile.postgres` and `Dockerfile.trino` install them out of the
76
+ build context, so each image ships exactly one adapter and the runtime
77
+ discovers it through the `continuo_engine.adapters` entry-point group at run
78
+ time. Nothing installs them from an index — the harness package does not
79
+ depend on them, and domain repos get their adapter by building `FROM` a
80
+ published base image. They are still built, type-checked, and tested by CI on
81
+ every change.
82
+
83
+ ### The result block is a frozen wire contract
84
+
85
+ `continuo_engine_contract.result` writes a sentinel-framed JSON block as the
86
+ last line of stdout, and Continuo's Go side parses it byte-for-byte
87
+ (`pkg/validationresult` in the `continuo` repository). That wire format — the
88
+ sentinel markers, the framing, and the field names inside the block — is
89
+ **frozen**. Reuse it; never change it from this side alone. A change here that
90
+ the Go parser has not been taught is a production outage, not a refactor.
74
91
 
75
92
  ## Quickstart for domain teams
76
93
 
@@ -98,7 +115,7 @@ still built, type-checked, and tested by CI on every change.
98
115
  ### Upgrading an existing domain repo
99
116
 
100
117
  `validate` / `merge` / `hash` now hand every declared read to a real SQL
101
- parser (sqlglot, via `continuo_validation_contract.sql.ensure_single_read`)
118
+ parser (sqlglot, via `continuo_engine_contract.sql.ensure_single_read`)
102
119
  instead of scanning it for a leading `SELECT`/`WITH`. Two things follow for a
103
120
  repo written before this, on its next release: SQL a driver would accept but
104
121
  a parser will not — most commonly a driver-specific bind placeholder like
@@ -138,9 +155,13 @@ def run(ctx):
138
155
  example a polars DataFrame. Returning anything else raises `ScriptError`.
139
156
  - The dataframe library is your choice. No dataframe library is baked into
140
157
  the base image — the package's own runtime dependencies are `pyarrow`,
141
- `PyYAML`, and `continuo-validation-contract`. Add whatever you script
158
+ `PyYAML`, and `continuo-engine-contract`. Add whatever you script
142
159
  against (pandas, polars, …) as a `RUN pip install` line in your own
143
- `Dockerfile`, on top of the base image.
160
+ `Dockerfile`, on top of the base image. The base image runs as non-root
161
+ (uid 65532), which pip cannot install under, so switch to root for the
162
+ install and back afterward — `USER root`, then the `RUN pip install`
163
+ line, then `USER 65532:65532` — since the executor's pod spec expects
164
+ the image to end at uid 65532. See `template/Dockerfile` for the pattern.
144
165
  - Scripts do not import warehouse drivers, write raw SQL literals, or call
145
166
  data-access methods directly — `continuo-runtime lint` rejects those:
146
167
  - forbidden driver imports (`psycopg2`/`sqlalchemy`/`trino`/etc.),
@@ -208,19 +229,20 @@ A domain repo picks its warehouse engine by which base image it builds
208
229
  `FROM`:
209
230
 
210
231
  ```dockerfile
211
- FROM ghcr.io/carolsimone/continuo-python-runtime:v0.2.0-postgres
232
+ FROM ghcr.io/carolsimone/continuo-python-runtime-postgres:v0.3.0
212
233
  # or
213
- FROM ghcr.io/carolsimone/continuo-python-runtime:v0.2.0-trino
234
+ FROM ghcr.io/carolsimone/continuo-python-runtime-trino:v0.3.0
214
235
  ```
215
236
 
216
- Each image bakes in exactly one `RuntimeAdapter` for that engine — installed
217
- from this repo's `python-runtime-postgres/` or `python-runtime-trino/`
218
- package (see the package map above; both adapters live in this repo, not
219
- `continuo-validation-runners`) — registered under the
220
- `continuo_runtime.adapters` entry-point group (entry names `postgres` /
221
- `trino`). The harness discovers it via `discover_runtime_adapter()` at run
222
- time, so a single image serves every node in the service. The executor
223
- injects the
237
+ The engine is part of the image **name**; the tag is the bare version, so
238
+ Continuo's Helm chart can pin an image as `<name>:vX.Y.Z@sha256:<digest>`.
239
+
240
+ Each image bakes in exactly one `WarehouseAdapter` for that engine — installed
241
+ from this repo's `adapters/postgres/` or `adapters/trino/` package (see the
242
+ table above) — registered under the `continuo_engine.adapters` entry-point
243
+ group (entry names `postgres` / `trino`). The runtime discovers it via
244
+ `discover_adapter()` at run time, so a single image serves every node in the
245
+ service and the release-time validation Job for it. The executor injects the
224
246
  warehouse connection as environment variables (engine-native, e.g.
225
247
  `POSTGRES_HOST`/`POSTGRES_DB`/`POSTGRES_USER`) plus the node-selection
226
248
  environment (`NODE_ID`, `TABLE_NAME`, `TARGET_SCHEMA`, and optionally