Install & Compatibility
Where this runs
tested against v6.14.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.626s · 26.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.9s · import 0.524s · 28MB
25MB installed
● package 25MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Flex
✓ from flex import Flex
✗ import flex
load
✓ from flex import load
✗ import flex
validate
✓ from flex import validate
✗ import flex
Validate an API response against a Swagger specification.
import flex
from flex.validation import validate_api
# Load a Swagger spec from a file
with open('swagger.yaml', 'r') as f:
schema = flex.load(f)
# Example API response (dict)
response = {
'status_code': 200,
'headers': {'content-type': 'application/json'},
'body': '{"id": 1, "name": "test"}'
}
# Validate response against a specific path and method
try:
validate_api(schema, path='/users/{id}', method='get', response=response)
print('Validation passed')
except flex.exceptions.Error as e:
print(f'Validation failed: {e}')
Upgrade
Version history
6.14.1latest on PyPI · released Sep 14, 2019
Audit
Dependencies
PyYAMLrequiredUsed for parsing YAML specifications. No maximum version constraint since 6.14.0.
jsonschemarequiredDependency for JSON Schema validation, which flex uses internally.
requestsrequiredUsed for loading remote Swagger specifications.