Python SDK for the One Identity Safeguard Web API. Published on PyPI. Requires Python >= 3.10.
Core deps: requests, truststore, and typing_extensions on Python < 3.11.
Optional extras: async (aiohttp) and signalr (signalrcore).
PySafeguard/
|-- src/pysafeguard/ # SDK package: clients, auth, errors, A2A, events, HiddenString
|-- tests/ # Unit tests
| `-- integration/ # Live-appliance integration tests
|-- samples/ # Auth, A2A, and SignalR examples
|-- pipeline-templates/ # Shared Azure Pipelines templates
|-- pyproject.toml # Poetry metadata and pytest config
|-- ruff.toml # Ruff config
|-- mypy.ini # Mypy config
`-- azure-pipelines.yml # CI/CD entrypoint
pip install poetry
poetry install --all-extras
poetry buildpoetry run ruff check src/
poetry run ruff format --check src/
poetry run mypy src/All code must pass mypy --strict. Ruff enforces 160-character lines.
poetry run python -m pytest tests/ -m "not integration"
poetry run python -m pytest tests/ -m integrationpytest-asyncio uses asyncio_mode = "auto". Integration tests auto-skip when
SPP_HOST is unset. For non-trivial auth, API, A2A, or event changes, ask for
appliance access. See the testing-guide skill for fixtures and env vars.
- Keep type annotations complete and
mypy --strictclean. - Use PascalCase for classes and snake_case for methods and attributes.
- Use reStructuredText docstrings.
- Keep constructors side-effect free.
- Use auth strategy objects, keyword-only args after the first positional
parameters, no mutable defaults, explicit
json/data, intentional__all__, andHiddenStringfor secrets.
See the build-and-release skill for pipeline details, version derivation,
and publishing workflow.
- Never commit passwords, tokens, A2A API keys, private keys, generated test
certs,
.pypirc, or service-connection output. - Wrap new secret-bearing fields in
HiddenStringimmediately sorepr()andstr()stay redacted. - Use
HiddenString.valueonly where plaintext is required; avoid logging it and treatget_value()as deprecated compatibility. - Prefer CA bundle verification over
verify=False; useREQUESTS_CA_BUNDLE/WEBSOCKET_CLIENT_CA_BUNDLEwhen needed.
pyproject.toml holds the base semantic version. CI stamps tagged releases and
.devN prereleases via versionnumber.ps1; details live in the
build-and-release skill.
| Skill | When to read | File |
|---|---|---|
| Testing Guide | Tests, fixtures, live appliance setup | .agents/skills/testing-guide/SKILL.md |
| API Patterns | HTTP methods, streaming, errors, token lifecycle | .agents/skills/api-patterns/SKILL.md |
| Architecture | Module internals, PKCE, HiddenString, SignalR internals | .agents/skills/architecture/SKILL.md |
| Build and Release | Azure Pipelines, tags, releases, PyPI publish | .agents/skills/build-and-release/SKILL.md |
| A2A Workflow | Certificate registration, API keys, A2A retrieval, brokering, listeners | .agents/skills/a2a-workflow/SKILL.md |
Services->Service,HttpMethods->HttpMethod,A2ATypes->A2AType,SshKeyFormats->SshKeyFormatHiddenString.get_value()-> use.value
When a change affects setup, linting, testing, security, versioning, pipeline
behavior, or skill routing, update this file and the relevant
.agents/skills/*/SKILL.md in the same change.