-
Notifications
You must be signed in to change notification settings - Fork 42
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
refactor: rework Entry, Request and Response classes #276
base: main
Are you sure you want to change the base?
Conversation
277d081
to
a69d07e
Compare
a69d07e
to
88d66ad
Compare
9422982
to
47d07a9
Compare
47d07a9
to
218eb32
Compare
|
fyi i have another branch that builds on top of this that gets us to fully typed. |
I'm sorry for not answering before, first I've been sick, then very busy at work. I'll look at both soon. |
Nothing to be sorry. feel better and take your time :) |
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.
I am not sure I like the concept of mocket.core
, in the end it gets most of the code, not very different from having it under mocket
.
If you want to make it tidier, maybe something like mocket.decorators
for decorators, etc.
|
||
|
||
class MocketBytesResponse(MocketBaseResponse): | ||
def __init__(self, data: bytes | str | bool) -> None: |
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.
MocketBytesResponse
can be created with bytes
/str
/bool
? Isn't it confusing?
I've read the code a bunch of times already, and I have the feeling that Mocket APIs got more complicated than they were before, instead of being simpler and cleaner. |
heya, sorry for the radio silence, I've just been to busy. again, I'm sorry for a PR this big and drastic, i got carried away 🙈 I'll try to explain my thought process behind this PR.
my thinking is, that the old interfaces could eventually get deprecated and removed, thus they are already well isolated. could you elaborate on where you feel like the apis got more complicated instead of simpler and cleaner? |
I am also quite busy these days, no worries. I think there is still a complete - or at least partial - misunderstanding of what Mocket is and what is shipped with its package. Mocket was designed to be a low-level framework for developing mocks of any kind of server implementing socket protocols. To prove that it does its job, it ships a complete HTTP mock (similar to HTTPretty) and a non-complete Redis one. |
In other words, they are not OLD interfaces, they are products made with Mocket's core. |
let's identify the things in this PR that you like, so that we can find a path forward, and remove the things you don't like :) |
We could apply the first two points: moving core's code to |
I'm sorry, this went a "little" overboard 🙈
So I am opening this PR as a draft, to discuss with you what you think.
I refactored the entry, request and response classes to be ABCs and went from there.
This gets us to almost fully typed, introduces new apis, but keeps all old apis available and cleanly marked as backwards-compat.
I have no good idea to split this up in multiple sensible commits.I split this PR intro (hopefully) easy to follow, individually working commits.