Registry / type-stubs / types-pysaml2

types-pysaml2

JSON →
library1.0.1pypypi✓ verified 23d ago

types-pysaml2 provides PEP 561 compliant type stubs for the pysaml2 library, enabling static type checking tools like MyPy to validate code that uses pysaml2. It aims to provide accurate type annotations for the current state of pysaml2. Releases are generally infrequent, driven by bug fixes or significant changes in the underlying pysaml2 library.

pip install types-pysaml2
INSTALL
IMPORT
SIG · TYPES-PYSAML2
T
types-pysaml2
type-stubspythonv1.0.1
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Config
from saml2-stubs.config import Config
from saml2.config import Config

This quickstart demonstrates how to use `pysaml2` with the benefits of type checking provided by `types-pysaml2`. Note that `types-pysaml2` itself does not contain runtime code; it merely provides type annotations. To utilize the stubs, you write `pysaml2` code as usual, and `mypy` (or another static type checker) will automatically pick up the annotations provided by `types-pysaml2`.

import os from saml2.config import Config from saml2.client import Saml2Client def setup_saml_client(config_file_path: str) -> Saml2Client: config = Config() config.load_file(config_file_path) client = Saml2Client(config) return client # Example usage (requires an actual saml2 config file) # config_path = os.environ.get('SAML2_CONFIG_PATH', 'path/to/saml2/config.xml') # if os.path.exists(config_path): # saml_client = setup_saml_client(config_path) # print(f"SAML2 client created with entity ID: {saml_client.config.entityid}") # else: # print(f"Warning: SAML2 config file not found at {config_path}. Quickstart not fully runnable without it.") # To verify type checking, run mypy on this file after installing types-pysaml2 and pysaml2: # pip install mypy pysaml2 types-pysaml2 # mypy your_script_name.py
Debug
Known issues
gotchatypes-pysaml2 does not contain any runtime code; it only provides type annotations. Ensure you have `pysaml2` installed as the actual runtime library. Without `pysaml2`, `types-pysaml2` serves no functional purpose beyond providing stubs for a non-existent package.
fix
Install the core library: `pip install pysaml2`.
affects: all
gotchaType hints might be incorrect or incomplete if the version of `types-pysaml2` does not sufficiently match the installed version of `pysaml2`. While `types-pysaml2` tries to stay current, significant API changes in `pysaml2` might not be immediately reflected.
fix
Upgrade both `pysaml2` and `types-pysaml2` to their latest compatible versions to ensure the most accurate type hints. Check the `types-pysaml2` changelog for specific compatibility notes.
affects: all
breakingThe type hint for the `LogoutResult` tuple was corrected from 3 to 4 elements in v1.0.2 to accurately reflect `pysaml2`'s actual return signature. Code relying on the `LogoutResult` tuple's length for unpacking might be affected at type-checking time if it expects 3 elements.
fix
Adjust type annotations and unpacking logic for `LogoutResult` to expect 4 elements (`status`, `reason`, `binding`, `relay_state`). For example, change `status, reason, binding = logout_result` to `status, reason, binding, relay_state = logout_result` in your type hints and code.
affects: >=1.0.2
gotchaIn versions prior to v1.0.1, the type hint for `Config.context` was incorrect. It was fixed in v1.0.1 to correctly indicate a string type, aligning with `pysaml2`'s implementation.
fix
Update to `types-pysaml2` v1.0.1 or newer to ensure the correct type hint for `Config.context` is applied during static analysis.
affects: <1.0.1
Upgrade
Version history
1.0.1latest on PyPI · released Jan 16, 2023
Audit
Dependencies
pysaml2requiredThis package provides type stubs for pysaml2; pysaml2 is required for runtime functionality.
Agent activity
43 hits · last 30 days
node
38
OpenAI (training)
1
Resources
types-pysaml2 — pip install types-pysaml2 · libregistry