PySafeguard 8.0 — Complete Pythonic redesign of the SDK#24
Merged
Conversation
Azure Pipelines macro-expands variables as plain strings, so passing $(isPrerelease) with $$ escaping to produce a PowerShell $True literal doesn't work reliably (330771$(isPrerelease) becomes $$True). Fix by: - Passing variables as-is (no $$ escaping) in build-steps.yml - Changing versionnumber.ps1 parameters from [bool]/implicit to [string] - Converting to booleans inside the script with string comparison Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PySafeguard 8.0 — Complete Pythonic redesign of the SDK
Summary
This is a complete refactor of PySafeguard with a modern, Pythonic API. The version has been bumped to 8.0.0 to reflect the breaking changes. The README has been updated with a guide to upgrade existing code.
What changed
New SDK API
SafeguardClient/AsyncSafeguardClientreplacePySafeguardConnection/Connection/AsyncConnectionPasswordAuth,CertificateAuth,PkceAuth,TokenAuth) replace factory functions (connect_password,connect_certificate, etc.)get,post,put,delete) replace the genericinvoke()methodA2AContext/AsyncA2AContextreplace thea2a_get_credential()class methodSafeguardEventListener/PersistentSafeguardEventListenerreplaceregister_signalr_*()with a fluent.on()API and context manager supportSafeguardError→ApiError→AuthenticationError/AuthorizationError/NotFoundError) replaces flat exceptionsHiddenStringfor credential protection throughoutstream(),download(),upload()mypy --strictPKCE as recommended auth
PkceAuthis now the recommended authentication method — Resource Owner Grant (ROG) is disabled by default on recent Safeguard appliancesUpdated samples
PkceExample.pyModernized CI/CD pipeline
azure-pipelines.ymlto match SafeguardDotNet patterns: template-based with separate PR validation and build/publish jobspipeline-templates/with shared build steps (install, version, lint, type check, test, build)versionnumber.ps1that reads version frompyproject.toml(single source of truth) and applies.devNsuffix for prerelease buildsruff check,ruff format --check,mypy, andpyteston every PR and mergeTests
Migration
A full migration guide from 7.x to 8.0 is included at the bottom of
README.md.