Skip to content

Commit 8140bed

Browse files
author
Andy Landy
committed
v 2.1.1
2 parents b5e5b2e + 5e3a561 commit 8140bed

26 files changed

+290
-70
lines changed

.github/workflows/dev-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
3737
- name: Test with pytest
3838
run: |
39-
python -m pytest -vv --cov=traceback_with_variables --cov-report=json
39+
python -Xfrozen_modules=off -m pytest -vv --cov=traceback_with_variables --cov-report=json
4040
4141
- name: Upload coverage report
4242
uses: actions/upload-artifact@v4

.github/workflows/master-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Master-Tests
1+
name: tests
22
on:
33
pull_request:
44
branches:
@@ -36,7 +36,7 @@ jobs:
3636
3737
- name: Test with pytest
3838
run: |
39-
python -m pytest -vv --cov=traceback_with_variables --cov-report=json
39+
python -Xfrozen_modules=off -m pytest -vv --cov=traceback_with_variables --cov-report=json
4040
4141
- name: Upload coverage report
4242
uses: actions/upload-artifact@v4

CHANGELOG.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
# Changelog
22

3-
## 2.5.0
3+
## 2.1.1
4+
- Add "tb" alias creation for lines like `import tb.a`
5+
6+
## 2.1.0
7+
- Fully compatible with 2.0.4
48
- Add short names for frequently used things like `a` and `fmt`
5-
- Fixed some bugs
9+
- Add unified `activate_by_import` to be used both for Jupyter and regular Python
10+
- Add relative ellipsis position for strings like `x=['some', ...long', 'list']`
11+
- Add detailed object printout, useful for non-dataclass classes
12+
- Add protection against acidental mistyping in format attributes
13+
- Fixed some bugs, e.g.
14+
- cli not working in Python 3.12+
15+
- `default_format` being sometimes ignored
616

717
## 2.0.4
8-
- ...
18+
- ...much, to be filled...
919

1020
## 2.0.3
1121
- Fixed tests in Windows/Mac

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<p align="center">Very simple to use, but versatile when needed. Try for debug and keep for production.</p>
55

