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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Type Hints #94

Closed
jamielennox opened this issue May 5, 2019 · 9 comments
Closed

Support Type Hints #94

jamielennox opened this issue May 5, 2019 · 9 comments
Milestone

Comments

@jamielennox
Copy link
Owner

We should make an attempt to provide python type hinting support. It will need to continue to support python2.7 and I would like to figure out how it can be unit tested through mypy or something.

@jonadaly
Copy link

jonadaly commented Jul 1, 2020

Seconding this suggestion - we use mypy extensively throughout our codebase, and typing support for requests-mock would be valuable to us. At the moment we need to pick between imports of private classes such as requests_mock.adapter._Matcher, or resorting to Any.

@jamielennox
Copy link
Owner Author

yea, there was a request for _Matcher and _Context to be public classes. I don't really like that mypy forces that, there's no reason for them to be public, but it's not a big deal in practice.

pcorpet added a commit to bayesimpact/requests-mock that referenced this issue Apr 7, 2021
@pcorpet
Copy link
Contributor

pcorpet commented Apr 7, 2021

@jamielennox @jonadaly can you try out my PR? I've been using those hints for a while but always with the same pattern so it's worth running it against other pieces of code before submitting.

Also I've considered checking them with stubtest but I think it's not worth it: we don't need to stub all internals of requests_mock which makes stubtest complain.

@palfrey
Copy link

palfrey commented Apr 7, 2021

@jamielennox @jonadaly can you try out my PR? I've been using those hints for a while but always with the same pattern so it's worth running it against other pieces of code before submitting.

I've just run your PR against some code I've got (non-public, so can't share links), and works perfectly :)

@jonadaly
Copy link

jonadaly commented Apr 7, 2021

Your PR works for me!

@jamielennox
Copy link
Owner Author

Going to mark this closed by #161. If it needs to be enhanced it can be done in an incremental way.

Thanks for the input.

@jamielennox jamielennox added this to the 1.9.0 milestone Apr 13, 2021
@jamielennox
Copy link
Owner Author

Released as 1.9.0

@palfrey
Copy link

palfrey commented Apr 29, 2021

Released as 1.9.0

Awesome. Upgraded my project, deleted a bunch of internal hacky stubs :)

@pcorpet
Copy link
Contributor

pcorpet commented Apr 29, 2021

Thanks @jamielennox for the release, and the quick patch! It's working like a charm for us as well.

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

No branches or pull requests

4 participants