Skip to content

Commit 348ea15

Browse files
SK-2954: Split skyflow-python into common/v2/v3 build variants, add flowdb (v3) insert support
Restructures the repo into three build variants sharing a bundled common/ module (SK-2938 Option C): v2 (today's SDK, behavior-preserving) and a new v3 built on the flowservice/flowdb API, insert-only this round. common/ - Shared credential resolution, vault-URL resolution, and bearer-token fetch/cache/expiry logic (VaultController, BaseVaultClient), enums, errors, service_account, and generic validators. - VaultController declares insert/get/update/delete/query/detokenize as abstract methods (Java-interface-style); v2 and v3 each provide their own concrete/stub implementations. v2 - Relocated from the repo root via git mv; public API unchanged (same class names, signatures, import paths). Vault is now a backward-compatible alias for the internal PdbVaultController class. - Fixed a latent bug where v2's own Env enum failed cross-class comparisons against common's Env; both now share one definition. v3 (skyflow-flowvault, starting at 1.0.0) - New InsertRequest/InsertRecord/Upsert/InsertResponse types, FlowVaultController, and VaultClient targeting the flowservice REST API. - Insert validation ported from Java's v3 Validations.java: table/upsert must live in exactly one place (request-level or per-record, matching in both), 10k record cap, empty key/value checks. - InsertResponse mirrors Java's v3 shape (summary/success/errors) as plain dicts, each result tagged with its index in the original record list (stable across batch boundaries). - Structured per-record error parsing from the backend's actual error body, plus x-request-id propagation onto error entries. - Batching via INSERT_BATCH_SIZE (default 50, max 1000), sequential, isolate-and-continue on a failing batch. - Vault URL resolution uses v3's own skyvault.skyflowapis.* domain (confirmed against a live vault to differ from v2's vault.skyflowapis.*). CI/CD - shared-tests.yml and shared-build-and-deploy.yml now take a `variant` input and scope every step to v2/ or v3/ via working-directory. - main.yml, ci.yml, beta-release.yml, internal-release.yml, and release.yml matrix over both variants. v3 releases are distinguished from v2's via a flowvault- tag/branch prefix (flowvault-1.0.0, flowvault-release/*) so a release trigger is never ambiguous between the two independently-versioned packages; v2's existing bare-semver tags are untouched. - Fixed ruff.toml/.codespellrc still excluding a pre-split "skyflow/generated" path that no longer existed after the relocation. - Fixed a bump_version.sh sed collision with a comment that happened to contain the literal text "__version__ = ...". - Added a common/ test job to main.yml/ci.yml. Tests: common 36, v3 62, v2 426 (2 pre-existing unrelated fixture failures), tests/contract passing for both variants. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 57a3e3a commit 348ea15

474 files changed

Lines changed: 11813 additions & 542 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codespellrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ignore-words-list = Skyflow,skyflow,skyflowapi,skyflowapis,deidentify,reidentify,detokenize,upsert,upserting,binlookup,byot,creds,fpe,devsecops,formdata,vaultid,dotenv,usecwd,runid,dateutil,Homogenous
44

55
# Skip these files and folders
6-
skip = .git,.venv,venv,env,__pycache__,*.pyc,*.egg-info,dist,build,.idea,.vscode,*.log,requirements.txt,./skyflow/generated,setup.py
6+
skip = .git,.venv,venv,env,__pycache__,*.pyc,*.egg-info,dist,build,.idea,.vscode,*.log,requirements.txt,generated,setup.py
77

88
# If you want to verify it is working, you can uncomment this line to see what files it checks
99
# count =

.github/workflows/beta-release.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ on:
44
push:
55
tags: '*.*.*b*'
66
paths-ignore:
7-
- "setup.py"
7+
- "*/setup.py"
88
- "*.yml"
99
- "*.md"
10-
- "skyflow/utils/_version.py"
10+
- "*/skyflow/utils/_version.py"
1111

1212
jobs:
1313
build-and-deploy:
14+
strategy:
15+
matrix:
16+
include:
17+
- variant: v2
18+
tag-prefix: ''
19+
- variant: v3
20+
tag-prefix: 'flowvault-'
21+
if: (matrix.variant == 'v3' && startsWith(github.ref_name, 'flowvault-')) || (matrix.variant == 'v2' && !startsWith(github.ref_name, 'flowvault-'))
1422
uses: ./.github/workflows/shared-build-and-deploy.yml
1523
with:
1624
ref: ${{ github.ref_name }}
1725
tag: 'beta'
26+
variant: ${{ matrix.variant }}
27+
tag-prefix: ${{ matrix.tag-prefix }}
1828
secrets: inherit

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,27 @@ jobs:
1818
error: 'One of your your commit messages is not matching the format with JIRA ID Ex: ( SDK-123 commit message )'
1919

2020
test:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- variant: v2
26+
coverage-omit: "skyflow/generated/*,skyflow/utils/validations/*,skyflow/vault/data/*,skyflow/vault/detect/*,skyflow/vault/tokens/*,skyflow/vault/connection/*,skyflow/error/*,skyflow/utils/enums/*,skyflow/vault/controller/_audit.py,skyflow/vault/controller/_bin_look_up.py"
27+
- variant: v3
28+
coverage-omit: "skyflow/generated/*"
2129
uses: ./.github/workflows/shared-tests.yml
2230
with:
2331
python-version: '3.9'
32+
variant: ${{ matrix.variant }}
33+
coverage-omit: ${{ matrix.coverage-omit }}
2434
secrets: inherit
35+
36+
test-common:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v2
40+
- uses: actions/setup-python@v2
41+
with:
42+
python-version: '3.9'
43+
- run: pip install -e ./common
44+
- run: python -m unittest discover -s common/tests -t .

.github/workflows/internal-release.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,30 @@ on:
55
tags-ignore:
66
- '*.*'
77
paths-ignore:
8-
- "setup.py"
8+
- "*/setup.py"
99
- "*.yml"
1010
- "*.md"
11-
- "skyflow/utils/_version.py"
11+
- "*/skyflow/utils/_version.py"
1212
- "samples/**"
13+
- "v3/samples/**"
1314
branches:
1415
- release/*
16+
- flowvault-release/*
1517

1618
jobs:
1719
build-and-deploy:
20+
strategy:
21+
matrix:
22+
include:
23+
- variant: v2
24+
tag-prefix: ''
25+
- variant: v3
26+
tag-prefix: 'flowvault-'
27+
if: (matrix.variant == 'v3' && startsWith(github.ref_name, 'flowvault-')) || (matrix.variant == 'v2' && !startsWith(github.ref_name, 'flowvault-'))
1828
uses: ./.github/workflows/shared-build-and-deploy.yml
1929
with:
2030
ref: ${{ github.ref_name }}
2131
tag: 'internal'
32+
variant: ${{ matrix.variant }}
33+
tag-prefix: ${{ matrix.tag-prefix }}
2234
secrets: inherit
23-

.github/workflows/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,27 @@ on:
77

88
jobs:
99
test:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
include:
14+
- variant: v2
15+
coverage-omit: "skyflow/generated/*,skyflow/utils/validations/*,skyflow/vault/data/*,skyflow/vault/detect/*,skyflow/vault/tokens/*,skyflow/vault/connection/*,skyflow/error/*,skyflow/utils/enums/*,skyflow/vault/controller/_audit.py,skyflow/vault/controller/_bin_look_up.py"
16+
- variant: v3
17+
coverage-omit: "skyflow/generated/*"
1018
uses: ./.github/workflows/shared-tests.yml
1119
with:
1220
python-version: '3.9'
21+
variant: ${{ matrix.variant }}
22+
coverage-omit: ${{ matrix.coverage-omit }}
1323
secrets: inherit
24+
25+
test-common:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- uses: actions/setup-python@v2
30+
with:
31+
python-version: '3.9'
32+
- run: pip install -e ./common
33+
- run: python -m unittest discover -s common/tests -t .

.github/workflows/release.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ on:
44
push:
55
tags: "*.*.*"
66
paths-ignore:
7-
- "setup.py"
7+
- "*/setup.py"
88
- "*.yml"
99
- "*.md"
10-
- "skyflow/utils/_version.py"
10+
- "*/skyflow/utils/_version.py"
1111

1212
jobs:
1313
build-and-deploy:
14+
strategy:
15+
matrix:
16+
include:
17+
- variant: v2
18+
tag-prefix: ''
19+
- variant: v3
20+
tag-prefix: 'flowvault-'
21+
if: (matrix.variant == 'v3' && startsWith(github.ref_name, 'flowvault-')) || (matrix.variant == 'v2' && !startsWith(github.ref_name, 'flowvault-'))
1422
uses: ./.github/workflows/shared-build-and-deploy.yml
1523
with:
1624
ref: main
1725
tag: 'public'
26+
variant: ${{ matrix.variant }}
27+
tag-prefix: ${{ matrix.tag-prefix }}
1828
secrets: inherit

.github/workflows/shared-build-and-deploy.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,23 @@ on:
77
description: 'Git reference to use (e.g., main or branch name)'
88
required: true
99
type: string
10-
10+
1111
tag:
1212
description: 'Release Tag'
1313
required: true
1414
type: string
1515

16+
variant:
17+
description: 'Build variant directory to release (v2 or v3)'
18+
required: true
19+
type: string
20+
21+
tag-prefix:
22+
description: 'Prefix distinguishing this variant''s git tags from other variants'' (e.g. "flowvault-" for v3, empty for v2)'
23+
required: false
24+
type: string
25+
default: ''
26+
1627
jobs:
1728
build-and-deploy:
1829
runs-on: ubuntu-latest
@@ -29,7 +40,7 @@ jobs:
2940
3041
- name: Resolve Branch for the Tagged Commit
3142
id: resolve-branch
32-
if: ${{ inputs.tag == 'beta' || inputs.tag == 'public' }}
43+
if: ${{ inputs.tag == 'beta' || inputs.tag == 'public' }}
3344
run: |
3445
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})
3546
@@ -47,18 +58,28 @@ jobs:
4758
id: previoustag
4859
uses: WyriHaximus/github-action-get-previous-tag@v1
4960
with:
50-
fallback: 1.0.0
61+
fallback: ${{ inputs.tag-prefix }}1.0.0
62+
pattern: ${{ inputs.tag-prefix }}[0-9]*.[0-9]*.[0-9]*
63+
64+
- name: Resolve version number
65+
id: version
66+
run: |
67+
TAG="${{ steps.previoustag.outputs.tag }}"
68+
VERSION="${TAG#${{ inputs.tag-prefix }}}"
69+
echo "version=$VERSION" >> $GITHUB_OUTPUT
5170
5271
- name: Bump Version
72+
working-directory: ${{ inputs.variant }}
5373
run: |
54-
chmod +x ./ci-scripts/bump_version.sh
74+
chmod +x ../ci-scripts/bump_version.sh
5575
if ${{ inputs.tag == 'internal' }}; then
56-
./ci-scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")"
76+
../ci-scripts/bump_version.sh "${{ steps.version.outputs.version }}" "$(git rev-parse --short "$GITHUB_SHA")"
5777
else
58-
./ci-scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}"
78+
../ci-scripts/bump_version.sh "${{ steps.version.outputs.version }}"
5979
fi
6080
6181
- name: Commit changes
82+
working-directory: ${{ inputs.variant }}
6283
run: |
6384
git config user.name "${{ github.actor }}"
6485
git config user.email "${{ github.actor }}@users.noreply.github.com"
@@ -71,24 +92,26 @@ jobs:
7192
git add skyflow/utils/_version.py
7293
7394
if [[ "${{ inputs.tag }}" == "internal" ]]; then
74-
VERSION="${{ steps.previoustag.outputs.tag }}.dev0+$(git rev-parse --short $GITHUB_SHA)"
75-
COMMIT_MESSAGE="[AUTOMATED] Private Release $VERSION"
95+
VERSION="${{ steps.version.outputs.version }}.dev0+$(git rev-parse --short $GITHUB_SHA)"
96+
COMMIT_MESSAGE="[AUTOMATED] Private Release (${{ inputs.variant }}) $VERSION"
7697
git commit -m "$COMMIT_MESSAGE"
7798
git push origin ${{ github.ref_name }} -f
7899
fi
79100
if [[ "${{ inputs.tag }}" == "beta" || "${{ inputs.tag }}" == "public" ]]; then
80-
COMMIT_MESSAGE="[AUTOMATED] Public Release - ${{ steps.previoustag.outputs.tag }}"
101+
COMMIT_MESSAGE="[AUTOMATED] Public Release (${{ inputs.variant }}) - ${{ steps.previoustag.outputs.tag }}"
81102
git commit -m "$COMMIT_MESSAGE"
82103
git push origin ${{ env.branch_name }}
83104
fi
84105
85-
- name: Build and install skyflow package
106+
- name: Build and install package
107+
working-directory: ${{ inputs.variant }}
86108
run: |
87109
python setup.py sdist bdist_wheel
88-
pip install dist/skyflow-*.whl
110+
pip install dist/*.whl
89111
90112
- name: Build and Publish Package
91-
if: ${{ inputs.tag == 'beta' || inputs.tag == 'public' }}
113+
if: ${{ inputs.tag == 'beta' || inputs.tag == 'public' }}
114+
working-directory: ${{ inputs.variant }}
92115
env:
93116
TWINE_USERNAME: __token__
94117
TWINE_PASSWORD: ${{ secrets.PYPI_PUBLISH_TOKEN }}
@@ -98,9 +121,10 @@ jobs:
98121
99122
- name: Build and Publish to JFrog Artifactory
100123
if: ${{ inputs.tag == 'internal' }}
124+
working-directory: ${{ inputs.variant }}
101125
env:
102126
TWINE_USERNAME: ${{ secrets.JFROG_USERNAME }}
103127
TWINE_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
104128
run: |
105129
python setup.py sdist bdist_wheel
106-
twine upload --repository-url https://prekarilabs.jfrog.io/artifactory/api/pypi/skyflow-python/ dist/*
130+
twine upload --repository-url https://prekarilabs.jfrog.io/artifactory/api/pypi/skyflow-python/ dist/*

.github/workflows/shared-tests.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ on:
77
description: 'Python version to use'
88
required: true
99
type: string
10+
variant:
11+
description: 'Build variant directory to test (v2 or v3)'
12+
required: true
13+
type: string
14+
coverage-omit:
15+
description: 'Comma-separated coverage --omit patterns, relative to the variant directory'
16+
required: false
17+
type: string
18+
default: 'skyflow/generated/*'
1019

1120
jobs:
1221
run-tests:
@@ -23,32 +32,36 @@ jobs:
2332
with:
2433
name: "credentials.json"
2534
json: ${{ secrets.VALID_SKYFLOW_CREDS_TEST }}
35+
dir: ${{ inputs.variant }}
2636

27-
- name: Build and install skyflow package
37+
- name: Build and install package
38+
working-directory: ${{ inputs.variant }}
2839
run: |
2940
pip install --upgrade pip setuptools wheel
3041
python setup.py sdist bdist_wheel
31-
pip install dist/skyflow-*.whl
42+
pip install dist/*.whl
3243
pip install ".[dev]"
3344
3445
- name: Run Spell Check
3546
run: codespell
3647

3748
- name: Run Linter Ruff
3849
run: ruff check . --output-format=github
39-
50+
4051
- name: 'Run Tests'
52+
working-directory: ${{ inputs.variant }}
4153
run: |
4254
pip install -r requirements.txt
43-
python -m coverage run --source=skyflow --omit=skyflow/generated/*,skyflow/utils/validations/*,skyflow/vault/data/*,skyflow/vault/detect/*,skyflow/vault/tokens/*,skyflow/vault/connection/*,skyflow/error/*,skyflow/utils/enums/*,skyflow/vault/controller/_audit.py,skyflow/vault/controller/_bin_look_up.py -m unittest discover
55+
python -m coverage run --source=skyflow --omit=${{ inputs.coverage-omit }} -m unittest discover
4456
4557
- name: coverage
58+
working-directory: ${{ inputs.variant }}
4659
run: coverage xml -o test-coverage.xml
4760

4861
- name: Codecov
4962
uses: codecov/codecov-action@v2.1.0
5063
with:
5164
token: ${{ secrets.CODECOV_REPO_UPLOAD_TOKEN }}
52-
files: test-coverage.xml
53-
name: codecov-skyflow-python
65+
files: ${{ inputs.variant }}/test-coverage.xml
66+
name: codecov-skyflow-python-${{ inputs.variant }}
5467
verbose: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ celerybeat.pid
104104
# Environments
105105
.env
106106
.venv
107+
.venv-*
107108
env/
108109
venv/
109110
ENV/

common/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# common.utils and common.errors mutually depend on each other -- forcing utils to load first
2+
# here avoids the circular import (mirrors skyflow/__init__.py's own first line).
3+
from . import utils # noqa: F401

0 commit comments

Comments
 (0)