{"id":7547,"library":"pyats-utils","title":"pyATS Utilities Module","description":"pyATS Utils is a core component of Cisco's pyATS framework, providing a collection of reusable utility functions for test automation, data manipulation, schema validation, and file operations. It's designed to support and extend the capabilities of pyATS and Genie, streamlining common tasks in network automation and testing. The current version is 26.3, and it follows a rapid release cadence, typically aligning with the broader pyATS ecosystem.","status":"active","version":"26.3","language":"python","source_language":"en","source_url":"https://github.com/CiscoTestAutomation/pyats-utils","tags":["pyats","cisco","network-automation","testing","utilities","schema-validation","file-utils"],"install":[{"cmd":"pip install pyats-utils","lang":"bash","label":"Install stable version"},{"cmd":"pip install pyats","lang":"bash","label":"Recommended: Install full pyATS framework (includes pyats-utils)"}],"dependencies":[{"reason":"Most functionalities are designed to integrate with or enhance the pyATS framework. While some utilities can be used standalone, full functionality often requires pyATS.","package":"pyats","optional":false},{"reason":"Many parsing and device interaction utilities in pyATS/pyats-utils leverage Genie for platform abstraction.","package":"genie","optional":true}],"imports":[{"wrong":"from pyats.utils.schema.base import Schema","symbol":"Schema","correct":"from pyats.utils.schema import Schema"}],"quickstart":{"code":"from pyats_utils.schema.api import validate\nfrom pyats_utils.schema.base import Schema, Any, Optional\n\n# Define a simple schema\nmy_schema = Schema({\n    'name': str,\n    'age': int,\n    Optional('city'): str,\n    'active': bool\n})\n\n# Data to validate\nvalid_data = {\n    'name': 'Alice',\n    'age': 30,\n    'active': True\n}\n\ninvalid_data = {\n    'name': 'Bob',\n    'age': 'twenty five', # Incorrect type\n    'active': False\n}\n\n# Validate data\nprint(\"Validating valid_data...\")\ntry:\n    validated = validate(data=valid_data, schema=my_schema)\n    print(f\"Validation successful: {validated}\")\nexcept Exception as e:\n    print(f\"Validation failed: {e}\")\n\nprint(\"\\nValidating invalid_data...\")\ntry:\n    validated = validate(data=invalid_data, schema=my_schema)\n    print(f\"Validation successful: {validated}\")\nexcept Exception as e:\n    print(f\"Validation failed: {e}\")","lang":"python","description":"This quickstart demonstrates how to define and use a simple schema for data validation using `pyats_utils.schema`. It shows how to import `Schema` and `validate`, define data structures with types and optional fields, and then validate sample data against the defined schema."},"warnings":[{"fix":"Always install/upgrade all pyATS components together, ideally using `pip install --upgrade pyats` which often pulls in compatible versions of dependencies. Verify versions with `pyats version`.","message":"pyATS Utils is part of a larger ecosystem. Mismatched versions between `pyats-utils`, `pyats`, and `genie` packages can lead to unexpected errors or runtime issues. It's best practice to keep all pyATS-related packages updated together.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the official pyATS release notes for detailed breaking changes. Prefer importing from documented top-level APIs (e.g., `pyats_utils.schema.api`) rather than internal modules when available.","message":"The internal structure and API of `pyats-utils` modules can change between major `pyats` releases (e.g., from 23.x to 24.x, or 24.x to 25.x). While efforts are made for backward compatibility, direct imports from deep sub-modules might break.","severity":"breaking","affected_versions":"Versions prior to 25.0 when upgrading to 25.0+, or prior to 26.0 when upgrading to 26.0+"},{"fix":"Ensure that the necessary pyATS environment or objects are initialized when using utilities that rely on them. For standalone use, ensure you understand the utility's dependencies and provide mock objects or necessary configurations if required.","message":"Some utilities in `pyats-utils` assume the context of a pyATS testbed or run-time environment. Using them in isolation without proper setup might lead to `AttributeError` or `KeyError` if they try to access non-existent testbed attributes.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'26.3':57 'align':66 'autom':24,50,76 'broader':69 'cadenc':64 'capabl':40 'cisco':11,73 'collect':17 'common':46 'compon':9 'core':8 'current':54 'data':25 'design':34 'ecosystem':71 'extend':38 'file':30,83 'file-util':82 'follow':60 'framework':14 'function':21 'geni':44 'manipul':26 'modul':3 'network':49,75 'network-autom':74 'oper':31 'provid':15 'pyat':1,4,13,42,70,72 'rapid':62 'releas':63 'reusabl':19 'schema':27,80 'schema-valid':79 'streamlin':45 'support':36 'task':47 'test':23,52,77 'typic':65 'util':2,5,20,78,84 'valid':28,81 'version':55","created_at":"2026-04-16T14:03:02.999708+00:00","updated_at":"2026-04-16T14:03:02.999708+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'pyats.utils.schema'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"26.5","cli_name":"","cli_version":null,"type":"library","homepage":"https://developer.cisco.com/pyats/","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/pyats-utils/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}