Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
pull_request:

jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies
run: pip install -e ".[dev]"

- name: Lint (ruff)
run: ruff check src tests

- name: Type-check (mypy)
run: mypy src

- name: Test (pytest)
run: pytest
39 changes: 39 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Integration tests

on:
push:
branches:
- main
workflow_dispatch:

jobs:
integration:
name: Real API integration tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install dependencies
run: pip install -e ".[dev]"

- name: Verify SYVEL_API_KEY is configured
run: |
if [ -z "$SYVEL_API_KEY" ]; then
echo "::error::SYVEL_API_KEY secret is not configured in this repository."
echo "Add it under Settings β†’ Secrets and variables β†’ Actions."
exit 1
fi
env:
SYVEL_API_KEY: ${{ secrets.SYVEL_API_KEY }}

- name: Run integration tests
run: pytest tests/test_integration.py -v
env:
SYVEL_API_KEY: ${{ secrets.SYVEL_API_KEY }}
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish to PyPI

on:
push:
tags:
- "v*"

jobs:
publish:
name: Build and publish
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # Required for PyPI Trusted Publishing (OIDC)

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install build dependencies
run: pip install build

- name: Build package
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# IDE
.idea/
.vscode/

# Python
__pycache__/
*.py[cod]
*.egg-info/
*.egg

# Build
dist/
build/
.eggs/

# Virtual environments
.venv/
venv/
env/

# Testing
.pytest_cache/
.coverage
.coverage.*
htmlcov/

# Type checking
.mypy_cache/

# Linting
.ruff_cache/

# Environment
.env
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] β€” 2026-04-03

### Added

- `Syvel` synchronous client with `check()` and `check_email()` methods.
- `AsyncSyvel` asynchronous client with an identical API (`async`/`await`).
- P1 endpoints on both clients: `usage()`, `logs()`, `stats()`, `list_keys()`,
`create_key()`, `revoke_key()`.
- Full typed exception hierarchy:
- `SyvelError` β€” base class with `status_code` and `code` attributes.
- `SyvelAuthError` β€” HTTP 401, invalid or missing API key.
- `SyvelForbiddenError` β€” HTTP 403, origin not authorised.
- `SyvelValidationError` β€” HTTP 422, invalid email or domain format.
- `SyvelRateLimitError` β€” HTTP 429, quota exceeded. Exposes `reset_at: datetime | None`.
- `SyvelTimeoutError` β€” request exceeded the configured timeout.
- Silent mode (`silent=True`) for automatic fail-open behaviour.
- Context manager support for both sync (`with`) and async (`async with`) clients.
- Response models as frozen dataclasses: `CheckResult`, `UsageResult`, `LogEntry`,
`LogsPage`, `StatsPoint`, `ApiKey`.
- `py.typed` marker β€” PEP 561 compliant for full type-checker support.
- Integration examples for Django, FastAPI, and Flask.
- GitHub Actions CI matrix across Python 3.10–3.13.
- PyPI Trusted Publishing (OIDC) workflow β€” no stored tokens.

[Unreleased]: https://github.com/syvel-io/syvel-python/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/syvel-io/syvel-python/releases/tag/v0.1.0
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Syvel.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading