-
Notifications
You must be signed in to change notification settings - Fork 83
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow schema validation with tensor types #1665
Conversation
Codecov ReportBase: 98.26% // Head: 98.28% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #1665 +/- ##
==========================================
+ Coverage 98.26% 98.28% +0.01%
==========================================
Files 68 68
Lines 4440 4479 +39
Branches 728 730 +2
==========================================
+ Hits 4363 4402 +39
Misses 45 45
Partials 32 32
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
1d3c414
to
98bb2a2
Compare
This will probably be relevant sphinx-doc/sphinx#9479 given that the Sphinx
|
Yes, but the target here is not a mocked object... So why is that relevant? |
Because Sphinx thinks it is:
so figuring out why it thinks so is relevant. |
9bf082f
to
737422d
Compare
This bug is tricky. Need a way for sphinx to document a class attribute as an attribute, and not the underlying value. I wonder how I can hide this away better, because I need access to the short of it is class backend:
# my documentation for array_type
array_type = np.ndarray is getting expanded in sphinx with documentation/docstrings for class backend:
@property
def array_type(self):
"""my documentation for array_type"""
return np.ndarray which is fine, but feels pretty annoying to wrap around to get access to it at the class level ( |
Can you add it to |
Not a bad idea. I would prefer to document it as a property. |
To be clear, by assigning a class variable to a function, sphinx is now treating it as a function, rather than a member variable. At least it shows up under the object's members, rather than under attributes. The only way I guess it to override sphinx's default? |
Filed an issue for now: sphinx-doc/sphinx#10293 with a hacky-ish workaround. |
a1c8ae2
to
e542599
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just stepped through this and LGTM. 👍 Thanks a lot for this @kratsg!
04c8101
to
7afc367
Compare
Pull Request Description
Teach pyhf.schema.validate a new trick!
Resolves #1662. This allows for schema validation to work with objects (specifications) that contain tensors in them. This is done by extending the base type checker to teach it about the tensor types from the backends used in pyhf. Should also help with validation for differentiability (#882).
Notes:
Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: