-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Start adding type annotations to gunicorn #2377
base: master
Are you sure you want to change the base?
Conversation
24e2bc7
to
ed593d4
Compare
See issue benoitc#2374 and issue benoitc#1393
ed593d4
to
88bc887
Compare
Hi guincorn developers! First of all: A big thank you for gunicorn 🤗 I've used it for several projects and never had to think a lot about that part :-) I'm currently annotating a code base and noticed that gunicorn does not have type annotations, sooo ... here you are :-) As I'm not familiar with the codebase, this will require some work and help of people who know gunicorn. In case you want to read more about type annotations: I wrote an article :-) How to get type annotationsThis is how I would like to go forward and add types to gunicorn:
Impossible at the moment
|
I see a lot of linting errors. I'm used to the |
No autoformatter is and will be used. (one readon is to keep some flexibility). If you see any pep8 issue, let's fix them in a separate commit :) |
I meant at the project level. I need to publish some style rules so anyone can adapt their auto-formatter in a way we keep the code readable and not increasing that much the number of lines like some formatter do... If you use one in your env, just make sure to apply the change on a separate commit :) |
56d831f
to
68875d6
Compare
I applied
Current:
Black:
I think yapf would support the current style, but I'm not familiar with yapf. |
@benoitc I guess you are busy with other task, but just to make it clear: I'm waiting for feedback. From my side, this PR could be merged. Once it is merged, I will try to add mypy to the CI pipeline :-) |
@benoitc Did you have the time to have a look at the PR? |
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 support the idea of adding type annotations. It would be nice to reduce the number of Any declarations. For example, the workers dict is Dict[int, Worker]
and the pipe pair is a [socket, socket]
tuple.
It is always preferable to separate style changes from other changes, so it would be nice to take the auto-formatting commit out of this PR. I support auto formatting, but we shouldn't apply it in this PR, and it sounds like @benoitc would need some more convincing.
46e2cdf
to
06f1b71
Compare
@tilgovi I've added the more specific type annotations you mentioned and undid the changes black did to config. I've only applied black to that file and that is also where most of the type annotations were added. |
@tiangolo Is there anything blocking this PR? |
@benoitc Is there anything blocking this PR? |
I still like this idea and would love to add type annotations. I would prefer to use the annotation syntax, rather than comments, now that Gunicorn is Python 3 only. I'll ping people directly to see if I can get some consensus from folks about starting to add these types. |
Pls don't forget the Also, partial stuff (like merging this MR) is better than no stuf Also related to #2833? |
I didn't get any feedback for over 3 years. I'm not going to put more effort in this. |
That is ... very respected ❤️ |
See issue #2374 and issue #1393