Skip to content

Commit 65e84f0

Browse files
committed
Initial release of Checkend Python SDK
0 parents  commit 65e84f0

40 files changed

+4631
-0
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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:
16+
- '3.9'
17+
- '3.10'
18+
- '3.11'
19+
- '3.12'
20+
- '3.13'
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -e ".[dev]"
34+
35+
- name: Run tests
36+
run: pytest -v --cov=checkend --cov-report=term-missing
37+
38+
lint:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Set up Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.12'
47+
48+
- name: Install dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install -e ".[dev]"
52+
53+
- name: Run Ruff linter
54+
run: ruff check .
55+
56+
- name: Run Ruff formatter check
57+
run: ruff format --check .

.github/workflows/publish.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to publish (e.g., 0.2.0)'
10+
required: true
11+
type: string
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
fetch-depth: 0
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.12'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -e ".[dev]"
32+
pip install build twine
33+
34+
- name: Update version
35+
if: github.event_name == 'workflow_dispatch'
36+
run: |
37+
sed -i "s/VERSION = '.*'/VERSION = '${{ inputs.version }}'/" checkend/version.py
38+
sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" pyproject.toml
39+
40+
- name: Run tests
41+
run: pytest -v
42+
43+
- name: Run linter
44+
run: ruff check .
45+
46+
- name: Build package
47+
run: python -m build
48+
49+
- name: Configure git
50+
if: github.event_name == 'workflow_dispatch'
51+
run: |
52+
git config user.name "github-actions[bot]"
53+
git config user.email "github-actions[bot]@users.noreply.github.com"
54+
55+
- name: Install git-cliff
56+
if: github.event_name == 'workflow_dispatch'
57+
uses: kenji-miyake/setup-git-cliff@v2
58+
59+
- name: Generate changelog
60+
if: github.event_name == 'workflow_dispatch'
61+
run: |
62+
git-cliff --tag "v${{ inputs.version }}" -o CHANGELOG.md
63+
64+
- name: Commit version and changelog
65+
if: github.event_name == 'workflow_dispatch'
66+
run: |
67+
git pull --rebase origin main
68+
git add checkend/version.py pyproject.toml CHANGELOG.md
69+
if git diff --staged --quiet; then
70+
echo "No changes to commit"
71+
else
72+
git commit -m "Release v${{ inputs.version }}"
73+
git push
74+
fi
75+
76+
- name: Create tag and release
77+
if: github.event_name == 'workflow_dispatch'
78+
env:
79+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
run: |
81+
if git rev-parse "v${{ inputs.version }}" >/dev/null 2>&1; then
82+
echo "Tag v${{ inputs.version }} already exists"
83+
else
84+
git tag "v${{ inputs.version }}"
85+
git push origin "v${{ inputs.version }}"
86+
fi
87+
if gh release view "v${{ inputs.version }}" >/dev/null 2>&1; then
88+
echo "Release v${{ inputs.version }} already exists"
89+
else
90+
gh release create "v${{ inputs.version }}" \
91+
--title "v${{ inputs.version }}" \
92+
--generate-notes
93+
fi
94+
95+
- name: Publish to PyPI
96+
env:
97+
TWINE_USERNAME: __token__
98+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
99+
run: twine upload dist/*

.gitignore

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
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+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
*.manifest
29+
*.spec
30+
31+
# Installer logs
32+
pip-log.txt
33+
pip-delete-this-directory.txt
34+
35+
# Unit test / coverage reports
36+
htmlcov/
37+
.tox/
38+
.nox/
39+
.coverage
40+
.coverage.*
41+
.cache
42+
nosetests.xml
43+
coverage.xml
44+
*.cover
45+
*.py,cover
46+
.hypothesis/
47+
.pytest_cache/
48+
49+
# Translations
50+
*.mo
51+
*.pot
52+
53+
# Environments
54+
.env
55+
.venv
56+
env/
57+
venv/
58+
ENV/
59+
env.bak/
60+
venv.bak/
61+
62+
# IDE
63+
.idea/
64+
.vscode/
65+
*.swp
66+
*.swo
67+
*~
68+
69+
# mypy
70+
.mypy_cache/
71+
.dmypy.json
72+
dmypy.json
73+
74+
# ruff
75+
.ruff_cache/
76+
77+
# Claude Code
78+
.claude/

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2024-12-28
9+
10+
### Added
11+
- Initial release of Checkend Python SDK
12+
- Core error monitoring functionality
13+
- Django integration with middleware
14+
- Flask integration with hooks
15+
- FastAPI/Starlette integration with ASGI middleware
16+
- Automatic sensitive data filtering
17+
- Async error sending with background worker
18+
- Testing utilities for unit tests
19+
- Configurable exception ignoring
20+
- before_notify callbacks

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) 2024 Furvur
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.

Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.PHONY: test lint install-hooks build clean help
2+
3+
# Default target
4+
.DEFAULT_GOAL := help
5+
6+
help: ## Show this help message
7+
@echo "Usage: make [target]"
8+
@echo ""
9+
@echo "Targets:"
10+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'
11+
12+
test: ## Run tests with coverage
13+
pytest -v --cov=checkend --cov-report=term-missing
14+
15+
lint: ## Run linter (ruff)
16+
ruff check .
17+
ruff format --check .
18+
19+
format: ## Format code with ruff
20+
ruff check --fix .
21+
ruff format .
22+
23+
install-hooks: ## Install git hooks
24+
./scripts/install-hooks.sh
25+
26+
install: ## Install package in development mode
27+
pip install -e ".[dev]"
28+
29+
build: ## Build package
30+
python -m build
31+
32+
clean: ## Clean build artifacts
33+
rm -rf build/
34+
rm -rf dist/
35+
rm -rf *.egg-info/
36+
rm -rf .pytest_cache/
37+
rm -rf .coverage
38+
rm -rf htmlcov/
39+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
40+
find . -type f -name "*.pyc" -delete
41+
42+
all: lint test ## Run lint and tests

0 commit comments

Comments
 (0)