gaogaotiantian / watchpoints

watchpoints is an easy-to-use, intuitive variable/object monitor tool for python that behaves similar to watchpoints in gdb.
Apache License 2.0
497 stars 20 forks source link

Make watchpoints work with dataframe #31

Closed gaogaotiantian closed 2 years ago

codecov-commenter commented 2 years ago

Codecov Report

Merging #31 (f739c8b) into master (8f4cc79) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #31   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          351       357    +6     
=========================================
+ Hits           351       357    +6     
Impacted Files Coverage Δ
src/watchpoints/watch_element.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8f4cc79...f739c8b. Read the comment docs.

rsemenoff commented 2 years ago

I'd like to try it out, how would I install it? I tried pip install watchpoints --upgrade but it says I already have version 0.2.5 . Is that the latest version now ?

gaogaotiantian commented 2 years ago

It's not released so you'll need to install from the repo - pip install git+https://github.com/gaogaotiantian/watchpoints.git You'll probably need some other packages to build the wheels.

When I'm looking at the code, I remembered that watchpoints has a way to solve it - you can use a user-defined compare function, which is a general solution for data structures with weird __eq__ functions.

I think the syntax would be watch(df, cmp=lambda df1, df2: not df1.equals(df2)). I'm not 100% sure if you need a special copy function as I'm not an expert on DataFrame.

https://github.com/gaogaotiantian/watchpoints/blob/master/tests/test_pandas.py#L46 this was in the test suite for a while to test cmp argument.

Let me know if you'd like to try the cmp argument out, or if you have any issues installing from git.