hyperping 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.
Files changed (36) hide show
  1. hyperping-0.1.0/.github/CODEOWNERS +5 -0
  2. hyperping-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +67 -0
  3. hyperping-0.1.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  4. hyperping-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +38 -0
  5. hyperping-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  6. hyperping-0.1.0/.github/workflows/ci.yml +41 -0
  7. hyperping-0.1.0/.github/workflows/publish.yml +48 -0
  8. hyperping-0.1.0/.gitignore +33 -0
  9. hyperping-0.1.0/CHANGELOG.md +19 -0
  10. hyperping-0.1.0/CONTRIBUTING.md +35 -0
  11. hyperping-0.1.0/LICENSE +21 -0
  12. hyperping-0.1.0/PKG-INFO +223 -0
  13. hyperping-0.1.0/README.md +187 -0
  14. hyperping-0.1.0/pyproject.toml +69 -0
  15. hyperping-0.1.0/src/hyperping/__init__.py +151 -0
  16. hyperping-0.1.0/src/hyperping/_incidents_mixin.py +198 -0
  17. hyperping-0.1.0/src/hyperping/_maintenance_mixin.py +195 -0
  18. hyperping-0.1.0/src/hyperping/_monitors_mixin.py +250 -0
  19. hyperping-0.1.0/src/hyperping/_outages_mixin.py +102 -0
  20. hyperping-0.1.0/src/hyperping/_statuspages_mixin.py +226 -0
  21. hyperping-0.1.0/src/hyperping/_version.py +1 -0
  22. hyperping-0.1.0/src/hyperping/client.py +452 -0
  23. hyperping-0.1.0/src/hyperping/endpoints.py +231 -0
  24. hyperping-0.1.0/src/hyperping/exceptions.py +89 -0
  25. hyperping-0.1.0/src/hyperping/models.py +769 -0
  26. hyperping-0.1.0/src/hyperping/py.typed +0 -0
  27. hyperping-0.1.0/tests/__init__.py +0 -0
  28. hyperping-0.1.0/tests/unit/__init__.py +0 -0
  29. hyperping-0.1.0/tests/unit/conftest.py +16 -0
  30. hyperping-0.1.0/tests/unit/test_incidents.py +253 -0
  31. hyperping-0.1.0/tests/unit/test_maintenance.py +285 -0
  32. hyperping-0.1.0/tests/unit/test_monitors.py +483 -0
  33. hyperping-0.1.0/tests/unit/test_outages.py +134 -0
  34. hyperping-0.1.0/tests/unit/test_sdk_surface.py +1110 -0
  35. hyperping-0.1.0/tests/unit/test_statuspages.py +391 -0
  36. hyperping-0.1.0/uv.lock +645 -0