66
<p align="center">
7-
<a href="https://github.com/andy-landy/traceback_with_variables/actions"><img alt="Actions Status" src="https://github.com/andy-landy/traceback_with_variables/workflows/Master-Tests/badge.svg"></a>
8-
<a href="https://github.com/andy-landy/traceback_with_variables/blob/master/.github/workflows/dev-test.yml#L59"><img title="code tests coverage is 100%" alt="code tests coverage is 100%" src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg"></a>
7+
<a href="https://github.com/andy-landy/traceback_with_variables/actions"><img alt="Actions Status" src="https://github.com/andy-landy/traceback_with_variables/workflows/tests/badge.svg"></a>
8+
<a href="https://github.com/andy-landy/traceback_with_variables/blob/master/.github/workflows/master-test.yml#L59"><img title="code tests coverage is 100%" alt="code tests coverage is 100%" src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg"></a>
99
<a href="https://github.com/andy-landy/traceback_with_variables/tree/master/LICENSE"><img alt="License: MIT" src="https://img.shields.io/github/license/andy-landy/traceback_with_variables?color=informational"></a>
1010
<a href="https://pepy.tech/project/traceback-with-variables"><img alt="Downloads" src="https://static.pepy.tech/badge/traceback-with-variables"></a>
1111
<a href="https://pypi.org/project/traceback-with-variables"><img alt="PyPI" src="https://img.shields.io/pypi/v/traceback-with-variables"></a>
@@ -40,17 +40,22 @@ _Contents:_ **[Installation](#installation)** | **[🚀 Quick Start](#-quick-sta
4040

4141
---
4242

43-
> :warning: **This module is actively updated and has a substantial list of features to add this week**: so any proposal or advice or warning is very welcome and will be taken into account of course. When I started it I wanted to make a tool meeting all standard use cases. I think in this particular domain this is rather achievable, so I'll try. Note `next_version` branch also. Have fun!
43+
> :warning: **I'm open to update this module to meet new use cases and to make using it easier and fun**: so any proposal or advice or warning is very welcome and will be taken into account of course. When I started it I wanted to make a tool meeting all standard use cases. I think in this particular domain this is rather achievable, so I'll try. Note `next_version` branch also. Have fun!
4444
4545
---
4646

4747
### Installation
4848

4949
```
50-
pip install traceback-with-variables==2.1.0
50+
pip install traceback-with-variables==2.1.1
5151
```
5252
```
53-
conda install -c conda-forge traceback-with-variables=2.1.0
53+
conda install -c conda-forge traceback-with-variables
54+
```
55+
56+
to use shorter `tb` alias in interactive mode call this once:
57+
```
58+
python3 -c 'from traceback_with_variables.tb_alias import create_tb_alias as c; c()'
5459
```
5560

5661
### 🚀 Quick Start
@@ -60,17 +65,15 @@ Using without code editing, <a href="https://github.com/andy-landy/traceback_wit
6065
traceback-with-variables tested_script.py ...srcipt's args...
6166
```
6267

63-
<a href="https://github.com/andy-landy/traceback_with_variables/tree/master/examples/simple.py">Simplest usage in regular Python</a>, for the whole program:
68+
<a href="https://github.com/andy-landy/traceback_with_variables/tree/master/examples/simple.py">Simplest usage</a>, for the whole program:
6469
```python
6570
from traceback_with_variables import activate_by_import
6671
```
67-
68-
<a href="https://github.com/andy-landy/traceback_with_variables/tree/master/examples/simple_jupyter.py">Simplest usage in Jupyter or IPython</a>, for the whole program:
72+
or just (if you added an alias by the above command)
6973
```python
70-
from traceback_with_variables import activate_in_ipython_by_import
74+
import tb.a
7175
```
7276

73-
7477
<a href="https://github.com/andy-landy/traceback_with_variables/tree/master/examples/print_for_function.py">Decorator</a>, for a single function:
7578
```python
7679
@prints_exc
@@ -238,7 +241,7 @@ Using a logger [<a href="https://github.com/andy-landy/traceback_with_variables/
238241
is_vegan = not (eggs or milk)
239242
is_huge = (sugar + eggs + milk + flour + salt + water > 10000)
240243
if not (is_sweet or is_vegan or is_huge):
241-
raise ValueError('This is unacceptable, guess why!')
244+
raise ValueError('This is unacceptable, look why!')
242245
...
243246
```
244247

README.tmpl

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<p align="center">Very simple to use, but versatile when needed. Try for debug and keep for production.</p>
55

66
<p align="center">
7-
<a href="{{ repo_url }}/actions"><img alt="Actions Status" src="{{ repo_url }}/workflows/Master-Tests/badge.svg"></a>
8-
<a href="{{ repo_url }}/blob/master/.github/workflows/dev-test.yml#L59"><img title="code tests coverage is 100%" alt="code tests coverage is 100%" src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg"></a>
7+
<a href="{{ repo_url }}/actions"><img alt="Actions Status" src="{{ repo_url }}/workflows/tests/badge.svg"></a>
8+
<a href="{{ repo_url }}/blob/master/.github/workflows/master-test.yml#L59"><img title="code tests coverage is 100%" alt="code tests coverage is 100%" src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg"></a>
99
<a href="{{ code_url }}/LICENSE"><img alt="License: MIT" src="https://img.shields.io/github/license/{{ user_repo_name }}?color=informational"></a>
1010
<a href="https://pepy.tech/project/traceback-with-variables"><img alt="Downloads" src="https://static.pepy.tech/badge/traceback-with-variables"></a>
1111
<a href="{{ pypi_url }}"><img alt="PyPI" src="https://img.shields.io/pypi/v/{{ package_name }}"></a>
@@ -40,7 +40,7 @@ _Contents:_ **[Installation](#installation)** | **[🚀 Quick Start](#-quick-sta
4040

4141
---
4242

43-
> :warning: **This module is actively updated and has a substantial list of features to add this week**: so any proposal or advice or warning is very welcome and will be taken into account of course. When I started it I wanted to make a tool meeting all standard use cases. I think in this particular domain this is rather achievable, so I'll try. Note `next_version` branch also. Have fun!
43+
> :warning: **I'm open to update this module to meet new use cases and to make using it easier and fun**: so any proposal or advice or warning is very welcome and will be taken into account of course. When I started it I wanted to make a tool meeting all standard use cases. I think in this particular domain this is rather achievable, so I'll try. Note `next_version` branch also. Have fun!
4444

4545
---
4646

@@ -50,7 +50,12 @@ _Contents:_ **[Installation](#installation)** | **[🚀 Quick Start](#-quick-sta
5050
pip install traceback-with-variables=={{ version }}
5151
```
5252
```
53-
conda install -c conda-forge traceback-with-variables={{ version }}
53+
conda install -c conda-forge traceback-with-variables
54+
```
55+
56+
to use shorter `tb` alias in interactive mode call this once:
57+
```
58+
python3 -c 'from traceback_with_variables.tb_alias import create_tb_alias as c; c()'
5459
```
5560

5661
### 🚀 Quick Start
@@ -60,17 +65,15 @@ Using without code editing, <a href="{{ examples_code_url }}/external_script.sh"
6065
traceback-with-variables tested_script.py ...srcipt's args...
6166
```
6267

63-
<a href="{{ examples_code_url }}/simple.py">Simplest usage in regular Python</a>, for the whole program:
68+
<a href="{{ examples_code_url }}/simple.py">Simplest usage</a>, for the whole program:
6469
```python
6570
from {{ import_name }} import activate_by_import
6671
```
67-
68-
<a href="{{ examples_code_url }}/simple_jupyter.py">Simplest usage in Jupyter or IPython</a>, for the whole program:
72+
or just (if you added an alias by the above command)
6973
```python
70-
from {{ import_name }} import activate_in_ipython_by_import
74+
import tb.a
7175
```
7276

73-
7477
<a href="{{ examples_code_url }}/print_for_function.py">Decorator</a>, for a single function:
7578
```python
7679
@prints_exc
@@ -238,7 +241,7 @@ Using a logger [<a href="{{ examples_code_url }}/log_for_function.py">with a dec
238241
is_vegan = not (eggs or milk)
239242
is_huge = (sugar + eggs + milk + flour + salt + water > 10000)
240243
if not (is_sweet or is_vegan or is_huge):
241-
raise ValueError('This is unacceptable, guess why!')
244+
raise ValueError('This is unacceptable, look why!')
242245
...
243246
```
244247

examples/simple.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from traceback_with_variables import a # , fmt
22
# or
33
from traceback_with_variables import activate_by_import # , fmt
4+
# or (if you added the "tb" alias)
5+
import tb.a
46

57

68
# fmt.max_value_str_len = 10000

examples/simple_jupyter.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
1+
from traceback_with_variables import a
2+
3+
# or just
4+
# import tb.a
5+
# if you created the tb alias
6+
7+
# or
8+
# from traceback_with_variables import activate_by_import
9+
# if you prefer better names
10+
11+
n = 0
12+
1/0
13+
14+
15+
16+
17+
18+
"""How to install in Colab etc."""
19+
120
!pip install traceback-with-variables
2-
from traceback_with_variables import activate_in_ipython_by_import
21+
# add this to use "tb" alias for the package
22+
from tracaback_with_variables import create_tb_alias
23+
create_tb_alias()

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'rollable. Debug reasons of exceptions by logging or pretty printing color'
1515
'ful variable contexts for each frame in a stacktrace, showing every value'
1616
'. Dump locals environments after errors to console, files, and loggers. W'
17-
'orks with Jupiter and IPython.',
17+
'orks with Jupyter and IPython.',
1818
long_description=long_description,
1919
long_description_content_type="text/markdown",
2020
url='https://github.com/andy-landy/traceback_with_variables',
@@ -23,7 +23,7 @@
2323
'variables', 'python3', 'stacktrace', 'arguments', 'errors',
2424
'error-handling', 'dump', 'exception-handling', 'exceptions',
2525
'pretty', 'pretty-print', 'frame', 'simple',
26-
'colors', 'jupyer', 'jupyer-notebook', 'ipython', 'customize'],
26+
'colors', 'jupyter', 'jupyter-notebook', 'ipython', 'customize'],
2727
classifiers=[
2828
'Programming Language :: Python :: 3',
2929
'License :: OSI Approved :: MIT License',
@@ -38,7 +38,8 @@
3838
tests_require=[
3939
'flake8',
4040
'ipython',
41-
'pytest-cov'
41+
'pytest-cov',
42+
'notebook==6.2.0',
4243
],
4344
install_requires=[],
4445
python_requires='>=3.6',

tests/dumps/test_core.after_100_.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ Traceback with variables (most recent call last):
4545
. fmt.skip_files_except = []
4646
. fmt.brief_files_except = []
4747
. fmt.custom_var_printers = []
48-
. with pytest.raises(AttributeError):
48+
. with pytest.raises(AttributeError) as e:
4949
. fmt.max_val_str_len = 1
50+
. assert str(e.value) == "'Format' object has no attribute 'max_val_str_len'"
5051
.
5152
.
5253
. def test_default(check):
@@ -88,7 +89,6 @@ Traceback with variables (most recent call last):
8889
. def test_objects_details(tb_reg, obj, objects_details):
8990
. try:
9091
. 1/0
91-
. except:
9292
kwargs = {'fmt': <traceback_with_variables.core.Format object at 0x...omitted for tests only...>}
9393
tb_reg = <bound method Reg.match_tb_text of <tests.test_utils.Reg object at 0x...omitted for tests only...>>
9494
File "...omitted for tests only.../dummies.py", line...omitted for tests only..., in f

tests/dumps/test_global_hooks.activate_in_ipython_by_import_error.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Traceback (most recent call last):
1111
File "...omitted for tests only.../code.py", line...omitted for tests only..., in <module>
1212
from traceback_with_variables import activate_in_ipython_by_import
1313
File "...omitted for tests only.../activate_in_ipython_by_import.py", line...omitted for tests only..., in <module>
14+
default_global_print_exc_in_ipython()
15+
File "...omitted for tests only.../default_global_hooks.py", line...omitted for tests only..., in default_global_print_exc_in_ipython
1416
global_print_exc_in_ipython()
1517
File "...omitted for tests only.../global_hooks.py", line...omitted for tests only..., in global_print_exc_in_ipython
1618
raise ValueError("IPython not found")

0 commit comments

Comments
 (0)