Skip to content

Commit 3607a14

Browse files
first commit
0 parents  commit 3607a14

112 files changed

Lines changed: 11752 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.

.claude/settings.local.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(gh api *)"
5+
]
6+
}
7+
}

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
9+
[*.py]
10+
indent_style = space
11+
indent_size = 4
12+
13+
[*.{yml,yaml,toml,json}]
14+
indent_style = space
15+
indent_size = 2
16+
17+
[*.md]
18+
trim_trailing_whitespace = false

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
name: test (py${{ matrix.python-version }})
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.10", "3.11", "3.12", "3.13"]
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v3
24+
with:
25+
enable-cache: true
26+
27+
- name: Install Python ${{ matrix.python-version }}
28+
run: uv python install ${{ matrix.python-version }}
29+
30+
- name: Sync dependencies
31+
run: uv sync --python ${{ matrix.python-version }}
32+
33+
- name: Lint (ruff)
34+
run: uv run ruff check .
35+
36+
- name: Format check (ruff)
37+
run: uv run ruff format --check .
38+
39+
- name: Type check (pyright)
40+
run: uv run pyright
41+
42+
- name: Unit tests
43+
run: uv run pytest tests/unit -v

.github/workflows/regen.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: regen
2+
3+
on:
4+
schedule:
5+
- cron: "0 7 * * 1"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
regen:
14+
name: bump protobuf schema pin
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Discover latest archive version
20+
id: latest
21+
run: |
22+
current=$(grep -E 'readonly BUF_PY_VERSION="' scripts/regen.sh \
23+
| sed -E 's/.*="([^"]+)".*/\1/')
24+
echo "current=$current" >> "$GITHUB_OUTPUT"
25+
# Buf does not expose a public version-list endpoint; we resolve
26+
# `main` to a pinned ref by introspecting the redirect target.
27+
latest=$(curl -sI \
28+
"https://buf.build/gen/archive/openstatus/api/protocolbuffers/python/main.zip" \
29+
| grep -i '^location:' | sed -E 's/.*\/([^/]+)\.zip.*/\1/' | tr -d '\r')
30+
echo "latest=$latest" >> "$GITHUB_OUTPUT"
31+
32+
- name: No-op when already up to date
33+
if: steps.latest.outputs.latest == steps.latest.outputs.current
34+
run: echo "Already on ${{ steps.latest.outputs.current }}; nothing to do."
35+
36+
- name: Bump pin and regenerate
37+
if: steps.latest.outputs.latest != steps.latest.outputs.current
38+
run: |
39+
sed -i -E "s/(readonly BUF_PY_VERSION=)\"[^\"]+\"/\1\"${{ steps.latest.outputs.latest }}\"/" \
40+
scripts/regen.sh
41+
bash scripts/regen.sh
42+
43+
- name: Open PR
44+
if: steps.latest.outputs.latest != steps.latest.outputs.current
45+
uses: peter-evans/create-pull-request@v6
46+
with:
47+
branch: regen/${{ steps.latest.outputs.latest }}
48+
commit-message: "chore: bump buf schema to ${{ steps.latest.outputs.latest }}"
49+
title: "chore: bump buf schema to ${{ steps.latest.outputs.latest }}"
50+
body: |
51+
Automated bump of the pinned `protocolbuffers/python` archive
52+
version from `${{ steps.latest.outputs.current }}` to
53+
`${{ steps.latest.outputs.latest }}`.

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
11+
jobs:
12+
publish:
13+
name: build and publish to PyPI
14+
runs-on: ubuntu-latest
15+
environment:
16+
name: pypi
17+
url: https://pypi.org/p/openstatus
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v3
23+
with:
24+
enable-cache: true
25+
26+
- name: Build sdist and wheel
27+
run: uv build
28+
29+
- name: Publish to PyPI via Trusted Publisher
30+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
*.so
5+
6+
.venv/
7+
venv/
8+
env/
9+
10+
dist/
11+
build/
12+
*.egg-info/
13+
*.egg
14+
.eggs/
15+
16+
.pytest_cache/
17+
.ruff_cache/
18+
.mypy_cache/
19+
.pyright_cache/
20+
21+
.coverage
22+
htmlcov/
23+
24+
.DS_Store
25+
.idea/
26+
.vscode/
27+
*.swp

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Initial implementation of the Openstatus Python SDK.
13+
- Sync (`OpenstatusClient`) and async (`AsyncOpenstatusClient`) clients.
14+
- Coverage for Health, Monitor, StatusReport, StatusPage, Maintenance, and Notification services.
15+
- Connect-RPC JSON transport over `httpx`.
16+
- Typed exception hierarchy mapping Connect error codes.

CONTRIBUTING.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributing
2+
3+
## Development setup
4+
5+
```bash
6+
uv sync
7+
```
8+
9+
This installs the dev dependency group (pytest, pyright, ruff, respx).
10+
11+
## Running checks
12+
13+
```bash
14+
uv run ruff check .
15+
uv run ruff format --check .
16+
uv run pyright
17+
uv run pytest tests/unit
18+
```
19+
20+
## Regenerating protobuf message classes
21+
22+
The generated tree under `src/openstatus/_gen/` is committed. To bump the pinned
23+
schema version:
24+
25+
1. Edit `BUF_PY_VERSION` in `scripts/regen.sh`.
26+
2. Run `bash scripts/regen.sh`.
27+
3. Commit `scripts/regen.sh` and the resulting `src/openstatus/_gen/` diff together.
28+
29+
A weekly GitHub Action opens this PR automatically when a newer archive is
30+
published.
31+
32+
## Integration tests
33+
34+
Integration tests hit the live API and are gated on `OPENSTATUS_API_KEY`. They
35+
are not run in CI:
36+
37+
```bash
38+
OPENSTATUS_API_KEY=... uv run pytest tests/integration
39+
```
40+
41+
## PR conventions
42+
43+
- Use `from __future__ import annotations` at the top of every hand-written
44+
module.
45+
- Keep public surface explicit via `__all__`.
46+
- Add a `CHANGELOG.md` entry under `[Unreleased]` for any user-visible change.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Openstatus
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)