
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
A python library to display data structure values for easier navigation and exploration.
py-data-viewer
is a lightweight Python library that makes exploring and navigating complex data structures in the terminal effortless. It provides a clear, tree-based visualization of nested dictionaries, lists, objects, and more, making debugging and data analysis more efficient. No more getting lost in complex nested structures or struggling to understand what's inside your data or how to access them!
Trees for complex data structures, Trees for simple data structures, Trees for everything!!
from py_data_viewer import vprint
async def some_async_fn():
response = await some_api_call()
vprint(response) # 👈 pass in full response or part of it! It can handle Iterables[of_any_T]!!
vprint(data, "result")
vprint
function.To install the package, use pip:
pip install py-data-viewer -U
Then, import:
from py_data_viewer import vprint
vprint
The vprint
function is the easiest way to explore data structures in your Python scripts. It provides a tree-like visualization of your data, making it ideal for debugging API responses, especially from frameworks!
from py_data_viewer import vprint
# Simulated API response
response = {
"chat_message": {
"source": "Assistant",
"content": "This is a response from an LLM.",
"metadata": {},
},
"inner_messages": [
{
"type": "ToolCallRequestEvent",
"content": [{"name": "search", "arguments": '{"query":"example"}'}],
},
{
"type": "ToolCallExecutionEvent",
"content": [{"name": "search", "content": "Search result here."}],
},
],
}
vprint(response, var_name="messages", colorize=False)
Output showing you exactly how to access the data you want:
messages
├── messages.chat_message = dict with 3 items
│ ├── messages.chat_message.source = 'Assistant'
│ ├── messages.chat_message.content = 'This is a response from an LLM.'
│ └── messages.chat_message.metadata = dict with 0 items
└── messages.inner_messages = list with 2 items
├── messages.inner_messages[0] = dict with 2 items
│ ├── messages.inner_messages[0].type = 'ToolCallRequestEvent'
│ └── messages.inner_messages[0].content = list with 1 items
│ └── messages.inner_messages[0].content[0] = dict with 2 items
│ ├── messages.inner_messages[0].content[0].name = 'search'
│ └── messages.inner_messages[0].content[0].arguments = '{"query":"example"}'
└── messages.inner_messages[1] = dict with 2 items
├── messages.inner_messages[1].type = 'ToolCallExecutionEvent'
└── messages.inner_messages[1].content = list with 1 items
└── messages.inner_messages[1].content[0] = dict with 2 items
├── messages.inner_messages[1].content[0].name = 'search'
└── messages.inner_messages[1].content[0].content = 'Search result here.'
from py_data_viewer import vprint
data = {
"user": {"id": 1, "name": "Alice"},
"actions": [
{"type": "login", "timestamp": "2023-01-01T12:00:00Z"},
{"type": "purchase", "details": {"item": "book", "price": 12.99}},
],
}
vprint(data, var_name="data")
The vprint
function supports several options to customize the output:
var_name
: Specify the variable name to display in the output.colorize
: Enable or disable colorized output (default: True
).Example:
vprint(data, var_name="custom_data_name", colorize=False)
Contributions are welcome! To contribute:
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
A python library to display data structure values for easier navigation and exploration.
We found that py-data-viewer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.