-
Notifications
You must be signed in to change notification settings - Fork 4
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
[WIP] Adds type checking annotations auto-generated via Instagram's MonkeyType package #108
base: dev
Are you sure you want to change the base?
Conversation
pipenv install MonkeyType --dev pipenv shell monkeytype --verbose run nimbus.py
monkeytype docs: https://github.com/Instagram/MonkeyType *************************************************** pipenv install MonkeyType --dev pipenv shell monkeytype --verbose run nimbus.py ``` $ monkeytype list-modules QA database_wrapper nimbus_nlp.NIMBUS_NLP nimbus_nlp.question_classifier nimbus_nlp.save_and_load_model ``` monkeytype --verbose stub QA monkeytype --verbose stub database_wrapper monkeytype --verbose stub nimbus_nlp.NIMBUS_NLP monkeytype --verbose stub nimbus_nlp.question_classifier monkeytype --verbose stub nimbus_nlp.save_and_load_model monkeytype --verbose apply QA monkeytype --verbose apply database_wrapper monkeytype --verbose apply nimbus_nlp.NIMBUS_NLP monkeytype --verbose apply nimbus_nlp.question_classifier monkeytype --verbose apply nimbus_nlp.save_and_load_model
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.
Quite a fine addition you have here to the code home
EDIT: I just realized this needs a rebase (the tests aren't running)
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.
Rebase, but otherwise looks exquisite
Will do! By the way, what’s a rebase? @Jason-Ku I’ve only ever done “resolve conflicts” |
@mfekadu Here's github's page on rebase There's another page here with some nice ASCII art of some other reasons you might want to use a rebase. Hope this helps 😀 |
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.
Looks good to me, although I agree that a rebase would be nice. Our discussion about git rebase reminds me that we may want to have some more PR documentation or have some kind of github crash course (maybe next fall, it would be good for any new members next year to be a part of it).
What's New?
nimbus.py
scriptAwesome Code Talk
How did I do this?
Installing MonkeyType
Running MonkeyType, which generates a
monkeytype.sqlite3
Then I asked 2 simple questions "What is Foaad's email?" and "Who is the contact for Color Coded?"
Checking for what modules MonkeyType explored while the nimbus.py code was running
Telling MonkeyType to generate type annotations
Telling MonkeyType to edit our code and apply the type annotations
Addresses #14 but does not fix
Type of change (pick-one)
How Has This Been Tested?
It has not. Let's not merge this until we have tests to verify the same functionality.
However, the auto-generated type annotations can spark discussion on the functions we have written
For example, the monkeytype annotations of these function arguments mismatch the docstring Args in this
__init__
api/QA.py
Lines 38 to 48 in 41945a0
MonkeyType noticed a string returned from this function when called just once. Is the return value always a string?
api/QA.py
Lines 54 to 55 in 41945a0
Ah, nice! It is reassuring to see the docstring match the generated type annotation
api/QA.py
Lines 71 to 74 in 41945a0
hmm.. interesting type:
DUMMY_NAME
api/nimbus_nlp/NIMBUS_NLP.py
Lines 76 to 86 in 41945a0
Ah, nice! Another return type that seems legit. Or is it? Haha, I hope so!!
+from sklearn.neighbors.classification import KNeighborsClassifier
api/nimbus_nlp/save_and_load_model.py
Line 33 in 41945a0
There's more, check out the files changed. I have not gone through everything.
Checklist (check-all-before-merge)
formatting help:
- [x]
means "checked' and- [ ]
means "unchecked"I documented my code according to the Google Python Style Guide
I ran
./build_docs.sh
and the docs look fineI ran
./type_check.sh
and got no errorsI ran
./format.sh
because it automatically cleans my code for me 😄I ran
./lint.sh
to check for what "format" missedI added my tests to the
/tests
directoryI ran
./run_tests.sh
and all the tests pass