You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I really like how you wrote this library, but there are two minor things i would love to be improved when it comes to the modules type signatures you provided. Hope you don't mind me joining these two suggestions into one issue instead of creating two, but i felt this was more appropriate.
The first is to describe the output of the stat family of functions with TypedDicts, which allows static type checkers to get more information on the expected keys. Unfortunately they have been introduced in python 3.8, but if you want to continue supporting 3.7 they can be conditionally replaced with the same alias you are currently using.
The second small change i would really like is to make the Client and Job classes generic based on if the job bodies have been decoded or not, which will prevent type checkers from thinking each individual job can have a body which is either a string or bytes, while its effectively decided when the Client class is created. An additional bonus is that this can accommodate possible future changes to allow custom serializatiors and deserializators.
These changes shouldn't take long to implement and i can do have done so if you want.
The text was updated successfully, but these errors were encountered:
MinekPo1
added a commit
to MinekPo1/greenstalk
that referenced
this issue
Mar 11, 2025
- `Client` and `Job` are now generic, indicating the type of the job
body (only on the python side)
- on python 3.8 and above, use `TypedDict`s for the return value of the
`stat` family of functions
see justinmayhew#14 (on github.com:justinmayhew/greenstalk) for motivation and more
verbose description
Hi! I really like how you wrote this library, but there are two minor things i would love to be improved when it comes to the modules type signatures you provided. Hope you don't mind me joining these two suggestions into one issue instead of creating two, but i felt this was more appropriate.
The first is to describe the output of the
stat
family of functions withTypedDict
s, which allows static type checkers to get more information on the expected keys. Unfortunately they have been introduced in python 3.8, but if you want to continue supporting 3.7 they can be conditionally replaced with the same alias you are currently using.The second small change i would really like is to make the
Client
andJob
classes generic based on if the job bodies have been decoded or not, which will prevent type checkers from thinking each individual job can have a body which is either a string or bytes, while its effectively decided when theClient
class is created. An additional bonus is that this can accommodate possible future changes to allow custom serializatiors and deserializators.These changes shouldn't take long to implement and i
can dohave done so if you want.The text was updated successfully, but these errors were encountered: