devhelm 0.1.0__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.
- devhelm-0.1.0/.github/workflows/ci.yml +53 -0
- devhelm-0.1.0/.github/workflows/release.yml +144 -0
- devhelm-0.1.0/.github/workflows/spec-check.yml +71 -0
- devhelm-0.1.0/.gitignore +207 -0
- devhelm-0.1.0/LICENSE +21 -0
- devhelm-0.1.0/Makefile +33 -0
- devhelm-0.1.0/PKG-INFO +171 -0
- devhelm-0.1.0/README.md +147 -0
- devhelm-0.1.0/docs/openapi/monitoring-api.json +1 -0
- devhelm-0.1.0/pyproject.toml +72 -0
- devhelm-0.1.0/scripts/release.sh +125 -0
- devhelm-0.1.0/scripts/typegen.sh +31 -0
- devhelm-0.1.0/src/devhelm/__init__.py +123 -0
- devhelm-0.1.0/src/devhelm/_errors.py +62 -0
- devhelm-0.1.0/src/devhelm/_generated.py +6406 -0
- devhelm-0.1.0/src/devhelm/_http.py +99 -0
- devhelm-0.1.0/src/devhelm/_pagination.py +74 -0
- devhelm-0.1.0/src/devhelm/client.py +83 -0
- devhelm-0.1.0/src/devhelm/py.typed +0 -0
- devhelm-0.1.0/src/devhelm/resources/__init__.py +0 -0
- devhelm-0.1.0/src/devhelm/resources/alert_channels.py +56 -0
- devhelm-0.1.0/src/devhelm/resources/api_keys.py +35 -0
- devhelm-0.1.0/src/devhelm/resources/dependencies.py +39 -0
- devhelm-0.1.0/src/devhelm/resources/deploy_lock.py +33 -0
- devhelm-0.1.0/src/devhelm/resources/environments.py +50 -0
- devhelm-0.1.0/src/devhelm/resources/incidents.py +44 -0
- devhelm-0.1.0/src/devhelm/resources/monitors.py +91 -0
- devhelm-0.1.0/src/devhelm/resources/notification_policies.py +60 -0
- devhelm-0.1.0/src/devhelm/resources/resource_groups.py +67 -0
- devhelm-0.1.0/src/devhelm/resources/secrets.py +37 -0
- devhelm-0.1.0/src/devhelm/resources/status.py +18 -0
- devhelm-0.1.0/src/devhelm/resources/tags.py +48 -0
- devhelm-0.1.0/src/devhelm/resources/webhooks.py +56 -0
- devhelm-0.1.0/src/devhelm/types.py +90 -0
- devhelm-0.1.0/tests/__init__.py +0 -0
- devhelm-0.1.0/tests/run_sdk.py +276 -0
- devhelm-0.1.0/tests/test_client.py +71 -0
- devhelm-0.1.0/tests/test_errors.py +87 -0
- devhelm-0.1.0/tests/test_http.py +81 -0
- devhelm-0.1.0/uv.lock +1371 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: astral-sh/setup-uv@v4
|
|
17
|
+
with:
|
|
18
|
+
enable-cache: true
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.13'
|
|
22
|
+
- run: uv sync
|
|
23
|
+
- run: uv run ruff check src/ tests/
|
|
24
|
+
- run: uv run ruff format --check src/ tests/
|
|
25
|
+
|
|
26
|
+
typecheck:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
- uses: astral-sh/setup-uv@v4
|
|
31
|
+
with:
|
|
32
|
+
enable-cache: true
|
|
33
|
+
- uses: actions/setup-python@v5
|
|
34
|
+
with:
|
|
35
|
+
python-version: '3.13'
|
|
36
|
+
- run: uv sync
|
|
37
|
+
- run: uv run mypy src/
|
|
38
|
+
|
|
39
|
+
test:
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
strategy:
|
|
42
|
+
matrix:
|
|
43
|
+
python-version: ['3.11', '3.13']
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v4
|
|
46
|
+
- uses: astral-sh/setup-uv@v4
|
|
47
|
+
with:
|
|
48
|
+
enable-cache: true
|
|
49
|
+
- uses: actions/setup-python@v5
|
|
50
|
+
with:
|
|
51
|
+
python-version: ${{ matrix.python-version }}
|
|
52
|
+
- run: uv sync
|
|
53
|
+
- run: uv run pytest -v
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ['v*']
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: astral-sh/setup-uv@v4
|
|
16
|
+
with:
|
|
17
|
+
enable-cache: true
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: '3.13'
|
|
21
|
+
- run: uv sync
|
|
22
|
+
- run: uv run pytest -v
|
|
23
|
+
- run: uv run ruff check src/ tests/
|
|
24
|
+
- run: uv run python -m build
|
|
25
|
+
- uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: dist
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
notify-monorepo:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
needs: build
|
|
33
|
+
steps:
|
|
34
|
+
- name: Trigger integration tests in monorepo
|
|
35
|
+
run: |
|
|
36
|
+
gh api repos/devhelmhq/mono/dispatches \
|
|
37
|
+
-f event_type=surface_release \
|
|
38
|
+
-f "client_payload[repo]=${{ github.repository }}" \
|
|
39
|
+
-f "client_payload[tag]=${{ github.ref_name }}" \
|
|
40
|
+
-f "client_payload[sha]=${{ github.sha }}"
|
|
41
|
+
env:
|
|
42
|
+
GH_TOKEN: ${{ secrets.MONOREPO_DISPATCH_TOKEN }}
|
|
43
|
+
|
|
44
|
+
publish:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
needs: [build, notify-monorepo]
|
|
47
|
+
environment: production
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
- uses: astral-sh/setup-uv@v4
|
|
51
|
+
with:
|
|
52
|
+
enable-cache: true
|
|
53
|
+
- uses: actions/setup-python@v5
|
|
54
|
+
with:
|
|
55
|
+
python-version: '3.13'
|
|
56
|
+
- run: uv sync
|
|
57
|
+
- run: uv run python -m build
|
|
58
|
+
- name: Publish to PyPI
|
|
59
|
+
run: uv run twine upload dist/*
|
|
60
|
+
env:
|
|
61
|
+
TWINE_USERNAME: __token__
|
|
62
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
63
|
+
- name: Trigger publish verification in monorepo
|
|
64
|
+
run: |
|
|
65
|
+
gh api repos/devhelmhq/mono/dispatches \
|
|
66
|
+
-f event_type=surface_published \
|
|
67
|
+
-f "client_payload[repo]=${{ github.repository }}" \
|
|
68
|
+
-f "client_payload[tag]=${{ github.ref_name }}" \
|
|
69
|
+
-f "client_payload[sha]=${{ github.sha }}"
|
|
70
|
+
env:
|
|
71
|
+
GH_TOKEN: ${{ secrets.MONOREPO_DISPATCH_TOKEN }}
|
|
72
|
+
|
|
73
|
+
github-release:
|
|
74
|
+
runs-on: ubuntu-latest
|
|
75
|
+
needs: publish
|
|
76
|
+
steps:
|
|
77
|
+
- uses: actions/checkout@v4
|
|
78
|
+
with:
|
|
79
|
+
fetch-depth: 0
|
|
80
|
+
- name: Create GitHub Release
|
|
81
|
+
run: |
|
|
82
|
+
gh release create "${{ github.ref_name }}" \
|
|
83
|
+
--title "${{ github.ref_name }}" \
|
|
84
|
+
--generate-notes
|
|
85
|
+
env:
|
|
86
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
87
|
+
|
|
88
|
+
post-publish:
|
|
89
|
+
runs-on: ubuntu-latest
|
|
90
|
+
needs: [publish, github-release]
|
|
91
|
+
if: always() && needs.publish.result == 'success'
|
|
92
|
+
steps:
|
|
93
|
+
- name: Extract version info
|
|
94
|
+
id: version
|
|
95
|
+
run: |
|
|
96
|
+
TAG="${{ github.ref_name }}"
|
|
97
|
+
VERSION="${TAG#v}"
|
|
98
|
+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
99
|
+
|
|
100
|
+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
|
|
101
|
+
if [[ "$MINOR" != "0" || "$MAJOR" != "0" ]] && [[ "$PATCH" == "0" ]]; then
|
|
102
|
+
echo "is_minor_plus=true" >> "$GITHUB_OUTPUT"
|
|
103
|
+
else
|
|
104
|
+
echo "is_minor_plus=false" >> "$GITHUB_OUTPUT"
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
- name: Create Linear release ticket
|
|
108
|
+
if: env.LINEAR_API_KEY != ''
|
|
109
|
+
run: |
|
|
110
|
+
curl -s -X POST https://api.linear.app/graphql \
|
|
111
|
+
-H "Content-Type: application/json" \
|
|
112
|
+
-H "Authorization: ${{ secrets.LINEAR_API_KEY }}" \
|
|
113
|
+
-d '{
|
|
114
|
+
"query": "mutation($input: IssueCreateInput!) { issueCreate(input: $input) { success issue { identifier url } } }",
|
|
115
|
+
"variables": {
|
|
116
|
+
"input": {
|
|
117
|
+
"teamId": "${{ vars.LINEAR_RELEASES_TEAM_ID }}",
|
|
118
|
+
"projectId": "${{ vars.LINEAR_RELEASES_PROJECT_ID }}",
|
|
119
|
+
"title": "Released: Python SDK v${{ steps.version.outputs.version }}",
|
|
120
|
+
"description": "**Release:** https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}\n**CI run:** https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n**Commit:** ${{ github.sha }}"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}'
|
|
124
|
+
env:
|
|
125
|
+
LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
|
|
126
|
+
|
|
127
|
+
- name: Create Linear changelog ticket (minor+ only)
|
|
128
|
+
if: steps.version.outputs.is_minor_plus == 'true' && env.LINEAR_API_KEY != ''
|
|
129
|
+
run: |
|
|
130
|
+
curl -s -X POST https://api.linear.app/graphql \
|
|
131
|
+
-H "Content-Type: application/json" \
|
|
132
|
+
-H "Authorization: ${{ secrets.LINEAR_API_KEY }}" \
|
|
133
|
+
-d '{
|
|
134
|
+
"query": "mutation($input: IssueCreateInput!) { issueCreate(input: $input) { success issue { identifier url } } }",
|
|
135
|
+
"variables": {
|
|
136
|
+
"input": {
|
|
137
|
+
"teamId": "${{ vars.LINEAR_CONTENT_TEAM_ID }}",
|
|
138
|
+
"title": "Changelog entry: Python SDK v${{ steps.version.outputs.version }}",
|
|
139
|
+
"description": "Write changelog entry for https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}'
|
|
143
|
+
env:
|
|
144
|
+
LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: Spec Check
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
repository_dispatch:
|
|
5
|
+
types: [spec_updated]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
issues: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
check-compatibility:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: astral-sh/setup-uv@v4
|
|
18
|
+
with:
|
|
19
|
+
enable-cache: true
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: '3.13'
|
|
23
|
+
|
|
24
|
+
- name: Download latest OpenAPI spec from monorepo
|
|
25
|
+
run: |
|
|
26
|
+
gh api repos/devhelmhq/mono/contents/docs/openapi/monitoring-api.yaml \
|
|
27
|
+
-H "Accept: application/vnd.github.raw+json" \
|
|
28
|
+
-o docs/openapi/monitoring-api.json
|
|
29
|
+
env:
|
|
30
|
+
GH_TOKEN: ${{ secrets.MONOREPO_DISPATCH_TOKEN }}
|
|
31
|
+
|
|
32
|
+
- run: uv sync
|
|
33
|
+
- run: uv run pytest -v
|
|
34
|
+
|
|
35
|
+
- name: Regenerate types from spec
|
|
36
|
+
run: ./scripts/typegen.sh
|
|
37
|
+
|
|
38
|
+
- name: Check for type changes
|
|
39
|
+
id: diff
|
|
40
|
+
run: |
|
|
41
|
+
if git diff --quiet src/devhelm/_generated.py docs/openapi/; then
|
|
42
|
+
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
43
|
+
else
|
|
44
|
+
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
- name: Open PR with updated types
|
|
48
|
+
if: steps.diff.outputs.changed == 'true'
|
|
49
|
+
run: |
|
|
50
|
+
git config user.name "github-actions[bot]"
|
|
51
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
52
|
+
branch="chore/update-api-types-$(date +%Y%m%d%H%M%S)"
|
|
53
|
+
git checkout -b "$branch"
|
|
54
|
+
git add src/devhelm/_generated.py docs/openapi/monitoring-api.json
|
|
55
|
+
git commit -m "chore: update generated API types from latest spec"
|
|
56
|
+
git push -u origin "$branch"
|
|
57
|
+
gh pr create \
|
|
58
|
+
--title "chore: update generated API types" \
|
|
59
|
+
--body "Auto-generated from latest OpenAPI spec in the monorepo." \
|
|
60
|
+
--base main
|
|
61
|
+
env:
|
|
62
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
63
|
+
|
|
64
|
+
- name: Report failure
|
|
65
|
+
if: failure()
|
|
66
|
+
run: |
|
|
67
|
+
gh issue create \
|
|
68
|
+
--title "API spec change broke Python SDK build" \
|
|
69
|
+
--body "The monorepo pushed a spec update that caused CI failures.\n\nWorkflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
70
|
+
env:
|
|
71
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
devhelm-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
devhelm-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DevHelm
|
|
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.
|
devhelm-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.PHONY: build test lint lint-fix typecheck typegen clean release help
|
|
2
|
+
|
|
3
|
+
build: ## Build the package
|
|
4
|
+
uv run python -m build
|
|
5
|
+
|
|
6
|
+
test: ## Run unit tests
|
|
7
|
+
uv run pytest
|
|
8
|
+
|
|
9
|
+
lint: ## Run ruff linter + formatter check
|
|
10
|
+
uv run ruff check src/ tests/
|
|
11
|
+
uv run ruff format --check src/ tests/
|
|
12
|
+
|
|
13
|
+
lint-fix: ## Auto-fix lint and format issues
|
|
14
|
+
uv run ruff check --fix src/ tests/
|
|
15
|
+
uv run ruff format src/ tests/
|
|
16
|
+
|
|
17
|
+
typecheck: ## Run mypy strict type checking
|
|
18
|
+
uv run mypy src/
|
|
19
|
+
|
|
20
|
+
typegen: ## Regenerate Pydantic models from OpenAPI spec
|
|
21
|
+
./scripts/typegen.sh
|
|
22
|
+
|
|
23
|
+
clean: ## Remove build artifacts
|
|
24
|
+
rm -rf dist build *.egg-info src/*.egg-info
|
|
25
|
+
|
|
26
|
+
release: ## Release a new version: make release VERSION=0.1.0
|
|
27
|
+
@test -n "$(VERSION)" || (echo "Usage: make release VERSION=x.y.z" && exit 1)
|
|
28
|
+
./scripts/release.sh $(VERSION)
|
|
29
|
+
|
|
30
|
+
help: ## Show this help
|
|
31
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
|
|
32
|
+
|
|
33
|
+
.DEFAULT_GOAL := help
|
devhelm-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devhelm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: DevHelm SDK for Python — typed client for monitors, incidents, alerting, and more
|
|
5
|
+
Project-URL: Homepage, https://github.com/devhelmhq/sdk-python
|
|
6
|
+
Project-URL: Repository, https://github.com/devhelmhq/sdk-python.git
|
|
7
|
+
Project-URL: Issues, https://github.com/devhelmhq/sdk-python/issues
|
|
8
|
+
Author-email: DevHelm <hello@devhelm.io>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: api-client,devhelm,monitoring,sdk,uptime
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: httpx>=0.27
|
|
22
|
+
Requires-Dist: pydantic[email]>=2.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# DevHelm Python SDK
|
|
26
|
+
|
|
27
|
+
Typed Python client for the [DevHelm](https://devhelm.io) monitoring API — monitors, incidents, alerting, and more.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install devhelm
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from devhelm import Devhelm
|
|
39
|
+
|
|
40
|
+
client = Devhelm(
|
|
41
|
+
token="your-api-token",
|
|
42
|
+
org_id="your-org-id",
|
|
43
|
+
workspace_id="your-workspace-id",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# List all monitors
|
|
47
|
+
monitors = client.monitors.list()
|
|
48
|
+
for m in monitors:
|
|
49
|
+
print(f"{m.name} — {m.type}")
|
|
50
|
+
|
|
51
|
+
# Create a monitor
|
|
52
|
+
monitor = client.monitors.create({
|
|
53
|
+
"name": "My API Health",
|
|
54
|
+
"type": "HTTP",
|
|
55
|
+
"config": {"url": "https://api.example.com/health", "method": "GET"},
|
|
56
|
+
"frequencySeconds": 60,
|
|
57
|
+
"regions": ["us-east"],
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
# Get a single monitor
|
|
61
|
+
monitor = client.monitors.get(monitor.id)
|
|
62
|
+
|
|
63
|
+
# Pause / resume
|
|
64
|
+
client.monitors.pause(monitor.id)
|
|
65
|
+
client.monitors.resume(monitor.id)
|
|
66
|
+
|
|
67
|
+
# Delete
|
|
68
|
+
client.monitors.delete(monitor.id)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from devhelm import Devhelm
|
|
75
|
+
|
|
76
|
+
client = Devhelm(
|
|
77
|
+
token="your-api-token", # required (or DEVHELM_API_TOKEN env var)
|
|
78
|
+
org_id="1", # required (or DEVHELM_ORG_ID env var)
|
|
79
|
+
workspace_id="1", # required (or DEVHELM_WORKSPACE_ID env var)
|
|
80
|
+
base_url="https://api.devhelm.io", # optional, defaults to production
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Environment variables are used as fallbacks when constructor arguments are not provided:
|
|
85
|
+
|
|
86
|
+
| Parameter | Env Variable |
|
|
87
|
+
| -------------- | ----------------------- |
|
|
88
|
+
| `token` | `DEVHELM_API_TOKEN` |
|
|
89
|
+
| `org_id` | `DEVHELM_ORG_ID` |
|
|
90
|
+
| `workspace_id` | `DEVHELM_WORKSPACE_ID` |
|
|
91
|
+
|
|
92
|
+
## Resources
|
|
93
|
+
|
|
94
|
+
The client exposes the following resource modules:
|
|
95
|
+
|
|
96
|
+
| Resource | Description |
|
|
97
|
+
| ----------------------- | -------------------------------- |
|
|
98
|
+
| `client.monitors` | HTTP, DNS, TCP, ICMP, MCP, and Heartbeat monitors |
|
|
99
|
+
| `client.incidents` | Manual and auto-detected incidents |
|
|
100
|
+
| `client.alert_channels` | Slack, email, webhook, and other alert channels |
|
|
101
|
+
| `client.notification_policies` | Routing rules for alerts |
|
|
102
|
+
| `client.environments` | Environment grouping (prod, staging, etc.) |
|
|
103
|
+
| `client.secrets` | Encrypted secrets for monitor auth |
|
|
104
|
+
| `client.tags` | Organize monitors with tags |
|
|
105
|
+
| `client.resource_groups`| Logical resource groups |
|
|
106
|
+
| `client.webhooks` | Outgoing webhook endpoints |
|
|
107
|
+
| `client.api_keys` | API key management |
|
|
108
|
+
| `client.dependencies` | Service dependency tracking |
|
|
109
|
+
| `client.deploy_lock` | Deploy lock for safe deployments |
|
|
110
|
+
| `client.status` | Dashboard overview |
|
|
111
|
+
|
|
112
|
+
## Pagination
|
|
113
|
+
|
|
114
|
+
List methods auto-paginate by default. For manual page control:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
# Auto-paginate (fetches all pages)
|
|
118
|
+
all_monitors = client.monitors.list()
|
|
119
|
+
|
|
120
|
+
# Manual page control
|
|
121
|
+
page = client.monitors.list_page(page=0, size=20)
|
|
122
|
+
print(page.data) # list of monitors
|
|
123
|
+
print(page.has_next) # True if more pages
|
|
124
|
+
print(page.has_prev) # True if previous page exists
|
|
125
|
+
|
|
126
|
+
# Cursor pagination (for check results)
|
|
127
|
+
results = client.monitors.results(monitor_id, limit=50)
|
|
128
|
+
print(results.data)
|
|
129
|
+
print(results.next_cursor)
|
|
130
|
+
print(results.has_more)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Error Handling
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from devhelm import Devhelm, DevhelmError, AuthError
|
|
137
|
+
|
|
138
|
+
client = Devhelm(token="bad-token", org_id="1", workspace_id="1")
|
|
139
|
+
|
|
140
|
+
try:
|
|
141
|
+
client.monitors.list()
|
|
142
|
+
except AuthError as e:
|
|
143
|
+
print(f"Auth failed: {e.message} (HTTP {e.status})")
|
|
144
|
+
except DevhelmError as e:
|
|
145
|
+
print(f"API error [{e.code}]: {e.message}")
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Error codes: `AUTH`, `NOT_FOUND`, `CONFLICT`, `VALIDATION`, `API`.
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Install dependencies
|
|
154
|
+
uv sync
|
|
155
|
+
|
|
156
|
+
# Run tests
|
|
157
|
+
make test
|
|
158
|
+
|
|
159
|
+
# Lint + format check
|
|
160
|
+
make lint
|
|
161
|
+
|
|
162
|
+
# Type check
|
|
163
|
+
make typecheck
|
|
164
|
+
|
|
165
|
+
# Regenerate types from OpenAPI spec
|
|
166
|
+
make typegen
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT
|