Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properties are not required to be writable #9

Merged
merged 1 commit into from Mar 9, 2021
Merged

Conversation

henryiii
Copy link
Member

@henryiii henryiii commented Mar 9, 2021

@HDembinski, @jpivarski Important fix to the protocol. The old version required writable properties for axes, kind, and traits. 馃う . This only requires they be readable properties now. (If they are writable, it does not invalidate the protocol, but it is not required! Not discovered by mplhep usage because the mini-NumPy wrapper happened to have writable properties).

I'd also like to update the protocol to require returning np.ndarray from .values() and such, as you should be a bit more explicit on return types, and less explicit on accepted types. Now that ArrayLike is available, I realize you should only "accept" ArrayLike, and never return it, it's too broad for a return usually.

protocol_version = 1
protocol_version = (1, 1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The protocol version is now a tuple, to allow minor updates

@henryiii
Copy link
Member Author

henryiii commented Mar 9, 2021

This also fixes the enum vs string problem! A sting enum wasn't allowed for .kind, and it turned out it was because .kind was settable; so h.kind = "arbitrary string" needed to be valid. Now that it's a read-only property, it can be a string enum! :)

@henryiii
Copy link
Member Author

henryiii commented Mar 9, 2021

Passing in boost-histogram locally, so will merge and make a patch release, as there are no functional changes, just removing functionality that was not supposed to be required.

@henryiii henryiii merged commit f9e4db2 into main Mar 9, 2021
@henryiii henryiii deleted the fix/writable branch March 9, 2021 14:42
@HDembinski
Copy link
Member

Sounds good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants