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

feat: add type hints to core lib #71

Merged
merged 25 commits into from
Mar 13, 2024

Conversation

tushar5526
Copy link
Contributor

@tushar5526 tushar5526 commented Dec 5, 2023

Related to #40

@tushar5526 tushar5526 marked this pull request as draft December 5, 2023 20:18
@tushar5526 tushar5526 marked this pull request as ready for review December 7, 2023 16:48
@tushar5526
Copy link
Contributor Author

Hey @khvn26 @matthewelwell can you run the workflows, please :)

@dabeeeenster
Copy link
Contributor

Thanks so much! one of the team will take a look

Copy link
Contributor

@zachaysan zachaysan left a comment

Choose a reason for hiding this comment

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

Hey @tushar5526 thanks a lot for putting this review together.

I'm on the Flagsmith team, but I haven't touched this repository before, so I can't run the workflows you requested from Kim and Matt. They're heads down for a project for the next week, but I'll see if someone else can run the workflows and maybe we'll get lucky.

I've added a bunch of review comments, but please keep in mind that I don't have full visibility on this project.

Feel free to push back on any of them that don't make sense 😄

flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
tests/test_flagsmith.py Outdated Show resolved Hide resolved
flagsmith/__init__.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/polling_manager.py Outdated Show resolved Hide resolved
flagsmith/utils/identities.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/flagsmith.py Outdated Show resolved Hide resolved
flagsmith/models.py Outdated Show resolved Hide resolved
flagsmith/models.py Outdated Show resolved Hide resolved
flagsmith/models.py Outdated Show resolved Hide resolved
flagsmith/models.py Show resolved Hide resolved
flagsmith/models.py Outdated Show resolved Hide resolved
@khvn26
Copy link
Member

khvn26 commented Dec 20, 2023

@tushar5526 Let us know if you need help merging this — we're working on a task involving the Python client and would love to include typing in the next release.

@tushar5526
Copy link
Contributor Author

@khvn26 thanks, I will probably get sometime this weekend before I work on this :)

@tushar5526
Copy link
Contributor Author

Hey @khvn26 @matthewelwell Happy New Year! Need some help with Python 3.8 and 3.9. Got an issue with inheritance in dataclasses. Flag and DefaultFlag are child dataclasses inheriting from BaseFlag dataclass. To override the is_default member with a default value we would have to use kw_only, but it's only available in Python >= 3.10. Couldn't find a workaround for lower versions. Thinking we might have to stick with using init in subclasses (as done earlier in code). Any ideas or workarounds that you folks are aware of?

@khvn26
Copy link
Member

khvn26 commented Feb 7, 2024

Hey @tushar5526! The good solution to this is to define the field individually in the subclasses. I've done it in my PR here: https://github.com/Flagsmith/flagsmith-python-client/pull/72/files#diff-90b21583a0688d12b6b9a8d2970969907e7d49546b5f953ac1cfb61d14111518

The PR I've linked to is ready to merge. I suggest you rebase #71 on the main branch after #72 is merged. Other than that, there's one outstanding comment that needs resolving. After that we'll finally merge your PR 👍

@matthewelwell
Copy link
Contributor

@tushar5526 apologies for the delay on this but could you take a look at the failing unit tests or would you like one of us to pick it up?

@tushar5526
Copy link
Contributor Author

@matthewelwell I forgot about this, was waiting for #72 to be merged. I believe I can rebase on top of it and fix the tests.

@matthewelwell
Copy link
Contributor

@khvn26 can we merge #72 ?

@khvn26
Copy link
Member

khvn26 commented Mar 7, 2024

@matthewelwell @tushar5526 #72 merged! Feel free to rebase and fix stuff!

@tushar5526
Copy link
Contributor Author

Fixed!

@khvn26
Copy link
Member

khvn26 commented Mar 12, 2024

@tushar5526 Hello again! I've just rebased the actual target branch on latest main. Hate to ask you, but could you rebase your branch again?

@tushar5526
Copy link
Contributor Author

Fixed the conflicts.

@khvn26 khvn26 merged commit 21eb873 into Flagsmith:feat/mypy Mar 13, 2024
4 checks passed
khvn26 added a commit that referenced this pull request Mar 13, 2024
* feat: add mypy, update tooling

* feat: add type hints to core lib (#71)

---------

Co-authored-by: Tushar <[email protected]>
Co-authored-by: Zach Aysan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants