Registry / http-networking / flex
library6.14.1pypypiunverified

Flex is a Swagger/OpenAPI schema validation library for Python. It validates API responses against a Swagger specification. Current version is 6.14.1. Release cadence is irregular, with recent releases focusing on maintenance and compatibility updates.

pip install flex
INSTALL
IMPORT
SIG · FLEX
F
flex
http-networkingpythonv6.14.1
Install
4.9s avg
Import
958ms
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.626s · 26.9MB
glibc
py 3.103.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}')
Debug
Known issues
deprecatedFlex uses collections.abc which may cause DeprecationWarning in Python 3.8+. Fixed in v6.14.1.
fix
Upgrade to flex >=6.14.1
affects: <6.14.1
breakingVersion 6.14.0 removed maximum version constraints on dependencies (e.g., PyYAML). This may introduce incompatibilities if you rely on older versions.
fix
Pin PyYAML version if needed: pip install 'PyYAML<5.1'
affects: >=6.14.0
gotchaflex.load() expects a file-like object or a string, not a raw dictionary.
fix
Use flex.loads() for a string, or flex.load() for an open file object.
affects: all
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.
Agent activity
23 hits · last 30 days
node
20
Resources
flex — pip install flex · libregistry