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

Add type hints to improve codebase readability and enable static type checking #203

Open
Niraj-Kamdar opened this issue Jun 28, 2023 · 14 comments
Assignees
Labels
help wanted Please contribute to close this issue

Comments

@Niraj-Kamdar
Copy link

I propose adding type hints to the mocket Python package to enhance code readability and maintainability. Type hints provide several benefits, including improved developer productivity, enhanced code documentation, and the ability to catch potential errors using static type-checking tools like Mypy.

@mindflayer
Copy link
Owner

mindflayer commented Jul 1, 2023

Hi @Niraj-Kamdar, I am not sure if I got your proposal right. Are you volunteering to add type hints to the project?

@mindflayer
Copy link
Owner

No answers to my question, closing it.

@mindflayer mindflayer closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2023
@Niraj-Kamdar
Copy link
Author

Hey @mindflayer Sorry for the late reply here. My proposal is for adding type hints in general, I would love to help here though when I get free time but currently, I have too much on my plate to help out with this. I would appreciate if you can keep this issue open so others or me can eventually take this and add type-hints to the mocket.

@Kilo59
Copy link
Contributor

Kilo59 commented Apr 25, 2024

@mindflayer Closing this issue signals that

  1. You don't plan to add type annotations.
  2. You aren't willing to accept contributions that add these.

Can you re-open this issue if one or both of these are untrue?

@mindflayer
Copy link
Owner

mindflayer commented Apr 25, 2024

@mindflayer Closing this issue signals that

1. You don't plan to add type annotations.

2. You aren't willing to accept contributions that add these.

Can you re-open this issue if one or both of these are untrue?

I am the only maintainer of Mocket, and I think it's worth keeping non-bug issues open only if I am confident it's something I have time for, or at least if I know someone is willing to help with.
Having a backlog of stuff just for the sake of it it's pointless.
So, allow me to bounce back the question: is anyone willing to contribute with adding type hints?

@Kilo59
Copy link
Contributor

Kilo59 commented Apr 25, 2024

So, allow me to bounce back the question: is anyone willing to contribute with adding type hints?

@mindflayer

Yes. The only thing that gives me pause about taking on this work is the fact that this issue was closed. Which makes it ambiguous as to whether an annotation PR would be accepted.

@mindflayer mindflayer reopened this Apr 26, 2024
@mindflayer
Copy link
Owner

Well, alright then! 👍

@mindflayer mindflayer added the help wanted Please contribute to close this issue label Apr 26, 2024
@mindflayer
Copy link
Owner

Hi @Kilo59, are you still planning to continue with this task?

@betaboon
Copy link
Contributor

Hello @mindflayer,

i just ran into the same "issue" wanting to have this library typed.

I started taking a stab at it, but noticed huge parts of the core are hard to type especially due to how request- and response-types are handled (eg Entry.response_cls)

i think typing this library fully requires some heavy-handed refactoring in some areas.

I'd be willing to do the work (ensuring to not touch the tests), but I'm wondering if you are open to a PR that does said refactoring in addition to the typing?

kind regards
beta

@mindflayer
Copy link
Owner

mindflayer commented Nov 16, 2024

Hi @betaboon, I am not against things like that, and I see many reasons for wanting type hints added to Mocket, especially for people using it as a framework for writing new mocks.
It's definitely not the main use-case, but I believe the reason for it is a mix of poor documentation and lack of type hints.

@betaboon
Copy link
Contributor

Hi @betaboon, I am not against things like that, and I see many reasons for wanting type hints added to Mocket, especially for people using it as a framework for writing new mocks. It's definitely not the main use-case, but I believe the reason for it is a mix of poor documentation and lack of type hints.

cool. I'll start working on a PR and push an early commit showing the direction of refactoring i have in mind, so that you can take a look and think whether you like that direction or not :)

@mindflayer
Copy link
Owner

mindflayer commented Nov 16, 2024

Sure! Apart from looking like a scary monster, I am not that bad though. :)

@mindflayer
Copy link
Owner

mindflayer commented Nov 16, 2024

Jokes apart, it makes sense to split it in chunks, and of course I'll do my best to raise concerns as soon as I see what you have in mind. The good thing of adding type hints is the fact that can be done incrementally.

@betaboon
Copy link
Contributor

@mindflayer i just pushed a PR.

let's continue discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Please contribute to close this issue
Projects
None yet
Development

No branches or pull requests

4 participants