Metadata-Version: 2.5
Name: varInspect
Version: 0.1.0
Summary: Print a table of your Python variables, their datatypes, and their values.
Author: amphibiar
License-Expression: MIT
License-File: LICENSE
Keywords: debug,inspect,introspection,repl,table,variables
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Provides-Extra: test
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# varInspect

Print a table of your Python variables — name, datatype, and value — straight
from the running program.

```python
from varinspect import listVars

def check_order(symbol, qty, price):
    filled = False
    tags = ["intraday", "nifty"]
    risk = {"stop": 0.5, "target": 1.2}
    listVars()

check_order("NIFTY26OCT25000CE", 50, 123.45)
```

```
name    type   value
===========================================
filled  bool   False
price   float  123.45
qty     int    50
risk    dict   {'stop': 0.5, 'target': 1.2}
symbol  str    'NIFTY26OCT25000CE'
tags    list   ['intraday', 'nifty']
```

## Install

```bash
pip install varInspect
```

The distribution is named `varInspect`; the importable module is lowercase
`varinspect` (PEP 8):

```python
from varinspect import listVars, formatVars, VarRow
```

## API

### `listVars(target=..., *, scope="locals", ...)`

Prints the table and returns the printed rows as a list of `VarRow`.

| Parameter | Default | Meaning |
| --- | --- | --- |
| `target` | caller's frame | What to inspect: omit for the caller's own variables, or pass a module, a mapping, or any object. |
| `scope` | `"locals"` | `"locals"`, `"globals"` or `"both"` — only used when `target` is omitted. |
| `include_private` | `True` | Include names starting with a single underscore. |
| `include_dunder` | `False` | Include `__dunder__` names. |
| `sort_by` | `"name"` | `"name"`, `"type"` or `"value"`. |
| `max_value_len` | `60` | Truncate each value to this many columns (`0` = unlimited). |
| `max_width` | `100` | Cap the total table width; the `value` column absorbs the overflow (`0` = unlimited). |
| `style` | `"simple"` | `"simple"` (ASCII) or `"box"` (Unicode box drawing). |
| `file` | `sys.stdout` | Where to print. |

### `formatVars(...)`

Same signature, but returns the table as a string instead of printing it.

### `VarRow(name, type, value)`

A frozen dataclass for one inspected variable. It unpacks like a tuple:

```python
for name, type_, value in listVars():
    ...
```

## More examples

Inspect a module or an object instead of the local scope:

```python
import json
from varinspect import listVars

listVars(json)            # everything bound in the json module
listVars(my_config_obj)   # instance attributes plus class attributes
listVars({"a": 1})        # any mapping
```

Tune the output:

```python
listVars(style="box", max_width=60)
listVars(scope="both", include_dunder=True, sort_by="type")
listVars(max_value_len=0, max_width=0)   # never truncate
```

```
┌───────────────────────┐
│ name  │ type │ value  │
├───────────────────────┤
│ label │ str  │ '完了' │
│ ok    │ bool │ True   │
└───────────────────────┘
```

Wide (CJK) characters are measured by display width, so columns stay aligned.

## Notes

- `listVars` skips itself, so `from varinspect import listVars` never shows up
  as a variable of its own.
- `__name__`, `__doc__` and friends are hidden unless you ask for them.
- A value whose `__repr__` raises is reported instead of crashing the table.
- Only the standard library is required.

## Development

```bash
python -m pytest
python -m build
twine check dist/*
```

## License

MIT