@@ -0,0 +1,5 @@
1
+ # All files — Develeap team is the default reviewer
2
+ * @develeap/maintainers
3
+
4
+ # Workflows require an extra eye
5
+ .github/workflows/ @KhaledSalhab-Develeap
@@ -0,0 +1,67 @@
1
+ name: Bug Report
2
+ description: Something isn't working as expected
3
+ labels: ["bug", "triage"]
4
+ assignees: ["KhaledSalhab-Develeap"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for taking the time to report a bug! Please fill in as much detail as possible.
10
+
11
+ - type: input
12
+ id: version
13
+ attributes:
14
+ label: hyperping version
15
+ description: Output of `pip show hyperping | grep Version`
16
+ placeholder: "0.1.0"
17
+ validations:
18
+ required: true
19
+
20
+ - type: input
21
+ id: python
22
+ attributes:
23
+ label: Python version
24
+ description: Output of `python --version`
25
+ placeholder: "3.12.0"
26
+ validations:
27
+ required: true
28
+
29
+ - type: textarea
30
+ id: description
31
+ attributes:
32
+ label: What happened?
33
+ description: A clear description of the bug.
34
+ validations:
35
+ required: true
36
+
37
+ - type: textarea
38
+ id: expected
39
+ attributes:
40
+ label: What did you expect?
41
+ validations:
42
+ required: true
43
+
44
+ - type: textarea
45
+ id: reproduce
46
+ attributes:
47
+ label: Steps to reproduce
48
+ description: Minimal code snippet or steps that reproduce the issue.
49
+ render: python
50
+ validations:
51
+ required: true
52
+
53
+ - type: textarea
54
+ id: traceback
55
+ attributes:
56
+ label: Full traceback (if any)
57
+ render: text
58
+
59
+ - type: checkboxes
60
+ id: checklist
61
+ attributes:
62
+ label: Checklist
63
+ options:
64
+ - label: I have searched existing issues and this is not a duplicate.
65
+ required: true
66
+ - label: I am using the latest version of `hyperping`.
67
+ required: false
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Hyperping API Docs
4
+ url: https://hyperping.io/docs
5
+ about: Official Hyperping API documentation
6
+ - name: Develeap
7
+ url: https://develeap.com
8
+ about: The team behind this SDK
@@ -0,0 +1,38 @@
1
+ name: Feature Request
2
+ description: Suggest an improvement or new capability
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Have an idea? We'd love to hear it. Please describe it clearly below.
9
+
10
+ - type: textarea
11
+ id: problem
12
+ attributes:
13
+ label: What problem does this solve?
14
+ description: Describe the use case or limitation you are running into.
15
+ validations:
16
+ required: true
17
+
18
+ - type: textarea
19
+ id: solution
20
+ attributes:
21
+ label: Proposed solution
22
+ description: What would you like to see? Code examples welcome.
23
+ validations:
24
+ required: true
25
+
26
+ - type: textarea
27
+ id: alternatives
28
+ attributes:
29
+ label: Alternatives you have considered
30
+ description: Any workarounds you currently use?
31
+
32
+ - type: checkboxes
33
+ id: checklist
34
+ attributes:
35
+ label: Checklist
36
+ options:
37
+ - label: I have searched existing issues and this is not a duplicate.
38
+ required: true
@@ -0,0 +1,22 @@
1
+ ## What does this PR do?
2
+
3
+ <!-- One or two sentences. Link to the issue it closes if applicable. -->
4
+
5
+ Closes #
6
+
7
+ ## Type of change
8
+
9
+ - [ ] Bug fix
10
+ - [ ] New feature
11
+ - [ ] Refactor / clean-up
12
+ - [ ] Documentation
13
+ - [ ] CI / tooling
14
+
15
+ ## Checklist
16
+
17
+ - [ ] Tests added or updated
18
+ - [ ] `uv run pytest` passes locally
19
+ - [ ] `uv run mypy src` passes with no errors
20
+ - [ ] `uv run ruff check src tests` passes
21
+ - [ ] `CHANGELOG.md` updated (for user-visible changes)
22
+ - [ ] No hardcoded secrets, credentials, or internal paths
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: ["3.11", "3.12", "3.13"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - uses: astral-sh/setup-uv@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: uv sync --all-extras
26
+
27
+ - name: Lint
28
+ run: uv run ruff check src tests
29
+
30
+ - name: Type check
31
+ run: uv run mypy src
32
+
33
+ - name: Test
34
+ run: uv run pytest --cov=hyperping --cov-report=xml
35
+
36
+ - name: Upload coverage to Codecov
37
+ if: matrix.python-version == '3.12'
38
+ uses: codecov/codecov-action@v4
39
+ with:
40
+ files: coverage.xml
41
+ fail_ci_if_error: false
@@ -0,0 +1,48 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: astral-sh/setup-uv@v5
13
+ with: { python-version: "3.12" }
14
+ - run: uv sync --all-extras
15
+ - run: uv run pytest # gate — no publish on red tests
16
+ - run: uv build
17
+ - uses: actions/upload-artifact@v4
18
+ with: { name: dist, path: dist/ }
19
+
20
+ publish-testpypi:
21
+ needs: [build]
22
+ if: "github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && contains(github.ref_name, '-')"
23
+ runs-on: ubuntu-latest
24
+ environment:
25
+ name: testpypi
26
+ url: https://test.pypi.org/p/hyperping
27
+ permissions:
28
+ id-token: write
29
+ steps:
30
+ - uses: actions/download-artifact@v4
31
+ with: { name: dist, path: dist/ }
32
+ - uses: pypa/gh-action-pypi-publish@release/v1
33
+ with:
34
+ repository-url: https://test.pypi.org/legacy/
35
+
36
+ publish-pypi:
37
+ needs: [build]
38
+ if: "github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && !contains(github.ref_name, '-')"
39
+ runs-on: ubuntu-latest
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/p/hyperping
43
+ permissions:
44
+ id-token: write
45
+ steps:
46
+ - uses: actions/download-artifact@v4
47
+ with: { name: dist, path: dist/ }
48
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,33 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ *.so
7
+ *.egg
8
+ *.egg-info/
9
+ dist/
10
+ build/
11
+ .eggs/
12
+ .venv/
13
+ venv/
14
+
15
+ # Test & coverage
16
+ .coverage
17
+ coverage.xml
18
+ .pytest_cache/
19
+ htmlcov/
20
+
21
+ # Type checking
22
+ .mypy_cache/
23
+
24
+ # IDEs
25
+ .vscode/
26
+ .idea/
27
+
28
+ # OS
29
+ .DS_Store
30
+
31
+ # Local dev tooling
32
+ .claude/
33
+ dist/
@@ -0,0 +1,19 @@
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
+ ## [0.1.0] — 2026-03-31
9
+
10
+ ### Added
11
+
12
+ - Initial release of the `hyperping` Python SDK.
13
+ - `HyperpingClient` with full support for Monitors, Incidents, Maintenance Windows, Outages, and Status Pages.
14
+ - Automatic retry with exponential backoff and jitter on transient errors (5xx, 429).
15
+ - Circuit breaker pattern to prevent cascading failures.
16
+ - Typed Pydantic v2 models for all API resources.
17
+ - `py.typed` marker for PEP 561 compliance.
18
+ - CI matrix across Python 3.11, 3.12, 3.13.
19
+ - OIDC trusted publisher workflow for PyPI releases (no stored secrets).
@@ -0,0 +1,35 @@
1
+ # Contributing
2
+
3
+ Thank you for your interest in contributing to `hyperping`!
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ git clone https://github.com/develeap/hyperping-python.git
9
+ cd hyperping-python
10
+ uv sync --all-extras
11
+ ```
12
+
13
+ ## Running tests
14
+
15
+ ```bash
16
+ uv run pytest -v
17
+ ```
18
+
19
+ ## Linting and type checking
20
+
21
+ ```bash
22
+ uv run ruff check src tests
23
+ uv run mypy src
24
+ ```
25
+
26
+ ## Pull requests
27
+
28
+ 1. Fork the repo and create a branch from `main`.
29
+ 2. Write tests for any new behaviour.
30
+ 3. Ensure all checks pass locally.
31
+ 4. Open a PR — a maintainer will review it.
32
+
33
+ ## Reporting issues
34
+
35
+ Open an issue at https://github.com/develeap/hyperping-python/issues.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Develeap
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,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyperping
3
+ Version: 0.1.0
4
+ Summary: Python SDK for the Hyperping uptime monitoring and incident management API
5
+ Project-URL: Homepage, https://github.com/develeap/hyperping-python
6
+ Project-URL: Documentation, https://github.com/develeap/hyperping-python#readme
7
+ Project-URL: Repository, https://github.com/develeap/hyperping-python
8
+ Project-URL: Changelog, https://github.com/develeap/hyperping-python/blob/main/CHANGELOG.md
9
+ Project-URL: Issues, https://github.com/develeap/hyperping-python/issues
10
+ Author-email: Develeap <dev@develeap.com>
11
+ License: MIT
12
+ License-File: LICENSE
13
+ Keywords: api-client,hyperping,incident,monitoring,status-page,uptime
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Internet :: WWW/HTTP
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: httpx>=0.26
27
+ Requires-Dist: pydantic>=2.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: mypy>=1.10; extra == 'dev'
30
+ Requires-Dist: pydantic; extra == 'dev'
31
+ Requires-Dist: pytest-cov; extra == 'dev'
32
+ Requires-Dist: pytest>=8.0; extra == 'dev'
33
+ Requires-Dist: respx>=0.21; extra == 'dev'
34
+ Requires-Dist: ruff>=0.4; extra == 'dev'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # hyperping
38
+
39
+ [![PyPI version](https://img.shields.io/pypi/v/hyperping.svg)](https://pypi.org/project/hyperping/)
40
+ [![Python versions](https://img.shields.io/pypi/pyversions/hyperping.svg)](https://pypi.org/project/hyperping/)
41
+ [![CI](https://github.com/develeap/hyperping-python/actions/workflows/ci.yml/badge.svg)](https://github.com/develeap/hyperping-python/actions/workflows/ci.yml)
42
+ [![Coverage](https://codecov.io/gh/develeap/hyperping-python/branch/main/graph/badge.svg)](https://codecov.io/gh/develeap/hyperping-python)
43
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
44
+ [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
45
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
46
+
47
+ Python SDK for the [Hyperping](https://hyperping.io) uptime monitoring and incident management API.
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ pip install hyperping
53
+ # or
54
+ uv add hyperping
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ ```python
60
+ from hyperping import HyperpingClient, IncidentCreate, LocalizedText
61
+
62
+ with HyperpingClient(api_key="sk_...") as client:
63
+ # List all monitors
64
+ monitors = client.list_monitors()
65
+ for m in monitors:
66
+ print(f"{m.name}: {'down' if m.down else 'up'}")
67
+
68
+ # Open an incident
69
+ incident = client.create_incident(
70
+ IncidentCreate(
71
+ title=LocalizedText(en="Service degradation"),
72
+ text=LocalizedText(en="Investigating elevated error rates"),
73
+ statuspages=["sp_your_uuid"],
74
+ )
75
+ )
76
+
77
+ # Resolve it
78
+ client.resolve_incident(incident.uuid, "All systems operational")
79
+ ```
80
+
81
+ ## Authentication
82
+
83
+ Pass your API key directly or via environment variable:
84
+
85
+ ```python
86
+ import os
87
+ from hyperping import HyperpingClient
88
+
89
+ # Constructor param
90
+ client = HyperpingClient(api_key="sk_...")
91
+
92
+ # From environment
93
+ client = HyperpingClient(api_key=os.environ["HYPERPING_API_KEY"])
94
+ ```
95
+
96
+ ## Resources
97
+
98
+ ### Monitors
99
+
100
+ ```python
101
+ monitors = client.list_monitors()
102
+ monitor = client.get_monitor("mon_uuid")
103
+ created = client.create_monitor(MonitorCreate(name="API", url="https://api.example.com"))
104
+ client.pause_monitor("mon_uuid")
105
+ client.resume_monitor("mon_uuid")
106
+ client.delete_monitor("mon_uuid")
107
+
108
+ # Reports
109
+ reports = client.get_all_reports(period="30d")
110
+ report = client.get_monitor_report("mon_uuid", period="7d")
111
+ ```
112
+
113
+ ### Incidents
114
+
115
+ ```python
116
+ incidents = client.list_incidents()
117
+ incident = client.get_incident("inci_uuid")
118
+ created = client.create_incident(IncidentCreate(...))
119
+ client.add_incident_update("inci_uuid", AddIncidentUpdateRequest(...))
120
+ client.resolve_incident("inci_uuid", "Fixed")
121
+ client.delete_incident("inci_uuid")
122
+ ```
123
+
124
+ ### Maintenance Windows
125
+
126
+ ```python
127
+ windows = client.list_maintenance()
128
+ window = client.get_maintenance("mw_uuid")
129
+ created = client.create_maintenance(MaintenanceCreate(...))
130
+ client.update_maintenance("mw_uuid", MaintenanceUpdate(name="New name"))
131
+ client.delete_maintenance("mw_uuid")
132
+
133
+ # Helpers
134
+ active = client.get_active_maintenance()
135
+ in_maint = client.is_monitor_in_maintenance("mon_uuid")
136
+ ```
137
+
138
+ ### Outages
139
+
140
+ ```python
141
+ outages = client.list_outages()
142
+ client.acknowledge_outage("out_uuid", message="On it")
143
+ client.resolve_outage("out_uuid", message="Fixed")
144
+ client.escalate_outage("out_uuid")
145
+ ```
146
+
147
+ ### Status Pages
148
+
149
+ ```python
150
+ pages = client.list_status_pages(search="prod")
151
+ page = client.get_status_page("sp_uuid")
152
+ created = client.create_status_page(StatusPageCreate(name="Prod", subdomain="prod-status"))
153
+ client.update_status_page("sp_uuid", StatusPageUpdate(name="Production Status"))
154
+ client.delete_status_page("sp_uuid")
155
+
156
+ # Subscribers
157
+ subs = client.list_subscribers("sp_uuid")
158
+ sub = client.add_subscriber("sp_uuid", "user@example.com")
159
+ client.remove_subscriber("sp_uuid", sub.id)
160
+ ```
161
+
162
+ ## Error Handling
163
+
164
+ ```python
165
+ from hyperping import (
166
+ HyperpingAPIError,
167
+ HyperpingAuthError,
168
+ HyperpingNotFoundError,
169
+ HyperpingRateLimitError,
170
+ HyperpingValidationError,
171
+ )
172
+
173
+ try:
174
+ monitor = client.get_monitor("mon_uuid")
175
+ except HyperpingNotFoundError:
176
+ print("Monitor not found")
177
+ except HyperpingRateLimitError as e:
178
+ print(f"Rate limited. Retry after {e.retry_after}s")
179
+ except HyperpingAuthError:
180
+ print("Invalid API key")
181
+ except HyperpingAPIError as e:
182
+ print(f"API error [{e.status_code}]: {e.message}")
183
+ print(f"Request ID: {e.request_id}")
184
+ ```
185
+
186
+ ## Retries and Circuit Breaker
187
+
188
+ The SDK retries automatically on transient errors (5xx, 429) with exponential backoff and jitter. A circuit breaker prevents cascading failures.
189
+
190
+ ```python
191
+ from hyperping import HyperpingClient
192
+ from hyperping.client import RetryConfig, CircuitBreakerConfig
193
+
194
+ client = HyperpingClient(
195
+ api_key="sk_...",
196
+ retry_config=RetryConfig(
197
+ max_retries=3,
198
+ initial_delay=1.0,
199
+ max_delay=30.0,
200
+ backoff_factor=2.0,
201
+ ),
202
+ circuit_breaker_config=CircuitBreakerConfig(
203
+ failure_threshold=5,
204
+ recovery_timeout=60.0,
205
+ ),
206
+ )
207
+ ```
208
+
209
+ ## Type Safety
210
+
211
+ This package ships a `py.typed` marker (PEP 561) and is fully typed. Works out of the box with mypy and pyright.
212
+
213
+ ## Contributing
214
+
215
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
216
+
217
+ ## License
218
+
219
+ MIT — see [LICENSE](LICENSE).
220
+
221
+ ## Maintained by
222
+
223
+ [Develeap](https://develeap.com)