feat: add Type hints for examples/dp_logistic_regression.py and examples/jax_api_example.py#130
Conversation
examples/dp_logistic_regression.pyexamples/dp_logistic_regression.py and examples/jax_api_example.py
|
@ryan112358 the CI lint error as of now is failing for pyink I am awaiting on the pyink issues to be fixed for the test files which should be done when #90 merges in after which I'll pull it here. |
ryan112358
left a comment
There was a problem hiding this comment.
Please rebase to head, once you pass the CI checks, we can move onto internal review and merge
|
@ryan112358 Yeah I was waiting for the Pyink formatting for |
…into type-hint-dp_logistic_regression
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #130 +/- ##
=======================================
Coverage ? 71.67%
=======================================
Files ? 25
Lines ? 2655
Branches ? 0
=======================================
Hits ? 1903
Misses ? 752
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@ryan112358 Have resolved the CI issues. Now it's only up to the copybara check which If I'm not wrong has to be done internally by you guys. |
ryan112358
left a comment
There was a problem hiding this comment.
Hi Neeraj,
Our internal checks show an invalid import order (typing should be moved up to the standard library section). To fix, please run "isort" on your changed files. Bonus would be if you can also update .github/workflows/ci.yml to include an "isort --check" action while you are at it so that this can be caught earlier in the future
|
@ryan112358 CI does fail at the top level for files included in
LMK what would you opt for. |
Thanks for checking, I guess there is some difference in our internal config for isort, so changing the files will break things internally. For now, just revert the the change to ci.yml and manually make the requested change (moving the typing import to the top-level block of imports, in alphabetical order). We will try to figure out internally how we can update ci.yml to be consistent between internal and external import checks. |
works |
|
@ryan112358 wondering if the internal linter has something to say about the import order again. Given that this was fixed prev by |
Still an issue. If you don't change the order or structure of existing imports, the internal check should pass. So please revert the recording to that. All you have to do is put the new imports in the correct locations. The generally structure is
|
|
Before adding a change intending to order the imports this way:- from typing import Any, Mapping, Tuple
from absl import app
import jax
import jax.numpy as jnp
import jax_privacy
from jax_privacy import batch_selection
from jax_privacy.experimental import execution_plan
import numpy as np
import optaxjust adding the new line at the top of the old order!! |
|
@ryan112358 Thank you for your follow-ups!! Maybe there could be a better way to make these contributions seamless? |
|
NOTE:- Once this PR lands in it should fix the error caused for the CI unit tests for all the open PR's by contributors. |
Progresses #124
This PR adds a type hint for the examples file
dp_logistic_regression.py.Optimizing the function from :-
to:-
similarly for other functions throughout the file.