observe-kit 0.1.1__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.
- observe_kit-0.1.1/.github/ISSUE_TEMPLATE/bug.yml +18 -0
- observe_kit-0.1.1/.github/ISSUE_TEMPLATE/config.yml +5 -0
- observe_kit-0.1.1/.github/ISSUE_TEMPLATE/feature.yml +15 -0
- observe_kit-0.1.1/.github/dependabot.yml +14 -0
- observe_kit-0.1.1/.github/pull_request_template.md +8 -0
- observe_kit-0.1.1/.github/workflows/ci.yml +56 -0
- observe_kit-0.1.1/.github/workflows/claude-review.yml +179 -0
- observe_kit-0.1.1/.github/workflows/pr.yml +12 -0
- observe_kit-0.1.1/.github/workflows/release.yml +60 -0
- observe_kit-0.1.1/.gitignore +11 -0
- observe_kit-0.1.1/CHANGELOG.md +22 -0
- observe_kit-0.1.1/CONTRIBUTING.md +45 -0
- observe_kit-0.1.1/LICENSE +202 -0
- observe_kit-0.1.1/Makefile +34 -0
- observe_kit-0.1.1/NOTICE +11 -0
- observe_kit-0.1.1/PKG-INFO +203 -0
- observe_kit-0.1.1/README.md +176 -0
- observe_kit-0.1.1/SECURITY.md +12 -0
- observe_kit-0.1.1/pyproject.toml +65 -0
- observe_kit-0.1.1/src/observe_kit/__init__.py +36 -0
- observe_kit-0.1.1/src/observe_kit/decorator.py +238 -0
- observe_kit-0.1.1/src/observe_kit/events.py +48 -0
- observe_kit-0.1.1/src/observe_kit/policy.py +63 -0
- observe_kit-0.1.1/src/observe_kit/provider.py +51 -0
- observe_kit-0.1.1/src/observe_kit/py.typed +0 -0
- observe_kit-0.1.1/src/observe_kit/sinks.py +57 -0
- observe_kit-0.1.1/src/observe_kit/text.py +19 -0
- observe_kit-0.1.1/tests/test_observed.py +370 -0
- observe_kit-0.1.1/tests/test_policy.py +113 -0
- observe_kit-0.1.1/uv.lock +617 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: observed did something it should not have
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: what
|
|
7
|
+
attributes:
|
|
8
|
+
label: What happened
|
|
9
|
+
description: A minimal decorated function and how you called it, what you expected, what you got.
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: input
|
|
13
|
+
id: versions
|
|
14
|
+
attributes:
|
|
15
|
+
label: Versions
|
|
16
|
+
placeholder: observe-kit 0.1.0, structlog 25.1, Python 3.13
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Propose a change to the decorator
|
|
3
|
+
labels: [enhancement]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: Problem
|
|
9
|
+
description: What you are trying to observe, and why the decorator does not cover it today.
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: proposal
|
|
14
|
+
attributes:
|
|
15
|
+
label: Proposal
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7
|
|
16
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
17
|
+
- run: make lint typecheck
|
|
18
|
+
|
|
19
|
+
test:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
python: ["3.11", "3.12", "3.13", "3.14"]
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v7
|
|
27
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ matrix.python }}
|
|
30
|
+
- run: make tests
|
|
31
|
+
|
|
32
|
+
coverage:
|
|
33
|
+
# Coverage comment on PRs, badge on the data branch for main. Advisory, not a required check.
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
permissions:
|
|
36
|
+
contents: write
|
|
37
|
+
pull-requests: write
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v7
|
|
40
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
41
|
+
with:
|
|
42
|
+
python-version: "3.13"
|
|
43
|
+
- run: make tests
|
|
44
|
+
- uses: py-cov-action/python-coverage-comment-action@v4.5
|
|
45
|
+
with:
|
|
46
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
47
|
+
MINIMUM_GREEN: 95
|
|
48
|
+
MINIMUM_ORANGE: 85
|
|
49
|
+
|
|
50
|
+
build:
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@v7
|
|
54
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
55
|
+
- run: uv build
|
|
56
|
+
- run: uvx twine check --strict dist/*
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
name: claude-review
|
|
2
|
+
|
|
3
|
+
# Two jobs, one action:
|
|
4
|
+
# review — every non-draft PR gets an automatic review, posted as inline comments plus one
|
|
5
|
+
# sticky summary.
|
|
6
|
+
# mention — "@claude <question>" (or "@claude review" after a fix push) in a PR/issue comment
|
|
7
|
+
# gets an answer. Maintainers only: see the `if` on that job.
|
|
8
|
+
#
|
|
9
|
+
# Authenticated with a Claude subscription OAuth token (CLAUDE_CODE_OAUTH_TOKEN, from
|
|
10
|
+
# `claude setup-token`). Until that secret exists the jobs skip with a notice instead of failing:
|
|
11
|
+
# a missing reviewer must not turn a PR red.
|
|
12
|
+
#
|
|
13
|
+
# Public-repo safety:
|
|
14
|
+
# - PRs from forks get no secrets on `pull_request`, so they are skipped with the same notice.
|
|
15
|
+
# Never switch this to `pull_request_target`: that hands the token to code from a stranger's fork.
|
|
16
|
+
# - `issue_comment` runs WITH secrets on any PR, forks included, so the mention job only answers
|
|
17
|
+
# comments from the repo owner, members and collaborators.
|
|
18
|
+
# - The reviewer is read-only on the repo (contents: read). It can comment; it can never push.
|
|
19
|
+
#
|
|
20
|
+
# The action refuses to run a workflow file that differs from the copy on the default branch
|
|
21
|
+
# (anti-tamper), so a change to THIS file must be merged on its own before a PR carrying the
|
|
22
|
+
# same change can be reviewed.
|
|
23
|
+
|
|
24
|
+
on:
|
|
25
|
+
pull_request:
|
|
26
|
+
# Not on every push, because each round uses the plan's quota. After fixes, ask again with
|
|
27
|
+
# "@claude review".
|
|
28
|
+
types: [opened, reopened, ready_for_review]
|
|
29
|
+
issue_comment:
|
|
30
|
+
types: [created]
|
|
31
|
+
pull_request_review_comment:
|
|
32
|
+
types: [created]
|
|
33
|
+
|
|
34
|
+
permissions:
|
|
35
|
+
contents: read
|
|
36
|
+
pull-requests: write
|
|
37
|
+
issues: write
|
|
38
|
+
id-token: write
|
|
39
|
+
actions: read
|
|
40
|
+
|
|
41
|
+
# Keyed on event, number and actor. Without the event, the reviewer's own first inline comment
|
|
42
|
+
# (a pull_request_review_comment) cancels the review that is still running. Without the actor,
|
|
43
|
+
# the mention job's progress comment cancels the run that posted it.
|
|
44
|
+
concurrency:
|
|
45
|
+
group: claude-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.issue.number }}-${{ github.actor }}
|
|
46
|
+
cancel-in-progress: true
|
|
47
|
+
|
|
48
|
+
jobs:
|
|
49
|
+
review:
|
|
50
|
+
name: claude-review
|
|
51
|
+
if: >
|
|
52
|
+
github.event_name == 'pull_request' &&
|
|
53
|
+
github.event.pull_request.draft == false &&
|
|
54
|
+
!startsWith(github.event.pull_request.title, 'chore(release):') &&
|
|
55
|
+
github.actor != 'dependabot[bot]'
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
timeout-minutes: 30
|
|
58
|
+
steps:
|
|
59
|
+
- id: token
|
|
60
|
+
name: Is the reviewer configured?
|
|
61
|
+
env:
|
|
62
|
+
TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
63
|
+
run: |
|
|
64
|
+
if [ -n "$TOKEN" ]; then
|
|
65
|
+
echo "enabled=true" >> "$GITHUB_OUTPUT"
|
|
66
|
+
else
|
|
67
|
+
echo "enabled=false" >> "$GITHUB_OUTPUT"
|
|
68
|
+
echo "::notice title=claude-review skipped::CLAUDE_CODE_OAUTH_TOKEN is not available (not set, or a PR from a fork)."
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
- if: steps.token.outputs.enabled == 'true'
|
|
72
|
+
uses: actions/checkout@v7
|
|
73
|
+
with:
|
|
74
|
+
fetch-depth: 0 # the review needs the base branch to diff against
|
|
75
|
+
|
|
76
|
+
- if: steps.token.outputs.enabled == 'true'
|
|
77
|
+
uses: anthropics/claude-code-action@v1
|
|
78
|
+
with:
|
|
79
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
80
|
+
use_sticky_comment: true
|
|
81
|
+
prompt: |
|
|
82
|
+
REPO: ${{ github.repository }}
|
|
83
|
+
PR NUMBER: ${{ github.event.pull_request.number }}
|
|
84
|
+
|
|
85
|
+
You are reviewing a pull request for observe-kit, a small Python library whose one job
|
|
86
|
+
is the `@observed` decorator: it times a call, classifies how it ended (finished,
|
|
87
|
+
expected, swallowed, raised), writes a structlog line, emits an ObservedEvent to a
|
|
88
|
+
sink, and tells a notifier on `raised`. Applications put it on hot paths and on error
|
|
89
|
+
paths, so a regression silently changes what they log, alert on or return.
|
|
90
|
+
|
|
91
|
+
Read the README and CONTRIBUTING.md first. They define the contract:
|
|
92
|
+
- The four outcomes and their rules are public API: `expected` is warned and
|
|
93
|
+
re-raised; `swallow` is logged at debug and returns `default`; any other Exception
|
|
94
|
+
is RAISED (error with traceback, notifier, re-raise); a type in both tuples counts as
|
|
95
|
+
expected; BaseExceptions that are not Exceptions pass through untouched unless
|
|
96
|
+
listed. The re-raise must be a bare `raise`, so tracebacks gain no frame.
|
|
97
|
+
- The decorator never changes the wrapped function's return value, signature
|
|
98
|
+
metadata (functools.wraps) or sync/async nature, and refuses generators.
|
|
99
|
+
- Event names (`<name>.<outcome>`), the ObservedEvent fields, the log line's keys
|
|
100
|
+
(duration_ms, error, the bound context) and the EventSink / Notifier protocols are
|
|
101
|
+
public API: sinks and dashboards downstream depend on them.
|
|
102
|
+
- NotifyPolicy is a privacy boundary. By default no context field reaches a notifier;
|
|
103
|
+
only allow-listed fields, only the first line of the error, and never a URL.
|
|
104
|
+
Anything that lets more through is a security finding, not a style note.
|
|
105
|
+
- structlog is the only runtime dependency. A new one needs a strong reason.
|
|
106
|
+
|
|
107
|
+
Look for, in this order:
|
|
108
|
+
1. Correctness bugs: outcome classification, the sync and async wrappers drifting
|
|
109
|
+
apart, timing that does not cover the await, `fields` / `detail` resolution
|
|
110
|
+
against the signature (positional, keyword, defaults, malformed calls), Provider
|
|
111
|
+
fallbacks when an attribute is missing or the wrong shape.
|
|
112
|
+
2. Anything that widens what a notification can carry (see NotifyPolicy above).
|
|
113
|
+
3. Breaking changes to the public API above that the title does not mark with `!`
|
|
114
|
+
and a BREAKING CHANGE footer.
|
|
115
|
+
4. Workflow security: secrets reaching fork PRs, `pull_request_target`, untrusted
|
|
116
|
+
GitHub expressions (PR titles, comment bodies) interpolated straight into `run:`
|
|
117
|
+
instead of passed through `env:`, permissions wider than the job needs, or
|
|
118
|
+
publishing without trusted publishing.
|
|
119
|
+
5. New behaviour without a test, for sync and async alike. MemorySink collects
|
|
120
|
+
events, so most tests need nothing else.
|
|
121
|
+
6. README drift: a changed argument, outcome rule or protocol that the README still
|
|
122
|
+
documents the old way.
|
|
123
|
+
|
|
124
|
+
Do NOT comment on formatting, import order or line length. ruff, mypy --strict and
|
|
125
|
+
actionlint already gate those in CI. Do not restate the PR description back.
|
|
126
|
+
|
|
127
|
+
Use `gh pr diff` and `gh pr view` to see the change. Post specific findings as inline
|
|
128
|
+
comments on the exact lines (mcp__github_inline_comment__create_inline_comment).
|
|
129
|
+
Then post ONE summary comment via `gh pr comment`: a short verdict, the findings
|
|
130
|
+
ranked by severity, and anything you could not verify. If there is nothing
|
|
131
|
+
significant, say so in two sentences. A short honest review beats a long padded one.
|
|
132
|
+
|
|
133
|
+
Budget: you have a hard cap of 60 tool calls, and the run fails if you exceed it. Start
|
|
134
|
+
from `gh pr diff --name-only` and `gh pr diff`. Read a file in full only when the diff
|
|
135
|
+
alone cannot answer the question. Post the summary comment no later than your 45th
|
|
136
|
+
call, and say what you did not get to. An unposted review is worth nothing.
|
|
137
|
+
claude_args: |
|
|
138
|
+
--max-turns 60
|
|
139
|
+
--allowed-tools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Read,Grep,Glob"
|
|
140
|
+
|
|
141
|
+
mention:
|
|
142
|
+
name: claude-mention
|
|
143
|
+
# Maintainers only: issue_comment runs with secrets even on fork PRs, so anyone else could
|
|
144
|
+
# spend the plan's quota. Never react to the bot's own comments, or it talks to itself forever.
|
|
145
|
+
if: >
|
|
146
|
+
(github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') &&
|
|
147
|
+
contains(github.event.comment.body, '@claude') &&
|
|
148
|
+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) &&
|
|
149
|
+
github.actor != 'claude[bot]'
|
|
150
|
+
runs-on: ubuntu-latest
|
|
151
|
+
timeout-minutes: 30
|
|
152
|
+
steps:
|
|
153
|
+
- id: token
|
|
154
|
+
name: Is the reviewer configured?
|
|
155
|
+
env:
|
|
156
|
+
TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
157
|
+
run: |
|
|
158
|
+
if [ -n "$TOKEN" ]; then
|
|
159
|
+
echo "enabled=true" >> "$GITHUB_OUTPUT"
|
|
160
|
+
else
|
|
161
|
+
echo "enabled=false" >> "$GITHUB_OUTPUT"
|
|
162
|
+
echo "::notice title=claude-mention skipped::CLAUDE_CODE_OAUTH_TOKEN is not set."
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
- if: steps.token.outputs.enabled == 'true'
|
|
166
|
+
uses: actions/checkout@v7
|
|
167
|
+
with:
|
|
168
|
+
fetch-depth: 0
|
|
169
|
+
|
|
170
|
+
- if: steps.token.outputs.enabled == 'true'
|
|
171
|
+
uses: anthropics/claude-code-action@v1
|
|
172
|
+
with:
|
|
173
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
174
|
+
# No prompt means tag mode: it answers the @claude comment in context. "@claude review"
|
|
175
|
+
# is a full review of the head, so it gets the review job's budget. A question gets 20.
|
|
176
|
+
claude_args: |
|
|
177
|
+
--max-turns ${{ contains(github.event.comment.body, '@claude review') && '60' || '20' }}
|
|
178
|
+
--append-system-prompt "You have a hard cap on tool calls (--max-turns) and the run FAILS the moment you exceed it. Work from `gh pr diff --name-only` and `gh pr diff`; read a file in full only when the diff cannot answer the question. Post your answer (for a review request, one summary comment via `gh pr comment`) by three quarters of that budget at the latest, saying plainly what you did not get to."
|
|
179
|
+
--allowed-tools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh issue view:*),Read,Grep,Glob"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# `make release` opens the release PR; squash-merging it lands here, tags vX.Y.Z and publishes.
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
tag:
|
|
14
|
+
uses: MdaaaaO/conventional-release/.github/workflows/tag.yml@v0
|
|
15
|
+
permissions:
|
|
16
|
+
contents: write
|
|
17
|
+
|
|
18
|
+
build:
|
|
19
|
+
needs: tag
|
|
20
|
+
if: needs.tag.outputs.released == 'true'
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v7
|
|
24
|
+
with:
|
|
25
|
+
ref: ${{ needs.tag.outputs.tag }}
|
|
26
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
27
|
+
- run: uv build
|
|
28
|
+
- run: uvx twine check --strict dist/*
|
|
29
|
+
- uses: actions/upload-artifact@v7
|
|
30
|
+
with:
|
|
31
|
+
name: dist
|
|
32
|
+
path: dist/
|
|
33
|
+
|
|
34
|
+
testpypi:
|
|
35
|
+
needs: build
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
environment: testpypi
|
|
38
|
+
permissions:
|
|
39
|
+
id-token: write # trusted publishing, no token stored anywhere
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/download-artifact@v8
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
45
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
46
|
+
with:
|
|
47
|
+
repository-url: https://test.pypi.org/legacy/
|
|
48
|
+
|
|
49
|
+
pypi:
|
|
50
|
+
needs: testpypi
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
environment: pypi # required reviewer: the maintainer
|
|
53
|
+
permissions:
|
|
54
|
+
id-token: write
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/download-artifact@v8
|
|
57
|
+
with:
|
|
58
|
+
name: dist
|
|
59
|
+
path: dist/
|
|
60
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
## 0.1.1 (2026-09-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Documentation
|
|
9
|
+
|
|
10
|
+
* contribution model, coverage report and badges ([#3](https://github.com/MdaaaaO/observe-kit/issues/3)) ([29cd95e](https://github.com/MdaaaaO/observe-kit/commit/29cd95ec318474eb71f9e3d1fc6b048d481a2cb5))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### CI
|
|
14
|
+
|
|
15
|
+
* claude review on pull requests ([#2](https://github.com/MdaaaaO/observe-kit/issues/2)) ([998b9b9](https://github.com/MdaaaaO/observe-kit/commit/998b9b9e76edea8bc7dcf95e258069ed715997b7))
|
|
16
|
+
|
|
17
|
+
## 0.1.0 (2026-09-25)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* observed decorator with sinks, notifier and notify policy ([4116dab](https://github.com/MdaaaaO/observe-kit/commit/4116dab7d4de6808fd7c62d48a2d4256c03bf56b))
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for helping. The short version:
|
|
4
|
+
|
|
5
|
+
- **Open an issue first** for anything bigger than a typo, so we agree on the change before you write it.
|
|
6
|
+
- **PR titles are [Conventional Commits](https://www.conventionalcommits.org).** PRs are
|
|
7
|
+
squash-merged, the title becomes the commit, and the commit becomes the changelog line. The
|
|
8
|
+
`pr-title` check enforces this (`feat: async support`, `fix: …`, `docs: …`). Put `!` after
|
|
9
|
+
the type or scope for a breaking change, and explain it in a `BREAKING CHANGE:` footer in the
|
|
10
|
+
PR description.
|
|
11
|
+
- **`make ci` passes locally** before you push. It runs ruff, `mypy --strict`, pytest with branch
|
|
12
|
+
coverage, and actionlint. You need [uv](https://docs.astral.sh/uv/). Run `make install` once.
|
|
13
|
+
- Maintainer PRs start from an issue and say so: `Closes #N` or `Refs #N` in the description.
|
|
14
|
+
Release PRs and Dependabot are exempt.
|
|
15
|
+
- New behaviour comes with a test, for sync and `async def` alike. `MemorySink` collects events,
|
|
16
|
+
so most tests need nothing else.
|
|
17
|
+
- The scope is the decorator. Integrations (a Prometheus sink, a Slack notifier) belong in your
|
|
18
|
+
application or in a separate package; the protocols in `observe_kit.sinks` are the extension points.
|
|
19
|
+
|
|
20
|
+
## Code review
|
|
21
|
+
|
|
22
|
+
An automated Claude review comments on each PR from this repo's branches, as inline threads plus
|
|
23
|
+
one summary comment. Maintainers can ask it again after a fix push with `@claude review`. Release
|
|
24
|
+
PRs and Dependabot are not reviewed. The `coverage` job adds a comment with the coverage of the
|
|
25
|
+
lines the PR changes; PRs from forks get a read-only token, so there the job runs but cannot comment.
|
|
26
|
+
|
|
27
|
+
The review is advisory, but its threads are not optional: a PR is merged only when every thread is
|
|
28
|
+
answered and resolved (the `main` ruleset requires it). An answer is one of:
|
|
29
|
+
|
|
30
|
+
1. **A fix on the branch** — the default, even if it costs another review cycle. Reply with the
|
|
31
|
+
commit SHA.
|
|
32
|
+
2. **A follow-up issue**, only for what is genuinely outside the PR's scope, labelled
|
|
33
|
+
`review-followup` and cited in the reply. It is picked up first, right after the merge.
|
|
34
|
+
3. **A disagreement, with the reason**, citing the commit or issue that makes it checkable.
|
|
35
|
+
|
|
36
|
+
A finding is never parked without an issue number. PRs are squash-merged only, and the branch is
|
|
37
|
+
deleted on merge.
|
|
38
|
+
|
|
39
|
+
## Releasing (maintainers)
|
|
40
|
+
|
|
41
|
+
Releases use [conventional-release](https://github.com/MdaaaaO/conventional-release).
|
|
42
|
+
`make release` (or `make release ARGS=minor`) opens the `chore(release): X.Y.Z` PR. Squash-merge
|
|
43
|
+
it with the title unchanged. `release.yml` then tags the merge commit, publishes the GitHub
|
|
44
|
+
Release, publishes to TestPyPI and then to PyPI (the `pypi` environment waits for approval).
|
|
45
|
+
`make release-dry` shows what would ship.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Georg Kasper
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|