davidhewitt / pythonize

MIT License
198 stars 28 forks source link

Update to 0.16 #25

Closed Igosuki closed 2 years ago

Igosuki commented 2 years ago

I have no idea why, but despite the deprecation, pyproto is still needed, otherwise CustomList doesn't work. Additionally, CustomDict is not considered a sequence...

codecov-commenter commented 2 years ago

Codecov Report

Merging #25 (26ac099) into main (ec012da) will decrease coverage by 0.18%. The diff coverage is 95.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #25      +/-   ##
==========================================
- Coverage   80.99%   80.81%   -0.19%     
==========================================
  Files           4        4              
  Lines        1021     1027       +6     
==========================================
+ Hits          827      830       +3     
- Misses        194      197       +3     
Impacted Files Coverage Δ
src/de.rs 88.02% <95.23%> (-0.41%) :arrow_down:

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 9c1b162...26ac099. Read the comment docs.

davidhewitt commented 2 years ago

Thanks for this!

Regarding the #[pyproto] deprecation, yes, it's a little unfortunate. Half of the pain is in PyO3 and the other half is here in pythonize.

The crux of the problem is illustrated by https://pyo3.rs/latest/migration.html#container-magic-methods-now-match-python-behavior. Both Python and PyO3 now generate containers implementations which satisfy both the "mapping" and "sequence" checks by default. (This is different in the #[pyproto] approach where the differences were explicit.) I would like to add some functionality to PyO3 to tease these apart again.

To deal with this, pythonize should perhaps try the sequence branch, and if that fails, the mapping branch.

Igosuki commented 2 years ago

@davidhewitt Thanks, that was the problem I could'nt pick between the two sequence/mapping signatures.