solidping 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.
- solidping-0.1.0/.github/renovate.json +85 -0
- solidping-0.1.0/.github/workflows/ci.yml +70 -0
- solidping-0.1.0/.github/workflows/pr-title.yml +61 -0
- solidping-0.1.0/.github/workflows/regenerate.yml +42 -0
- solidping-0.1.0/.github/workflows/release-please.yml +75 -0
- solidping-0.1.0/.gitignore +12 -0
- solidping-0.1.0/.release-please-manifest.json +1 -0
- solidping-0.1.0/AGENTS.md +50 -0
- solidping-0.1.0/CHANGELOG.md +8 -0
- solidping-0.1.0/CLAUDE.md +1 -0
- solidping-0.1.0/LICENSE +21 -0
- solidping-0.1.0/Makefile +39 -0
- solidping-0.1.0/PKG-INFO +134 -0
- solidping-0.1.0/README.md +120 -0
- solidping-0.1.0/openapi/openapi.yaml +20750 -0
- solidping-0.1.0/pyproject.toml +42 -0
- solidping-0.1.0/release-please-config.json +27 -0
- solidping-0.1.0/scripts/generate.py +275 -0
- solidping-0.1.0/specs/done/2026/11/2026-11-29-01-python-sdk-from-openapi.md +170 -0
- solidping-0.1.0/specs/todos/.gitkeep +0 -0
- solidping-0.1.0/src/solidping/__init__.py +29 -0
- solidping-0.1.0/src/solidping/_client.py +175 -0
- solidping-0.1.0/src/solidping/_errors.py +88 -0
- solidping-0.1.0/src/solidping/_generated/__init__.py +5 -0
- solidping-0.1.0/src/solidping/_generated/models.py +7140 -0
- solidping-0.1.0/src/solidping/_generated/operations.py +3247 -0
- solidping-0.1.0/src/solidping/_model.py +90 -0
- solidping-0.1.0/src/solidping/_operation.py +20 -0
- solidping-0.1.0/src/solidping/_pagination.py +32 -0
- solidping-0.1.0/src/solidping/_retry.py +74 -0
- solidping-0.1.0/src/solidping/py.typed +0 -0
- solidping-0.1.0/src/solidping/resources/__init__.py +0 -0
- solidping-0.1.0/src/solidping/resources/_base.py +56 -0
- solidping-0.1.0/src/solidping/resources/channels.py +24 -0
- solidping-0.1.0/src/solidping/resources/checks.py +34 -0
- solidping-0.1.0/src/solidping/resources/incidents.py +31 -0
- solidping-0.1.0/src/solidping/resources/maintenance_windows.py +24 -0
- solidping-0.1.0/src/solidping/resources/status_pages.py +24 -0
- solidping-0.1.0/tests/__init__.py +0 -0
- solidping-0.1.0/tests/conftest.py +62 -0
- solidping-0.1.0/tests/test_errors.py +94 -0
- solidping-0.1.0/tests/test_logging.py +61 -0
- solidping-0.1.0/tests/test_models.py +48 -0
- solidping-0.1.0/tests/test_pagination.py +46 -0
- solidping-0.1.0/tests/test_quickstart.py +82 -0
- solidping-0.1.0/tests/test_resources.py +100 -0
- solidping-0.1.0/tests/test_retry.py +143 -0
- solidping-0.1.0/uv.lock +235 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"extends": [
|
|
4
|
+
"config:recommended"
|
|
5
|
+
],
|
|
6
|
+
"prConcurrentLimit": 1,
|
|
7
|
+
"packageRules": [
|
|
8
|
+
{
|
|
9
|
+
"description": "Minor/patch/digest: automerge with squash",
|
|
10
|
+
"matchUpdateTypes": [
|
|
11
|
+
"minor",
|
|
12
|
+
"patch",
|
|
13
|
+
"digest"
|
|
14
|
+
],
|
|
15
|
+
"addLabels": [
|
|
16
|
+
"deps"
|
|
17
|
+
],
|
|
18
|
+
"automerge": true,
|
|
19
|
+
"automergeType": "pr",
|
|
20
|
+
"automergeStrategy": "squash",
|
|
21
|
+
"platformAutomerge": true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"matchManagers": [
|
|
25
|
+
"pep621"
|
|
26
|
+
],
|
|
27
|
+
"matchUpdateTypes": [
|
|
28
|
+
"minor",
|
|
29
|
+
"patch"
|
|
30
|
+
],
|
|
31
|
+
"groupName": "python dependencies (non-major)"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"matchManagers": [
|
|
35
|
+
"github-actions"
|
|
36
|
+
],
|
|
37
|
+
"matchUpdateTypes": [
|
|
38
|
+
"minor",
|
|
39
|
+
"patch"
|
|
40
|
+
],
|
|
41
|
+
"groupName": "github-actions (non-major)"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"description": "Major updates: no automerge",
|
|
45
|
+
"matchUpdateTypes": [
|
|
46
|
+
"major"
|
|
47
|
+
],
|
|
48
|
+
"addLabels": [
|
|
49
|
+
"deps"
|
|
50
|
+
],
|
|
51
|
+
"automerge": false
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"description": "The python version pinned in CI and in the package metadata is the SDK's supported minimum (fclairamb/solidping#1117, Minimum versions): raising it is a breaking change, done by hand when the minimum reaches its end of life. The 'latest' CI job follows the newest release on its own.",
|
|
55
|
+
"matchDepNames": [
|
|
56
|
+
"python"
|
|
57
|
+
],
|
|
58
|
+
"enabled": false
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"description": "A SolidPing release (Makefile SOLIDPING_VERSION): its PR regenerates the SDK in CI. Never automerged, whatever the update type: review the public surface before it ships. Must stay AFTER the automerge rules: the last matching rule wins.",
|
|
62
|
+
"matchDepNames": [
|
|
63
|
+
"fclairamb/solidping"
|
|
64
|
+
],
|
|
65
|
+
"addLabels": [
|
|
66
|
+
"solidping-bump"
|
|
67
|
+
],
|
|
68
|
+
"semanticCommitType": "feat",
|
|
69
|
+
"semanticCommitScope": "api",
|
|
70
|
+
"automerge": false
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"customManagers": [
|
|
74
|
+
{
|
|
75
|
+
"customType": "regex",
|
|
76
|
+
"description": "The SolidPing version the SDK is generated from",
|
|
77
|
+
"managerFilePatterns": [
|
|
78
|
+
"/(^|/)Makefile$/"
|
|
79
|
+
],
|
|
80
|
+
"matchStrings": [
|
|
81
|
+
"# renovate: datasource=(?<datasource>[a-z-]+) depName=(?<depName>[^\\s]+)\\s+[A-Z_]+ = (?<currentValue>\\S+)"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ci-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
lint:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- uses: astral-sh/setup-uv@v6
|
|
21
|
+
- run: uv run ruff check .
|
|
22
|
+
- run: uv run ruff format --check .
|
|
23
|
+
# The generated code must match the spec of SOLIDPING_VERSION. A Renovate bump PR is
|
|
24
|
+
# regenerated by regenerate.yml instead, so it is not checked here.
|
|
25
|
+
- name: Generated code is up to date
|
|
26
|
+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'solidping-bump') }}
|
|
27
|
+
run: |
|
|
28
|
+
make generate
|
|
29
|
+
git diff --exit-code -- openapi src/solidping/_generated
|
|
30
|
+
|
|
31
|
+
test:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
strategy:
|
|
34
|
+
fail-fast: false
|
|
35
|
+
matrix:
|
|
36
|
+
# The minimum and the latest release of Python.
|
|
37
|
+
python-version: ["3.14", "3.x"]
|
|
38
|
+
env:
|
|
39
|
+
SOLIDPING_TEST_URL: http://localhost:4000
|
|
40
|
+
SOLIDPING_TEST_REQUIRED: "1"
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v7
|
|
43
|
+
# setup-python resolves "3.x" to the latest release; uv's python-version input doesn't.
|
|
44
|
+
- uses: actions/setup-python@v6
|
|
45
|
+
id: python
|
|
46
|
+
with:
|
|
47
|
+
python-version: ${{ matrix.python-version }}
|
|
48
|
+
- uses: astral-sh/setup-uv@v6
|
|
49
|
+
with:
|
|
50
|
+
python-version: ${{ steps.python.outputs.python-version }}
|
|
51
|
+
# Test mode seeds the organization "test" and a user, the tests create their own token.
|
|
52
|
+
- name: Start SolidPing in test mode
|
|
53
|
+
run: make test-server
|
|
54
|
+
- name: Run the tests, README quickstarts included
|
|
55
|
+
run: make test
|
|
56
|
+
- name: Server logs
|
|
57
|
+
if: failure()
|
|
58
|
+
run: docker logs solidping-test
|
|
59
|
+
|
|
60
|
+
build:
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v7
|
|
64
|
+
- uses: astral-sh/setup-uv@v6
|
|
65
|
+
- run: uv build
|
|
66
|
+
- name: The wheel installs and imports
|
|
67
|
+
run: |
|
|
68
|
+
uv venv --python 3.14 /tmp/check
|
|
69
|
+
uv pip install --python /tmp/check/bin/python dist/*.whl
|
|
70
|
+
/tmp/check/bin/python -c "import solidping; print(solidping.SolidPing)"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: PR Title
|
|
2
|
+
|
|
3
|
+
# This repository squash-merges exclusively, with squash_merge_commit_title set
|
|
4
|
+
# to PR_TITLE — so a pull request's title is not a label, it IS the commit
|
|
5
|
+
# subject that lands on main. release-please (release-type: python) then parses
|
|
6
|
+
# those subjects to decide the next version and build the changelog.
|
|
7
|
+
#
|
|
8
|
+
# A non-conventional title therefore does not merely read badly: the commit
|
|
9
|
+
# becomes invisible to release-please, which reports success while silently
|
|
10
|
+
# releasing nothing.
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
pull_request:
|
|
14
|
+
types: [opened, edited, reopened, synchronize]
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
conventional-title:
|
|
21
|
+
name: Conventional commit title
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- name: Validate the PR title
|
|
25
|
+
env:
|
|
26
|
+
# Via env, never inlined into the script: a title is attacker-controlled
|
|
27
|
+
# text and would otherwise be a shell injection.
|
|
28
|
+
TITLE: ${{ github.event.pull_request.title }}
|
|
29
|
+
run: |
|
|
30
|
+
set -euo pipefail
|
|
31
|
+
|
|
32
|
+
# Types kept in step with release-please-config.json's changelog-sections.
|
|
33
|
+
TYPES='feat|fix|perf|revert|docs|style|chore|refactor|test|build|ci'
|
|
34
|
+
|
|
35
|
+
# <type>[optional (scope)][optional !]: <description>
|
|
36
|
+
if [[ ! "$TITLE" =~ ^($TYPES)(\([a-z0-9._/-]+\))?!?:\ .+ ]]; then
|
|
37
|
+
{
|
|
38
|
+
echo "### ❌ PR title is not a conventional commit"
|
|
39
|
+
echo
|
|
40
|
+
echo '```'
|
|
41
|
+
echo "$TITLE"
|
|
42
|
+
echo '```'
|
|
43
|
+
echo
|
|
44
|
+
echo "This repo squash-merges with the **PR title as the commit subject**, and"
|
|
45
|
+
echo "release-please parses those subjects. A title it cannot parse is dropped"
|
|
46
|
+
echo "from the changelog and from version selection — silently, with a green"
|
|
47
|
+
echo "pipeline."
|
|
48
|
+
echo
|
|
49
|
+
echo "Retitle as \`<type>(<optional scope>): <description>\`, for example:"
|
|
50
|
+
echo
|
|
51
|
+
echo "- \`feat(check): add the region_count option\`"
|
|
52
|
+
echo "- \`fix: report no change when the labels are equal\`"
|
|
53
|
+
echo
|
|
54
|
+
echo "Allowed types: \`${TYPES//|/\`, \`}\`."
|
|
55
|
+
} >> "$GITHUB_STEP_SUMMARY"
|
|
56
|
+
|
|
57
|
+
echo "::error title=PR title is not a conventional commit::$TITLE"
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
echo "✅ '$TITLE' is a conventional commit subject."
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# A Renovate PR that bumps SOLIDPING_VERSION (label `solidping-bump`) only changes the Makefile.
|
|
2
|
+
# Regenerate the code from the new spec and push it to the PR branch, so the tests of ci.yml run
|
|
3
|
+
# the regenerated code against the server image of the same version. When nothing changed, the PR
|
|
4
|
+
# stays a plain version bump.
|
|
5
|
+
#
|
|
6
|
+
# Secrets:
|
|
7
|
+
# CI_PAT token used to push, so that the push triggers CI again (a push made with GITHUB_TOKEN
|
|
8
|
+
# does not).
|
|
9
|
+
name: Regenerate
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
pull_request:
|
|
13
|
+
types: [opened, synchronize, reopened, labeled]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: write
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
regenerate:
|
|
20
|
+
if: >-
|
|
21
|
+
contains(github.event.pull_request.labels.*.name, 'solidping-bump') &&
|
|
22
|
+
github.event.pull_request.head.repo.full_name == github.repository &&
|
|
23
|
+
github.actor != 'github-actions[bot]'
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v7
|
|
27
|
+
with:
|
|
28
|
+
ref: ${{ github.event.pull_request.head.ref }}
|
|
29
|
+
token: ${{ secrets.CI_PAT || github.token }}
|
|
30
|
+
- uses: astral-sh/setup-uv@v6
|
|
31
|
+
- run: make generate
|
|
32
|
+
- name: Commit the regenerated code
|
|
33
|
+
run: |
|
|
34
|
+
if git diff --quiet -- openapi src/solidping/_generated; then
|
|
35
|
+
echo "Nothing to regenerate"
|
|
36
|
+
exit 0
|
|
37
|
+
fi
|
|
38
|
+
git config user.name "github-actions[bot]"
|
|
39
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
40
|
+
git add openapi src/solidping/_generated
|
|
41
|
+
git commit -m "chore(api): regenerate from the OpenAPI spec"
|
|
42
|
+
git push
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# release-please keeps a `chore(release): vX.Y.Z` pull request up to date with
|
|
2
|
+
# the changelog of what was merged since the last release, and bumps the
|
|
3
|
+
# version in pyproject.toml. Merging that PR tags the version and creates the
|
|
4
|
+
# GitHub release; the `pypi` job then builds the package and publishes it to
|
|
5
|
+
# PyPI with trusted publishing (no token: PyPI trusts this workflow file, in
|
|
6
|
+
# the `pypi` environment, of fclairamb/solidping-python).
|
|
7
|
+
#
|
|
8
|
+
# Secrets:
|
|
9
|
+
# CI_PAT token release-please acts with, so that the release PR gets a CI
|
|
10
|
+
# run and its merge triggers this workflow again. Without it the
|
|
11
|
+
# workflow falls back to GITHUB_TOKEN.
|
|
12
|
+
name: Release Please
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [main]
|
|
17
|
+
workflow_dispatch:
|
|
18
|
+
inputs:
|
|
19
|
+
tag:
|
|
20
|
+
description: Tag to publish again, e.g. v0.1.0
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
permissions:
|
|
24
|
+
contents: write
|
|
25
|
+
pull-requests: write
|
|
26
|
+
|
|
27
|
+
concurrency:
|
|
28
|
+
group: release-please
|
|
29
|
+
cancel-in-progress: false
|
|
30
|
+
|
|
31
|
+
jobs:
|
|
32
|
+
release-please:
|
|
33
|
+
if: github.event_name == 'push'
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
outputs:
|
|
36
|
+
release_created: ${{ steps.release.outputs.release_created }}
|
|
37
|
+
tag_name: ${{ steps.release.outputs.tag_name }}
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v7
|
|
40
|
+
|
|
41
|
+
- name: Ensure release-please labels exist
|
|
42
|
+
env:
|
|
43
|
+
GH_TOKEN: ${{ secrets.CI_PAT || github.token }}
|
|
44
|
+
run: |
|
|
45
|
+
gh label create "autorelease: pending" --color ededed --force --repo ${{ github.repository }}
|
|
46
|
+
gh label create "autorelease: tagged" --color ededed --force --repo ${{ github.repository }}
|
|
47
|
+
|
|
48
|
+
- id: release
|
|
49
|
+
uses: googleapis/release-please-action@v5
|
|
50
|
+
with:
|
|
51
|
+
token: ${{ secrets.CI_PAT || github.token }}
|
|
52
|
+
|
|
53
|
+
pypi:
|
|
54
|
+
needs: release-please
|
|
55
|
+
if: always() && (needs.release-please.outputs.release_created == 'true' || github.event_name == 'workflow_dispatch')
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
environment:
|
|
58
|
+
name: pypi
|
|
59
|
+
url: https://pypi.org/project/solidping/
|
|
60
|
+
permissions:
|
|
61
|
+
contents: write
|
|
62
|
+
id-token: write
|
|
63
|
+
env:
|
|
64
|
+
TAG: ${{ needs.release-please.outputs.tag_name || inputs.tag }}
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v7
|
|
67
|
+
with:
|
|
68
|
+
ref: ${{ env.TAG }}
|
|
69
|
+
- uses: astral-sh/setup-uv@v10.4.0
|
|
70
|
+
- run: uv build
|
|
71
|
+
- name: Attach the distributions to the release
|
|
72
|
+
env:
|
|
73
|
+
GH_TOKEN: ${{ github.token }}
|
|
74
|
+
run: gh release upload "$TAG" dist/* --clobber
|
|
75
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{".":"0.1.0"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Agent instructions for every coding agent. `CLAUDE.md` is a one-line `@AGENTS.md` stub: edit this file.
|
|
4
|
+
|
|
5
|
+
Official Python SDK for SolidPing (`../solidping`), published to PyPI as `solidping`.
|
|
6
|
+
The design is fixed by fclairamb/solidping#1117 and by the issue of this repo that implements it:
|
|
7
|
+
read them before changing the public surface.
|
|
8
|
+
|
|
9
|
+
## Rules
|
|
10
|
+
|
|
11
|
+
- Models and operations are generated from SolidPing's `openapi.yaml`, downloaded at the tag in
|
|
12
|
+
`Makefile` (`SOLIDPING_VERSION`, bumped by Renovate). The client, resource attributes,
|
|
13
|
+
pagination, retries and errors are a thin hand-written layer on top. Generated code is
|
|
14
|
+
committed and never edited by hand: change the generator or its templates, then regenerate.
|
|
15
|
+
- Python 3.14 minimum. CI tests the minimum and the latest version.
|
|
16
|
+
- One runtime dependency at most (`httpx`). Synchronous only.
|
|
17
|
+
- Tests run against a real SolidPing server in test mode (the server image of `SOLIDPING_VERSION`),
|
|
18
|
+
not a mock. The README quickstart runs unchanged in CI.
|
|
19
|
+
- Its versions do not follow the server's: own semver, own changelog, release-please
|
|
20
|
+
(`release-type: python`). PR titles are conventional commits (the squash commit subject).
|
|
21
|
+
- Releases publish to PyPI by trusted publishing (`release-please.yml`, environment `pypi`): no
|
|
22
|
+
token anywhere.
|
|
23
|
+
|
|
24
|
+
## Layout
|
|
25
|
+
|
|
26
|
+
- `openapi/openapi.yaml`: the spec at `SOLIDPING_VERSION` (committed, written by `make generate`).
|
|
27
|
+
- `scripts/generate.py`: the in-repo generator (plain classes, no runtime dependency). It writes
|
|
28
|
+
`src/solidping/_generated/` (`models.py`, `operations.py`): never edited by hand.
|
|
29
|
+
- `src/solidping/`: the hand-written layer. `_client.py` (config, auth, `request()`),
|
|
30
|
+
`_retry.py`, `_errors.py`, `_pagination.py`, `_model.py` (base of the generated models) and
|
|
31
|
+
`resources/` (one module per resource; they call operations of the generated table by
|
|
32
|
+
`operationId`).
|
|
33
|
+
- `tests/`: run against a real server; only `test_retry.py`, `test_pagination.py` and the offline
|
|
34
|
+
parts of the other files use no server.
|
|
35
|
+
- `.github/workflows/`: `ci.yml`, `regenerate.yml` (regenerates a `solidping-bump` Renovate PR),
|
|
36
|
+
`release-please.yml`, `pr-title.yml`.
|
|
37
|
+
|
|
38
|
+
## Commands
|
|
39
|
+
|
|
40
|
+
- `make generate`: download the spec of `SOLIDPING_VERSION` and regenerate. CI fails if the
|
|
41
|
+
committed output differs.
|
|
42
|
+
- `make test-server`: start the server image in test mode in Docker on port 4000 (`TEST_PORT` to
|
|
43
|
+
change it); `make test-server-stop` removes it.
|
|
44
|
+
- `make test`: `pytest` against it (`SOLIDPING_TEST_URL`, default `http://localhost:4000`). Without
|
|
45
|
+
a server the tests that need one are skipped; CI sets `SOLIDPING_TEST_REQUIRED=1` so that they
|
|
46
|
+
fail instead. The test-mode server seeds the org `test` and the user `test@test.com`
|
|
47
|
+
(password `test`); the tests create a personal access token with them.
|
|
48
|
+
- `make lint`: `ruff check` and `ruff format --check`.
|
|
49
|
+
- The README Python samples are extracted and run unchanged by `tests/test_quickstart.py`: keep
|
|
50
|
+
them runnable, and keep exactly the samples that test expects.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Python SDK generated from SolidPing's OpenAPI spec ([#5](https://github.com/fclairamb/solidping-python/issues/5)) ([3edf7c7](https://github.com/fclairamb/solidping-python/commit/3edf7c7584c83350ef5c4ac4dbda7466372fc552))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
solidping-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Florent Clairambault
|
|
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.
|
solidping-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# renovate: datasource=github-releases depName=fclairamb/solidping
|
|
2
|
+
SOLIDPING_VERSION = v0.59.0
|
|
3
|
+
|
|
4
|
+
# The container image tag has no leading "v".
|
|
5
|
+
SOLIDPING_IMAGE = ghcr.io/fclairamb/solidping:$(patsubst v%,%,$(SOLIDPING_VERSION))
|
|
6
|
+
SPEC_URL = https://raw.githubusercontent.com/fclairamb/solidping/$(SOLIDPING_VERSION)/server/internal/app/openapi/openapi.yaml
|
|
7
|
+
TEST_PORT ?= 4000
|
|
8
|
+
|
|
9
|
+
.PHONY: generate lint test test-server test-server-stop
|
|
10
|
+
|
|
11
|
+
# Download the OpenAPI spec at SOLIDPING_VERSION and regenerate src/solidping/_generated/.
|
|
12
|
+
generate:
|
|
13
|
+
mkdir -p openapi
|
|
14
|
+
curl -fsSL $(SPEC_URL) -o openapi/openapi.yaml
|
|
15
|
+
uv run python scripts/generate.py openapi/openapi.yaml src/solidping/_generated
|
|
16
|
+
uv run ruff format src/solidping/_generated
|
|
17
|
+
|
|
18
|
+
lint:
|
|
19
|
+
uv run ruff check .
|
|
20
|
+
uv run ruff format --check .
|
|
21
|
+
|
|
22
|
+
# Start the server image of SOLIDPING_VERSION in test mode (seeds org "test", user test@test.com
|
|
23
|
+
# with password "test") and wait until it is healthy.
|
|
24
|
+
test-server:
|
|
25
|
+
docker rm -f solidping-test >/dev/null 2>&1 || true
|
|
26
|
+
docker run -d --name solidping-test -p $(TEST_PORT):4000 \
|
|
27
|
+
-e SP_RUNMODE=test \
|
|
28
|
+
-e SP_SERVER_RATE_LIMITING_REQUESTS_PER_MINUTE=0 \
|
|
29
|
+
-e SP_SERVER_RATE_LIMITING_MAX_CONCURRENT=0 \
|
|
30
|
+
$(SOLIDPING_IMAGE)
|
|
31
|
+
for i in $$(seq 60); do curl -sf http://localhost:$(TEST_PORT)/api/mgmt/health >/dev/null && exit 0; sleep 2; done; \
|
|
32
|
+
docker logs solidping-test; exit 1
|
|
33
|
+
|
|
34
|
+
test-server-stop:
|
|
35
|
+
docker rm -f solidping-test
|
|
36
|
+
|
|
37
|
+
# Needs the server of `make test-server` (SOLIDPING_TEST_URL, default http://localhost:4000).
|
|
38
|
+
test:
|
|
39
|
+
uv run pytest
|
solidping-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: solidping
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for SolidPing
|
|
5
|
+
Project-URL: Homepage, https://www.solidping.io
|
|
6
|
+
Project-URL: Repository, https://github.com/fclairamb/solidping-python
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Typing :: Typed
|
|
11
|
+
Requires-Python: >=3.14
|
|
12
|
+
Requires-Dist: httpx>=0.28
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# SolidPing Python SDK
|
|
16
|
+
|
|
17
|
+
Official Python SDK for [SolidPing](https://www.solidping.io): manage checks, incidents and status
|
|
18
|
+
pages from Python without writing HTTP calls.
|
|
19
|
+
|
|
20
|
+
Work in progress, not published yet. The target is described in
|
|
21
|
+
[fclairamb/solidping#1117](https://github.com/fclairamb/solidping/issues/1117).
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install solidping
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Python 3.14 or later. The only dependency is `httpx`; the client is synchronous.
|
|
30
|
+
|
|
31
|
+
## Quickstart
|
|
32
|
+
|
|
33
|
+
Create a personal access token in SolidPing and export it:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
export SOLIDPING_TOKEN=pat_...
|
|
37
|
+
export SOLIDPING_ORG=acme
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from solidping import SolidPing
|
|
42
|
+
|
|
43
|
+
sp = SolidPing() # reads SOLIDPING_URL, SOLIDPING_ORG, SOLIDPING_TOKEN
|
|
44
|
+
|
|
45
|
+
# Create a check
|
|
46
|
+
check = sp.checks.create(name="Website", config={"url": "https://acme.com"})
|
|
47
|
+
print(check.slug, check.status)
|
|
48
|
+
|
|
49
|
+
# List the checks that are down
|
|
50
|
+
for check in sp.checks.list(status="down"):
|
|
51
|
+
print(check.name)
|
|
52
|
+
|
|
53
|
+
# Acknowledge every open incident
|
|
54
|
+
for incident in sp.incidents.list(state="active"):
|
|
55
|
+
sp.incidents.acknowledge(incident.uid)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
Each setting is an argument of `SolidPing(...)` or an environment variable:
|
|
61
|
+
|
|
62
|
+
| Argument | Environment | Default |
|
|
63
|
+
|---------------|-------------------|-----------------------|
|
|
64
|
+
| `url` | `SOLIDPING_URL` | `https://solidping.io` |
|
|
65
|
+
| `org` | `SOLIDPING_ORG` | required |
|
|
66
|
+
| `token` | `SOLIDPING_TOKEN` | required |
|
|
67
|
+
| `timeout` | | 30 (seconds) |
|
|
68
|
+
| `max_retries` | | 2 |
|
|
69
|
+
|
|
70
|
+
The client is also a context manager (`with SolidPing() as sp:`) and has a `close()` method.
|
|
71
|
+
|
|
72
|
+
## Resources
|
|
73
|
+
|
|
74
|
+
`sp.checks`, `sp.incidents`, `sp.status_pages`, `sp.maintenance_windows` and `sp.channels`.
|
|
75
|
+
Their methods are `list`, `get`, `create`, `update` and `delete` where the API has them, plus the
|
|
76
|
+
actions of the resource: `sp.checks.run_now(id)`, `sp.incidents.acknowledge(id)`,
|
|
77
|
+
`unacknowledge`, `snooze`, `unsnooze` and `resolve`.
|
|
78
|
+
|
|
79
|
+
Arguments are the API field names, unchanged (`sp.checks.create(name=..., config=...)`), and the
|
|
80
|
+
organization is never an argument. Results are objects with the API field names as attributes
|
|
81
|
+
and a `to_dict()` method. `list` returns an iterator that follows the pagination cursor for you.
|
|
82
|
+
A field the SDK does not know yet is kept (`to_dict()` returns it, and it is readable as an
|
|
83
|
+
attribute), and an unknown enum value, such as a plugin check type, is accepted.
|
|
84
|
+
|
|
85
|
+
## Errors
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import solidping
|
|
89
|
+
from solidping import SolidPing
|
|
90
|
+
|
|
91
|
+
sp = SolidPing(url="https://solidping.acme.com", org="acme", token="...", timeout=10, max_retries=0)
|
|
92
|
+
|
|
93
|
+
try:
|
|
94
|
+
sp.checks.get("missing")
|
|
95
|
+
except solidping.NotFoundError:
|
|
96
|
+
print("no such check")
|
|
97
|
+
except solidping.APIError as e:
|
|
98
|
+
print(e.status, e.code, e.title, e.detail)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Everything the SDK raises is a `SolidPingError`. An `APIError` carries `status`, `code`, `title`,
|
|
102
|
+
`detail` and `fields` (the invalid fields of a validation error). The subclasses are
|
|
103
|
+
`AuthenticationError` (401), `PermissionDeniedError` (403), `NotFoundError` (404),
|
|
104
|
+
`ValidationError` (400, 422), `ConflictError` (409) and `RateLimitError` (429). A status without
|
|
105
|
+
a subclass is a plain `APIError`, whatever its `code`. `APIConnectionError` means the server
|
|
106
|
+
could not be reached, `APITimeoutError` (a subclass of it) that it did not answer in time.
|
|
107
|
+
|
|
108
|
+
## Retries and timeout
|
|
109
|
+
|
|
110
|
+
Connection errors, timeouts, 429 and 5xx are retried twice with exponential backoff and jitter. A
|
|
111
|
+
429 waits for its `Retry-After`. A `POST` is retried only on 429, because the API has no
|
|
112
|
+
idempotency key. `max_retries=0` disables the retries. The timeout is 30 seconds by default.
|
|
113
|
+
|
|
114
|
+
## Endpoints the SDK does not cover
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
regions = sp.request("GET", "/api/v1/orgs/acme/regions")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`request(method, path, body=None, params=None)` uses the same auth, retries and errors, and returns
|
|
121
|
+
the decoded JSON.
|
|
122
|
+
|
|
123
|
+
## Debugging
|
|
124
|
+
|
|
125
|
+
`SOLIDPING_LOG=debug` logs each request and its response status on stderr (through the
|
|
126
|
+
`solidping` logger). The token is never logged.
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
See [AGENTS.md](AGENTS.md).
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT
|