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.1.tar.gz (6.2 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.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: var_inspector-0.1.1.tar.gz
  • Upload date:
  • Size: 6.2 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.1.tar.gz
Algorithm Hash digest
SHA256 18fae806962485632100c445231d0a991a8dd03d6f20df7f0c59cb74d5b5da80
MD5 efb4c3dd2ae9a7c35573521eff85e411
BLAKE2b-256 2a7db0048dfcfee39d4347e4fea52ad6d49d1db33c044ff8e7c788362e98152f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: var_inspector-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da37946fa2661db424d65f0c76fe76af356152339be619ffe0482aad6a33c864
MD5 79ee23cf44129e124c8f6348ce7f558c
BLAKE2b-256 a4ecc4f6f78f017fdab8910fe2706243c64f925197d3965aea6f3353d465b23f

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