-
Notifications
You must be signed in to change notification settings - Fork 22
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
Python type annotations and patch Content-Type
fixes
#1619
Python type annotations and patch Content-Type
fixes
#1619
Conversation
yay for CI. Evidently |
@dpgraham4401 I am fine either way - you've done a lot of good work and I think the package is much improved by it, so I lean towards 3.11+ compatability. PR looks good. I am comfortable merging (with update to requirements files) if you want to go forward as-is. |
I've found the PSF backports of typing features for versions < 3.10 here https://github.com/python/typing_extensions. @wiljnichepa I would appreciate it if you could take a look at this. It should e ready for review now. Thanks! |
@dpgraham4401 I've had a chance to review and feel good about it. Thanks for all your work, especially to ensure additional compatability! |
correction version search parameters MTN search parameter type annotations type annotations for site and user search services typed responses for check_site_exists and get_entry_ports finish adding return types for DOT/RCRA lookups make RcraResponse accept Generic type and add generic types to select DOT lookup calls as well as a RcraSite TypedDict add mypy to requirements
…Manifest/RCRAInfo services. clean up and finalize type doc strings implement generic response types that return Manifest types fix test that allow new_client to be created without a RCRAInfo environment Waste type definition move types to separate module to eliminate the massive file add Manifest Type Definition rename types for consistency and export public types at package level shorten doc strings to below 99 characters where possible lint with mypy and fix type annotations for possibly None types use the python/type_checking package to for backward compatible API types. Add type stubs for requirements_dev.txt remove 'Required' type annotation on SignManifestArgs to remain backwards compatible with python 3.10 see documentation on Required https://docs.python.org/3/library/typing.html\#typing.Required increment version and remove deprecated datetime.utcnow() calls UI Link service type annotations type annotations for sign_manifest method
941fbdc
to
2a2406e
Compare
this PR adds type annotations, which largely make use of
TypedDicts
, andLiteral
s, to add static type checking to our client methods. It's particularly useful for**kwarg
heavy methods since it reduces redundant inline documentation (e.g., writing the possible SubmissionTypes in each method), creates a more pleasant developer experience (possible auto completion) for previously unknown dicts, and allows users of the library to statically type check their usage.It also makes another quick fix to the patch methods, previously adjusted in #1618, which require the header
Content-Type: application/json-patch+json
which I've honestly never seen before but it's what the RCRAInfo/e-Manifest API requires.One last thing, this PR removed references to datetime.utcnow() classmethod which is deprecated and will be removed in a future release.