Skip to content

Commit 65d37f6

Browse files
authored
Merge pull request #1 from Kayrnt/init
Initialize DeltaStream Python SDK
2 parents bb73401 + 7c83b44 commit 65d37f6

Some content is hidden

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

66 files changed

+6387
-1
lines changed

.changes/header.tpl.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
6+
and is generated by [Changie](https://github.com/miniscruff/changie).

.changie.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
changesDir: .changes
2+
unreleasedDir: unreleased
3+
headerPath: header.tpl.md
4+
versionHeaderPath: ""
5+
changelogPath: CHANGELOG.md
6+
versionExt: md
7+
envPrefix: "CHANGIE_"
8+
versionFormat: '## deltastream-sdk {{.Version}} - {{.Time.Format "January 02, 2006"}}'
9+
kindFormat: '### {{.Kind}}'
10+
changeFormat: |-
11+
{{- $IssueList := list }}
12+
{{- if $.Custom.Issue }}
13+
{{- $changes := splitList " " (printf "%s" $.Custom.Issue) }}
14+
{{- if ne (len $changes) 0 }}
15+
{{- range $issueNbr := $changes }}
16+
{{- $changeLink := "[#nbr](https://github.com/deltastreaminc/deltastream-sdk-python/issues/nbr)" | replace "nbr" $issueNbr }}
17+
{{- $IssueList = append $IssueList $changeLink }}
18+
{{- end }}
19+
- {{.Body}} ({{ range $index, $element := $IssueList }}{{if $index}}, {{end}}{{$element}}{{end}})
20+
{{- else }}
21+
- {{.Body}}
22+
{{- end }}
23+
{{- else }}
24+
- {{.Body}}
25+
{{- end }}
26+
27+
kinds:
28+
- label: Breaking Changes
29+
auto: major
30+
- label: Features
31+
auto: minor
32+
- label: Fixes
33+
auto: patch
34+
- label: Docs
35+
auto: patch
36+
- label: Under the Hood
37+
auto: patch
38+
- label: Dependencies
39+
auto: patch
40+
- label: Security
41+
auto: patch
42+
- label: Removed
43+
auto: major
44+
45+
newlines:
46+
afterChangelogHeader: 1
47+
afterKind: 1
48+
afterChangelogVersion: 1
49+
beforeKind: 1
50+
endOfVersion: 1
51+
52+
custom:
53+
- key: Author
54+
label: GitHub Username(s) (separated by a single space if multiple)
55+
type: string
56+
minLength: 3
57+
- key: Issue
58+
label: GitHub Issue Number (optional, separated by a single space if multiple)
59+
type: string
60+
minLength: 0
61+
62+
footerFormat: |
63+
{{- $contributorDict := dict }}
64+
{{- /* ensure we always skip snyk and dependabot in addition to the core team */}}
65+
{{- $maintainers := list "dependabot[bot]" "snyk-bot"}}
66+
{{- range $change := .Changes }}
67+
{{- $authorList := splitList " " (printf "%s" $change.Custom.Author) }}
68+
{{- /* loop through all authors for a single changelog */}}
69+
{{- range $author := $authorList }}
70+
{{- $authorLower := lower $author }}
71+
{{- /* we only want to include non-core team contributors */}}
72+
{{- if not (has $authorLower $maintainers)}}
73+
{{- $IssueList := list }}
74+
{{- if $change.Custom.Issue }}
75+
{{- $changes := splitList " " (printf "%s" $change.Custom.Issue) }}
76+
{{- if ne (len $changes) 0 }}
77+
{{- range $issueNbr := $changes }}
78+
{{- $changeLink := "[#nbr](https://github.com/deltastreaminc/deltastream-sdk-python/issues/nbr)" | replace "nbr" $issueNbr }}
79+
{{- $IssueList = append $IssueList $changeLink }}
80+
{{- end }}
81+
{{- end }}
82+
{{- end }}
83+
{{- /* check if this contributor has other changes associated with them already */}}
84+
{{- if hasKey $contributorDict $author }}
85+
{{- $contributionList := get $contributorDict $author }}
86+
{{- $contributionList = concat $contributionList $IssueList }}
87+
{{- $contributorDict = set $contributorDict $author $contributionList }}
88+
{{- else }}
89+
{{- $contributionList := $IssueList }}
90+
{{- $contributorDict = set $contributorDict $author $contributionList }}
91+
{{- end }}
92+
{{- end }}
93+
{{- end }}
94+
{{- end }}
95+
{{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}}
96+
{{- if $contributorDict}}
97+
### Contributors
98+
{{- range $k,$v := $contributorDict }}
99+
- [@{{$k}}](https://github.com/{{$k}}){{ if $v }} ({{ range $index, $element := $v }}{{if $index}}, {{end}}{{$element}}{{end}}){{ end }}
100+
{{- end }}
101+
{{- end }}

.coveragerc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[run]
2+
source =
3+
src
4+
omit =
5+
*/tests/*
6+
*/__init__.py
7+
8+
[report]
9+
exclude_lines =
10+
pragma: no cover
11+
def __repr__
12+
raise NotImplementedError
13+
if __name__ == .__main__.:
14+
pass
15+
raise ImportError
16+
except ImportError
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Changelog release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths: [ CHANGELOG.md ]
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Get the latest version
16+
id: latest
17+
uses: miniscruff/changie-action@v2
18+
with:
19+
version: latest
20+
args: latest
21+
22+
- name: Release
23+
uses: softprops/action-gh-release@v2
24+
with:
25+
body_path: ".changes/${{ steps.latest.outputs.output }}.md"
26+
tag_name: "${{ steps.latest.outputs.output }}"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Generate Release PR
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
generate-pr:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
13+
- name: Batch changes
14+
uses: miniscruff/changie-action@v2
15+
with:
16+
version: latest
17+
args: batch auto
18+
19+
- name: Merge changes
20+
uses: miniscruff/changie-action@v2
21+
with:
22+
version: latest
23+
args: merge
24+
25+
- name: Get the latest version
26+
id: latest
27+
uses: miniscruff/changie-action@v2
28+
with:
29+
version: latest
30+
args: latest
31+
32+
- name: Update version in pyproject.toml
33+
run: |
34+
LATEST_VERSION=${{ steps.latest.outputs.output }}
35+
LATEST_VERSION_STRIPPED=${LATEST_VERSION#v}
36+
if [[ "$OSTYPE" == "darwin"* ]]; then
37+
sed -i '' "s/version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"${LATEST_VERSION_STRIPPED}\"/" pyproject.toml
38+
else
39+
sed -i "s/version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"${LATEST_VERSION_STRIPPED}\"/" pyproject.toml
40+
fi
41+
42+
- name: Create Pull Request
43+
uses: peter-evans/create-pull-request@v4
44+
with:
45+
title: Release ${{ steps.latest.outputs.output }}
46+
branch: release/${{ steps.latest.outputs.output }}
47+
commit-message: Release ${{ steps.latest.outputs.output }}

.github/workflows/python.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Testing Python package
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.10", "3.11", "3.12", "3.13"]
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v4
21+
with:
22+
version: "latest"
23+
- name: Install dependencies
24+
run: |
25+
uv sync --all-groups
26+
- name: Run CI checks
27+
run: |
28+
make ci

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch: # Allow manual triggering of the workflow
8+
inputs:
9+
python_release_version:
10+
description: "Python version to use for build and publish"
11+
required: false
12+
default: "3.12"
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
environment:
18+
name: production
19+
url: https://pypi.org/p/deltastream-sdk
20+
permissions:
21+
id-token: write # for trusted publishing without token/secret
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set up Python for Release
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: "${{ github.event.inputs.python_release_version || '3.12' }}"
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install uv
32+
uv sync --all-packages
33+
- name: Test with pytest for release
34+
run: |
35+
uv run pytest
36+
- name: Test build
37+
run: |
38+
uv build
39+
40+
- name: Publish to PyPI
41+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv
11+
12+
# Byte-compiled / optimized / DLL files
13+
__pycache__/
14+
*.py[cod]
15+
*$py.class
16+
17+
# C extensions
18+
*.so
19+
20+
# Distribution / packaging
21+
.Python
22+
env/
23+
build/
24+
develop-eggs/
25+
dist/
26+
downloads/
27+
eggs/
28+
.eggs/
29+
lib/
30+
lib64/
31+
parts/
32+
sdist/
33+
var/
34+
*.egg-info/
35+
.installed.cfg
36+
*.egg
37+
38+
# PyInstaller
39+
# Usually these files are written by a python script from a template
40+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
41+
*.manifest
42+
*.spec
43+
44+
# Installer logs
45+
pip-log.txt
46+
pip-delete-this-directory.txt
47+
48+
# Unit test / coverage reports
49+
htmlcov/
50+
.tox/
51+
.coverage
52+
.coverage.*
53+
.cache
54+
nosetests.xml
55+
coverage.xml
56+
*,cover
57+
.hypothesis/
58+
.python-version
59+
.pytest_cache
60+
.mypy_cache
61+
62+
# Translations
63+
*.mo
64+
*.pot
65+
66+
# Sphinx documentation
67+
docs/_build/
68+
69+
# PyBuilder
70+
target/
71+
72+
# Docs
73+
docs
74+
75+
# IDE
76+
.vscode
77+
78+
# MacOS
79+
.DS_Store
80+
81+
# Local scripts
82+
install.sh
83+
84+
# Lock files
85+
uv.lock
86+
87+
# Examples
88+
temp/
89+
90+
# env files
91+
.env

AGENTS.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# DeltaStream Python SDK
2+
3+
## Project Context
4+
5+
A Python SDK for [DeltaStream](https://deltastream.io), built on the DeltaStream Connector Python library. It provides a Python API to manage a DeltaStream environment (control and data plane).
6+
7+
## Code Style and Structure
8+
9+
- Write concise, technical Python, SQL or Jinja code with accurate examples
10+
- Use functional and declarative programming patterns; avoid classes where possible
11+
- Prefer iteration and modularization over code duplication
12+
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
13+
- Structure repository files as follows:
14+
.
15+
├── src/ # Source code root directory
16+
│ └── deltastream/ # Main package namespace
17+
│ └── sdk/ # SDK implementation
18+
19+
└── tests/ # Test suite root directory
20+
└── sdk/ # SDK tests
21+
22+
## Build and project setup
23+
24+
The project is using `uv` for dependency management. You can find the lockfile in `uv.lock`.
25+
To run tests, use `uv run pytest <path_to_test>`.
26+
To add dependencies use `uv add <package>`.
27+
Dependency resolution is done using `uv sync`.
28+
Dependencies are specified in `pyproject.toml`.
29+
Dependencies are installed in `./.venv`.

0 commit comments

Comments
 (0)