Skip to content

Commit 3c05c86

Browse files
author
zeevdr
committed
Initial commit: OpenDecree Python SDK v0.2.0
Migrated from github.com/zeevdr/decree-python with clean history. All paths updated to github.com/opendecree/decree-python.
0 parents  commit 3c05c86

93 files changed

Lines changed: 11815 additions & 0 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.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sdk/src/opendecree/_generated/** linguist-generated
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug in the OpenDecree Python SDK
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Describe the bug
10+
11+
A clear description of what the bug is.
12+
13+
## To reproduce
14+
15+
Steps to reproduce the behavior:
16+
17+
1. ...
18+
2. ...
19+
20+
## Expected behavior
21+
22+
What you expected to happen.
23+
24+
## Environment
25+
26+
- `opendecree` version: (e.g., 0.1.0)
27+
- Python version: (e.g., 3.12)
28+
- OS: (e.g., Linux, macOS)
29+
- OpenDecree server version: (e.g., 0.3.1)
30+
31+
## Additional context
32+
33+
Any other context, logs, or tracebacks.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new feature or improvement
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Problem
10+
11+
What problem does this feature solve? What's the use case?
12+
13+
## Proposed solution
14+
15+
Describe the solution you'd like.
16+
17+
## Alternatives considered
18+
19+
Any alternative solutions or workarounds you've considered.
20+
21+
## Additional context
22+
23+
Any other context, mockups, or examples.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Summary
2+
3+
What does this PR do?
4+
5+
## Test plan
6+
7+
- [ ] `make lint` passes
8+
- [ ] `make typecheck` passes
9+
- [ ] `make test` passes (107+ tests, 80%+ coverage)

.github/workflows/ci.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# CI pipeline for the OpenDecree Python SDK.
2+
#
3+
# Jobs: lint, typecheck, test (matrix: 3.11-3.13), examples → check (alls-green gate)
4+
# The check job aggregates all results for branch protection.
5+
6+
name: CI
7+
8+
on:
9+
push:
10+
branches: [main]
11+
pull_request:
12+
branches: [main]
13+
workflow_call:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
lint:
21+
name: Lint
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 10
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v6
27+
with:
28+
persist-credentials: false
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: "3.12"
34+
35+
- name: Install ruff
36+
run: pip install ruff
37+
38+
- name: Check lint
39+
run: ruff check sdk/src/ sdk/tests/
40+
41+
- name: Check formatting
42+
run: ruff format --check sdk/src/ sdk/tests/
43+
44+
typecheck:
45+
name: Typecheck
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 10
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v6
51+
with:
52+
persist-credentials: false
53+
54+
- name: Set up Python
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: "3.12"
58+
cache: pip
59+
cache-dependency-path: sdk/pyproject.toml
60+
61+
- name: Install SDK with dev dependencies
62+
run: pip install -e "sdk[dev]"
63+
64+
- name: Run mypy
65+
run: cd sdk && mypy src/
66+
67+
test:
68+
name: Test (Python ${{ matrix.python-version }})
69+
runs-on: ubuntu-latest
70+
timeout-minutes: 15
71+
strategy:
72+
fail-fast: false
73+
matrix:
74+
python-version: ["3.11", "3.12", "3.13"]
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v6
78+
with:
79+
persist-credentials: false
80+
81+
- name: Set up Python ${{ matrix.python-version }}
82+
uses: actions/setup-python@v5
83+
with:
84+
python-version: ${{ matrix.python-version }}
85+
cache: pip
86+
cache-dependency-path: sdk/pyproject.toml
87+
88+
- name: Install SDK with dev dependencies
89+
run: pip install -e "sdk[dev]"
90+
91+
- name: Run tests with coverage
92+
run: cd sdk && pytest --cov --cov-report=term-missing
93+
94+
examples:
95+
name: Examples
96+
runs-on: ubuntu-latest
97+
timeout-minutes: 10
98+
steps:
99+
- name: Checkout
100+
uses: actions/checkout@v6
101+
with:
102+
persist-credentials: false
103+
104+
- name: Set up Python
105+
uses: actions/setup-python@v5
106+
with:
107+
python-version: "3.12"
108+
cache: pip
109+
cache-dependency-path: sdk/pyproject.toml
110+
111+
- name: Install SDK
112+
run: pip install -e sdk/
113+
114+
- name: Compile-check all examples
115+
run: |
116+
python -m py_compile examples/quickstart/main.py
117+
python -m py_compile examples/async-client/main.py
118+
python -m py_compile examples/live-config/main.py
119+
python -m py_compile examples/error-handling/main.py
120+
python -m py_compile examples/setup.py
121+
122+
check:
123+
name: CI check
124+
if: always()
125+
needs: [lint, typecheck, test, examples]
126+
runs-on: ubuntu-latest
127+
timeout-minutes: 5
128+
steps:
129+
- uses: re-actors/alls-green@release/v1
130+
with:
131+
jobs: ${{ toJSON(needs) }}

.github/workflows/project.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Project automation
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request:
7+
types: [opened]
8+
9+
permissions:
10+
issues: read
11+
pull-requests: read
12+
13+
jobs:
14+
add-to-project:
15+
name: Add to project
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/add-to-project@v1.0.2
19+
with:
20+
project-url: https://github.com/orgs/opendecree/projects/1
21+
github-token: ${{ secrets.PROJECT_TOKEN }}
22+

.github/workflows/publish.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
test:
10+
uses: ./.github/workflows/ci.yml
11+
12+
publish:
13+
needs: test
14+
runs-on: ubuntu-latest
15+
environment: pypi
16+
permissions:
17+
id-token: write
18+
contents: read
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
- run: pip install build
25+
- run: cd sdk && python -m build
26+
- uses: pypa/gh-action-pypi-publish@release/v1
27+
with:
28+
packages-dir: sdk/dist/
29+
print-hash: true

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.egg-info/
6+
*.egg
7+
dist/
8+
build/
9+
*.whl
10+
11+
# Virtual environments
12+
.venv/
13+
venv/
14+
env/
15+
16+
# IDE
17+
.idea/
18+
.vscode/
19+
*.swp
20+
*.swo
21+
*~
22+
23+
# Testing
24+
.coverage
25+
htmlcov/
26+
.pytest_cache/
27+
28+
# mypy
29+
.mypy_cache/
30+
31+
# ruff
32+
.ruff_cache/
33+
34+
# Generated docs
35+
sdk/docs/api/
36+
37+
# OS
38+
.DS_Store
39+
Thumbs.db
40+
.tools-image-built

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6+
7+
## [0.1.0] - 2026-04-12
8+
9+
### Added
10+
11+
- ConfigClient (sync) with `@overload` typed `get()` returning str/int/float/bool/timedelta
12+
- AsyncConfigClient mirroring the sync API with async/await
13+
- ConfigWatcher with `WatchedField[T]` for live config subscriptions (background thread)
14+
- AsyncConfigWatcher for asyncio-native subscriptions (background task)
15+
- Error hierarchy mapping gRPC status codes to typed Python exceptions
16+
- Exponential backoff retry with jitter for transient gRPC errors
17+
- Auth metadata interceptors (x-subject, x-role, x-tenant-id, Bearer token)
18+
- Context managers for all client and watcher lifecycles
19+
- `on_change` callbacks and `changes()` iterators on watched fields
20+
- Auto-reconnect with backoff on subscription stream failures
21+
22+
[0.1.0]: https://github.com/opendecree/decree-python/releases/tag/v0.1.0

0 commit comments

Comments
 (0)