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

Added some type hints #354

Merged
merged 3 commits into from
Mar 17, 2020
Merged

Conversation

bartekpacia
Copy link
Contributor

@bartekpacia bartekpacia commented Dec 29, 2019

Description

I added type hints to (files listed in commit message). I have a few questions though:

  • do we want type hints on every single method? Like, make it required?
  • if method returns None, should it also be typehinted?

Also, I'm not sure how should I typehint objects returned by TasksListModel.find_by_id().

When a mentors accepts proposed changes and answers questions listed above, I'll be very happy to typehint whole codebase :)

Fixes #331 (as of now, partly)

Type of Change:

  • Code
  • Documentation

Code/Quality Assurance Only

  • New feature (non-breaking change which adds functionality pre-approved by mentors))

How Has This Been Tested?

Type hints don't have runtime impact, but just to make sure I run all the tests. And CI is passing, too.

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Code/Quality Assurance Only

  • My changes generate no new warnings
  • My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

* run.py and config.py

* app/database/models
@bartekpacia
Copy link
Contributor Author

@isabelcosta Could I get some feedback and answer to my questions? I'd really like to add those type hints :D

@isabelcosta
Copy link
Member

@isabelcosta Could I get some feedback and answer to my questions? I'd really like to add those type hints :D

You can submit the PR with that :) I haven't received any response either, and couldn't bring this to a Community Open Session either. Once I get the chance I'll ask about the community standards, where they stand.

@bartekpacia
Copy link
Contributor Author

That's great! Thanks for a fast response :)

@isabelcosta
Copy link
Member

@bartekpacia as I am catching up on PRs, I noticed this very important issue. I got more informed about this Python feature that I was not aware of and think it would be a great addition to the project.

Since this has so many merge conflicts, would you like to fix them or leave this issue for other contributors? I was thinking of creating sub-issues per file or per feature or per domain, to make this change into type hints easier to manage and review.

What do you think? I am totally fine if you choose not to continue with this and then I'll create smaller issue to make this transition.

@bartekpacia
Copy link
Contributor Author

@isabelcosta I'll try to fix the conflicts in this PR. You can then open some issues requesting to add type hints to the rest of the project.

@isabelcosta
Copy link
Member

Oki! Sounds good @bartekpacia , let me know once you fix it so I can review this :) And then I'll create type hint issues for what is missing.

@isabelcosta isabelcosta added the Category: Coding Changes to code base or refactored code that doesn't fix a bug. label Mar 15, 2020
@bartekpacia
Copy link
Contributor Author

@isabelcosta Resolved conflicts :)

@isabelcosta
Copy link
Member

thank you so much @bartekpacia

Copy link
Contributor

@ramitsawhney27 ramitsawhney27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thank you for this, learned something new here!

Copy link
Member

@isabelcosta isabelcosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :) Thank you so much for proposing this enhancement in the app and implementing part of it here in the PR @bartekpacia 🎉

@isabelcosta isabelcosta merged commit 877d4e2 into anitab-org:develop Mar 17, 2020
@isabelcosta isabelcosta mentioned this pull request Mar 17, 2020
3 tasks
b-thebest pushed a commit to b-thebest/mentorship-backend that referenced this pull request Mar 2, 2021
* chore: added typings in
* run.py and config.py
* app/database/models
* added type hints to app/api/dao
RiddhiAthreya pushed a commit to RiddhiAthreya/mentorship-backend that referenced this pull request Jul 1, 2021
* chore: added typings in
* run.py and config.py
* app/database/models
* added type hints to app/api/dao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Coding Changes to code base or refactored code that doesn't fix a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type hints
3 participants