Skip to main content

A package for inspecting and displaying variable information

Project description

VarInspector

VarInspector is a Python package designed to inspect and display information about variables and objects in a Python environment. It provides an easy way to quickly understand the types, sizes, and other characteristics of variables within your code, making debugging and analysis much simpler.

Features

  • Variable Overview: Get detailed information about any variable, including its type, size, and value.
  • Advanced Inspection: Offers detailed introspection for callables, modules, and other complex types.
  • Customizable Display: Users can configure the maximum string length and the maximum number of rows to display, tailoring the output to their specific needs.

Installation

Install VarInspector using pip:

pip install var_inspector

Or, if you prefer to install from source:

git clone https://github.com/tyaso777/var_inspector.git
cd var_inspector
pip install .

Usage

Here's how to use VarInspector:

# Creating an instance with custom settings
from var_inspector import VarInspector
view_var = VarInspector(max_str_length=300, max_rows=200)
# or import view_var directly
from var_inspector import view_var

# Just invoking the view_var to display global variables with default settings
view_var()

# Displaying all global variables including special types
view_var(include_advanced_details=True)

# Displaying information about a specific variable
some_variable = [1, 2, 3]
view_var(some_variable)

# Displaying information about a specific variable including special types
view_var(some_variable, include_advanced_details=True)

Example Output

  1. Display information about global variables by view_var():

    User-defined and basic type global variables:

    Name Type Size (MB) Len Value
    Optional _SpecialForm 0.00 - typing.Optional
    Sized ABCMeta 0.00 - <class 'collections.abc.Sized'>
    VarInspector type 0.00 - <class '__main__.VarInspector'>
    view_var VarInspector 0.00 - <__main__.VarInspector object at 0x00000213C3AA0A10>
  2. Inspect a specific variable by view_var(some_variable):

    Object Overview:

    Attribute Value
    Type list
    Module Unknown module
    Source File Source file not available
    File Path File not applicable
    Source Lines No source line info
    Size (MB) 0.00
    Doc Built-in mutable sequence.

    If no argument is given, the constructor creates a new empty list.
    The argument must be an iterable if specified.

    Attributes and methods of list:

    Name Type Signature Size (MB) Len Value
    append Method (object, /) - - Append object to the end of the list.
    clear Method () - - Remove all items from list.
    copy Method () - - Return a shallow copy of the list.
    count Method (value, /) - - Return number of occurrences of value.
    extend Method (iterable, /) - - Extend list by appending elements from the iterable.
    index Method (value, start=0, stop=9223372036854775807, /) - - Return first index of value. Raises ValueError if the value is not present.
    insert Method (index, object, /) - - Insert object before index.
    pop Method (index=-1, /) - - Remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
    remove Method (value, /) - - Remove first occurrence of value. Raises ValueError if the value is not present.
    reverse Method () - - Reverse *IN PLACE*.
    sort Method (*, key=None, reverse=False) - - Sort the list in ascending order and return None. The sort is in-place and stable. If a key function is given, apply it once to each list item and sort them, ascending or descending, according to....

Contributing

Contributions to VarInspector are welcome! However, please be aware that this project does not currently have any tests, and due to limited maintenance, there might be a delay in responding to contributions. While we appreciate your input, it may be more beneficial to consider creating a similar project of your own if you have significant changes or improvements in mind.

If you still wish to contribute, please feel free to fork the repository and submit your changes via a pull request. Here's a reminder that contributions might not be noticed promptly, but they are appreciated when spotted!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

var_inspector-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

var_inspector-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file var_inspector-0.1.0.tar.gz.

File metadata

  • Download URL: var_inspector-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for var_inspector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eed667f9f214670fab41389f57e9901b56a49df29a20851f3251d505b1837ea2
MD5 caa90a567b7f6be471ca6e866d6e367f
BLAKE2b-256 40ffe5db77d64841def92ce32909595f5f1d86a7b8db346d79dbb0be22e2a4d0

See more details on using hashes here.

File details

Details for the file var_inspector-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: var_inspector-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for var_inspector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c6a7d9d51bd2f5784b7a55a72f7b4837c264bb74da8a99c8e575d2a89cee48d
MD5 a9699817d190af221e8f2ab8cad79fbb
BLAKE2b-256 f0bfe73d9189dbe86b11649dbbf0c1f407414b4d6706f06cd9117ff2af9c0e5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page