pytensor icon indicating copy to clipboard operation
pytensor copied to clipboard

Make all zips explicitly strict or non-strict

Open Armavica opened this issue 1 year ago • 7 comments

Description

  • First commit: adding a strict=True argument to all zips when it doesn't produce mistakes in the test suite (464 of them), and strict=False to the others (28 of them)
  • Second commit: enable ruff rule requiring and explicit strict argument to all zips
  • Rest of the commits: transform the non-strict zips into strict zips (18 of them for now)

There remains 10 non-strict zips that I find difficult to understand.

Related Issue

  • [ ] Closes #
  • [x] Related to #840

Checklist

Type of change

  • [ ] New feature / enhancement
  • [ ] Bug fix
  • [ ] Documentation
  • [ ] Maintenance
  • [ ] Other (please specify):

Armavica avatar Jun 24 '24 14:06 Armavica

@Armavica may be crazy work, but can we get a separate commit where we make the non-strict zips. That way it's easier to evaluate if it sounds correct or may be a bug somewhere?

Or I guess I can just ctrl+f for it

ricardoV94 avatar Jun 27 '24 09:06 ricardoV94

@ricardoV94 Yes, I was planning to present this PR(s) in several steps:

  • Commits that add strict=True to zips without tests failing
  • Commits that add strict=True to zips and fix their failures (bugs)
  • Commits that add strict=False to the remaining zips that need it, or rewrite them so they can be made strict How does that sound to you?

Armavica avatar Jun 28 '24 07:06 Armavica

Sounds good @Armavica

ricardoV94 avatar Jun 28 '24 09:06 ricardoV94

Codecov Report

Attention: Patch coverage is 91.55556% with 19 lines in your changes missing coverage. Please review.

Project coverage is 82.12%. Comparing base (6de3151) to head (a4d7bb4). Report is 102 commits behind head on main.

Files with missing lines Patch % Lines
pytensor/scan/rewriting.py 61.53% 5 Missing :warning:
pytensor/d3viz/formatting.py 0.00% 2 Missing :warning:
pytensor/ifelse.py 60.00% 2 Missing :warning:
pytensor/scan/op.py 87.50% 0 Missing and 2 partials :warning:
pytensor/compile/debugmode.py 50.00% 1 Missing :warning:
pytensor/link/basic.py 83.33% 1 Missing :warning:
pytensor/link/utils.py 66.66% 1 Missing :warning:
pytensor/printing.py 50.00% 1 Missing :warning:
pytensor/scalar/basic.py 80.00% 1 Missing :warning:
pytensor/tensor/blockwise.py 88.88% 1 Missing :warning:
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #850   +/-   ##
=======================================
  Coverage   82.12%   82.12%           
=======================================
  Files         183      183           
  Lines       47986    47986           
  Branches     8644     8644           
=======================================
  Hits        39409    39409           
  Misses       6411     6411           
  Partials     2166     2166           
Files with missing lines Coverage Δ
pytensor/compile/builders.py 88.66% <100.00%> (ø)
pytensor/compile/function/pfunc.py 82.92% <100.00%> (ø)
pytensor/compile/function/types.py 80.48% <100.00%> (ø)
pytensor/gradient.py 77.57% <100.00%> (ø)
pytensor/graph/basic.py 88.69% <100.00%> (ø)
pytensor/graph/op.py 88.08% <ø> (ø)
pytensor/graph/replace.py 84.21% <100.00%> (ø)
pytensor/graph/rewriting/basic.py 70.43% <100.00%> (ø)
pytensor/link/c/basic.py 87.48% <100.00%> (ø)
pytensor/link/c/cmodule.py 60.48% <100.00%> (ø)
... and 59 more

codecov[bot] avatar Jun 29 '24 06:06 codecov[bot]

Is this ready for review? Seems like all test are passing now

jessegrabowski avatar Jul 07 '24 02:07 jessegrabowski

Is this ready for review? Seems like all test are passing now

There are still ~~11~~ 10 instances of non-strict zips that produce errors if I make them strict, I need to investigate them one by one to see if that's expected behaviour or not.

Armavica avatar Jul 07 '24 06:07 Armavica

Actually, I find it difficult to make more progress here, so I am signalling this for review. I added 464 easy strict=True, 18 less immediate ones, and there are still 10 strict=False that I find the most difficult to understand. I think that they could be handled in another PR. This one introduces 464+18 = 482 safeguards, which I think is a good score :)

Armavica avatar Jul 07 '24 13:07 Armavica

@ricardoV94 Fixed all your points, let me know if there are more

Armavica avatar Nov 19 '24 08:11 Armavica

Is it ready @Armavica ?

ricardoV94 avatar Nov 19 '24 14:11 ricardoV94

Yes I think I changed everything you pointed out, if not it's my mistake

Armavica avatar Nov 19 '24 14:11 Armavica

Thanks 🙏🙏

ricardoV94 avatar Nov 19 '24 14:11 ricardoV94

Thank you for your review!

Armavica avatar Nov 19 '24 14:11 Armavica