-
Notifications
You must be signed in to change notification settings - Fork 445
Add annotation for endpoints to indicate minimum supported API version #124
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
Conversation
| '''Annotate the minimum supported version for an endpoint. | ||
| Checks the version on the server object and does a float comparison. | ||
| It will raise an exception if the server vesion is > the version specified. |
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.
'vesion' -> 'version' typo
| @wraps(func) | ||
| def wrapper(self, *args, **kwargs): | ||
| server_version = self.parent_srv.version | ||
| if float(server_version) < version: |
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.
Please use https://docs.python.org/3.6/distutils/apiref.html#module-distutils.version to compare version numbers. Casting to float will break if/when we decide to be more nuanced with your version numbers.
| @@ -1,4 +1,4 @@ | |||
| from .endpoint import Endpoint | |||
| from .endpoint import Endpoint, api | |||
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.
Do you actually use api anywhere?
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.
oops, this was left over from my manual test script
245f88e to
87d0686
Compare
graysonarts
left a comment
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.
🚀
* Fix tableau#117 by only attempting files with the right extension inside the archive (tableau#118) * Commenting and Docstring cleanup. A few very small code cleanups (tableau#120) Add docstrings and remove clutter. I also made some very tiny tweaks to some code for clarity. * Small cleanups for various editors. Play nice with built in test-runners (tableau#121) * Add Py36, update travis to use pycodestyle (tableau#124) * Add `initial sql` and `query band` support (tableau#123) Addresses tableau#109 and tableau#110 * Prep for release of 0.6 (tableau#125) * Prep for release of 0.6 * wordsmithing the changelog
Addresses #55
This is just the decorator, I manually tested with the
users.getendpoint and a script.Once we add the annotation to the actual endpoints this will get automagically covered by all existing tests. I can make a unittest that mocks everything to test this method, but that doesn't feel super useful (It'd literally be testing does
<work).I think I'd like to break it into two PRs, add this method first, and in the second PR add the annotations and and ensure existing tests still pass
Open to feedback on the exception name and where I put this method -- but endpoint felt like the most natural place for it
/cc @RussTheAerialist @LGraber