Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
101 changes: 101 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
versionHeaderPath: ""
changelogPath: CHANGELOG.md
versionExt: md
envPrefix: "CHANGIE_"
versionFormat: '## deltastream-sdk {{.Version}} - {{.Time.Format "January 02, 2006"}}'
kindFormat: '### {{.Kind}}'
changeFormat: |-
{{- $IssueList := list }}
{{- if $.Custom.Issue }}
{{- $changes := splitList " " (printf "%s" $.Custom.Issue) }}
{{- if ne (len $changes) 0 }}
{{- range $issueNbr := $changes }}
{{- $changeLink := "[#nbr](https://github.com/deltastreaminc/deltastream-sdk-python/issues/nbr)" | replace "nbr" $issueNbr }}
{{- $IssueList = append $IssueList $changeLink }}
{{- end }}
- {{.Body}} ({{ range $index, $element := $IssueList }}{{if $index}}, {{end}}{{$element}}{{end}})
{{- else }}
- {{.Body}}
{{- end }}
{{- else }}
- {{.Body}}
{{- end }}

kinds:
- label: Breaking Changes
auto: major
- label: Features
auto: minor
- label: Fixes
auto: patch
- label: Docs
auto: patch
- label: Under the Hood
auto: patch
- label: Dependencies
auto: patch
- label: Security
auto: patch
- label: Removed
auto: major

newlines:
afterChangelogHeader: 1
afterKind: 1
afterChangelogVersion: 1
beforeKind: 1
endOfVersion: 1

custom:
- key: Author
label: GitHub Username(s) (separated by a single space if multiple)
type: string
minLength: 3
- key: Issue
label: GitHub Issue Number (optional, separated by a single space if multiple)
type: string
minLength: 0

footerFormat: |
{{- $contributorDict := dict }}
{{- /* ensure we always skip snyk and dependabot in addition to the core team */}}
{{- $maintainers := list "dependabot[bot]" "snyk-bot"}}
{{- range $change := .Changes }}
{{- $authorList := splitList " " (printf "%s" $change.Custom.Author) }}
{{- /* loop through all authors for a single changelog */}}
{{- range $author := $authorList }}
{{- $authorLower := lower $author }}
{{- /* we only want to include non-core team contributors */}}
{{- if not (has $authorLower $maintainers)}}
{{- $IssueList := list }}
{{- if $change.Custom.Issue }}
{{- $changes := splitList " " (printf "%s" $change.Custom.Issue) }}
{{- if ne (len $changes) 0 }}
{{- range $issueNbr := $changes }}
{{- $changeLink := "[#nbr](https://github.com/deltastreaminc/deltastream-sdk-python/issues/nbr)" | replace "nbr" $issueNbr }}
{{- $IssueList = append $IssueList $changeLink }}
{{- end }}
{{- end }}
{{- end }}
{{- /* check if this contributor has other changes associated with them already */}}
{{- if hasKey $contributorDict $author }}
{{- $contributionList := get $contributorDict $author }}
{{- $contributionList = concat $contributionList $IssueList }}
{{- $contributorDict = set $contributorDict $author $contributionList }}
{{- else }}
{{- $contributionList := $IssueList }}
{{- $contributorDict = set $contributorDict $author $contributionList }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}}
{{- if $contributorDict}}
### Contributors
{{- range $k,$v := $contributorDict }}
- [@{{$k}}](https://github.com/{{$k}}){{ if $v }} ({{ range $index, $element := $v }}{{if $index}}, {{end}}{{$element}}{{end}}){{ end }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[run]
source =
src
omit =
*/tests/*
*/__init__.py

[report]
exclude_lines =
pragma: no cover
def __repr__
raise NotImplementedError
if __name__ == .__main__.:
pass
raise ImportError
except ImportError
26 changes: 26 additions & 0 deletions .github/workflows/changelog_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Changelog release

on:
push:
branches: [ main ]
paths: [ CHANGELOG.md ]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get the latest version
id: latest
uses: miniscruff/changie-action@v2
with:
version: latest
args: latest

- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: ".changes/${{ steps.latest.outputs.output }}.md"
tag_name: "${{ steps.latest.outputs.output }}"
47 changes: 47 additions & 0 deletions .github/workflows/changie_generate_release_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Generate Release PR

on:
workflow_dispatch:

jobs:
generate-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Batch changes
uses: miniscruff/changie-action@v2
with:
version: latest
args: batch auto

- name: Merge changes
uses: miniscruff/changie-action@v2
with:
version: latest
args: merge

- name: Get the latest version
id: latest
uses: miniscruff/changie-action@v2
with:
version: latest
args: latest

- name: Update version in pyproject.toml
run: |
LATEST_VERSION=${{ steps.latest.outputs.output }}
LATEST_VERSION_STRIPPED=${LATEST_VERSION#v}
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"${LATEST_VERSION_STRIPPED}\"/" pyproject.toml
else
sed -i "s/version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"${LATEST_VERSION_STRIPPED}\"/" pyproject.toml
fi

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
title: Release ${{ steps.latest.outputs.output }}
branch: release/${{ steps.latest.outputs.output }}
commit-message: Release ${{ steps.latest.outputs.output }}
28 changes: 28 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Testing Python package

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install dependencies
run: |
uv sync --all-groups
- name: Run CI checks
run: |
make ci
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Package

on:
push:
tags:
- "v*.*.*"
workflow_dispatch: # Allow manual triggering of the workflow
inputs:
python_release_version:
description: "Python version to use for build and publish"
required: false
default: "3.12"

jobs:
publish:
runs-on: ubuntu-latest
environment:
name: production
url: https://pypi.org/p/deltastream-sdk
permissions:
id-token: write # for trusted publishing without token/secret
steps:
- uses: actions/checkout@v4
- name: Set up Python for Release
uses: actions/setup-python@v4
with:
python-version: "${{ github.event.inputs.python_release_version || '3.12' }}"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv sync --all-packages
- name: Test with pytest for release
run: |
uv run pytest
- name: Test build
run: |
uv build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
91 changes: 91 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info

# Virtual environments
.venv

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
.python-version
.pytest_cache
.mypy_cache

# Translations
*.mo
*.pot

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Docs
docs

# IDE
.vscode

# MacOS
.DS_Store

# Local scripts
install.sh

# Lock files
uv.lock

# Examples
temp/

# env files
.env
29 changes: 29 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# DeltaStream Python SDK

## Project Context

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).

## Code Style and Structure

- Write concise, technical Python, SQL or Jinja code with accurate examples
- Use functional and declarative programming patterns; avoid classes where possible
- Prefer iteration and modularization over code duplication
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
- Structure repository files as follows:
.
├── src/ # Source code root directory
│ └── deltastream/ # Main package namespace
│ └── sdk/ # SDK implementation
└── tests/ # Test suite root directory
└── sdk/ # SDK tests

## Build and project setup

The project is using `uv` for dependency management. You can find the lockfile in `uv.lock`.
To run tests, use `uv run pytest <path_to_test>`.
To add dependencies use `uv add <package>`.
Dependency resolution is done using `uv sync`.
Dependencies are specified in `pyproject.toml`.
Dependencies are installed in `./.venv`.
Loading