Pysyft: Type annotations for pysyft

Created on 28 Aug 2018  路  21Comments  路  Source: OpenMined/PySyft

Issue Template

Context

User Story:

As a Developer of PySyft

I would like to know what the type of various parameters are when looking at the code. Since python now has a typing module, we should add type annotations to track the type of various parameters to ease development

Expected Behavior

Every method has correct type annotations and running mypy on the repository passes

Current Behavior

no methods have type annotations

Good first issue Help Wanted

All 21 comments

Hello, I guess I can start working on this if it's not assigned to anyone already 馃槉

This is also a great first project - although I suspect it will take the collective action of several! Feel free to submit Pull Requests as you make progress (doesn't have to solve the whole issue in one go)

Sure, That would be fun to be working with 馃槉

Hey @abdulrahmanmazhar - how it's going?

@iamtrask Hello, Indeed I'm sorry to say that I didn't get much of a progress since I was having some assignments for 2 interviews, But I was considering using "pyannotate" and some manual typing so hopefully I will get some progress and will push it up as a PR very soon, Really sorry about the delay :smile:

Feel free to do incremental Pull Requests :) - like... even if you only add type in one or two places in one file... just go ahead and PR it.

Sure and thank you a lot :)

Hey @abdulrahmanmazhar - are you on OpenMined's slack? If so, what's your username? (i'm @trask). If now - would you be willing to join so we can have a quick chat? (slack.openmined.org)

Hey @iamtrask indeed no I'm not and sure that would be my pleasure :)

Mypy requires stub files for msgpack, numpy, pandas and setuptools. I wanted to add those, but it's not working for me on the first try. I will continue only if there's no one else working on this already (@abdulrahmanmazhar ?). We need to be careful about the stub licenses.

@replomancer actually I'm not working on it at the moment so you are more than welcome to start working on it and it's my pleasure to help you as well if you needed something i can do :smile:

OK, I'll take care of the stubs.

I only added a numpy stub file. Other ones are currently not easy to find, but may become easily available at some point. I set ignore_missing_imports to True in mypy.ini, so mypy will not complain about external libraries now.

Hello @iamtrask, @robert-wagner ,

I am new to OpenMined.

I made an attempt to contribute to this issue, just a few type annotations to syft/workers/virutal.py.

Can I submit a PR?

Thanks

Yes sure go ahead! :)

Cool, here it is #1962

@robert-wagner @iamtrask I am planning on doing some further work on this issue, and I noticed that .mypy_cache/ was removed from .gitignore in ab6c727c877019640342d3297e9a86028487cce9. I also can't locate a lot of the work done in https://github.com/OpenMined/PySyft/pull/1641.

Does this mean we're moving away from using mypy?

UPDATE: mypy stubs files were deleted in 1721cfee916dbcfc5fe951a8b31ae48d4a5639b2

Small PR that would hopefully help a bit with this issue: https://github.com/OpenMined/PySyft/pull/1994

Hey @MarcioPorto It looks like that pr was made to the torch 0.3.1 branch and never made it into the torch 1.0 branch. Would be happy to have mypy support

Awesome, I'll work on bringing that back (unless @replomancer wants to do it) and add some new annotations.

Closing issue as

  • type annotations now used in PySyft code
  • inactivity
Was this page helpful?
0 / 5 - 0 ratings

Related issues

alberduris picture alberduris  路  3Comments

swaroopch picture swaroopch  路  4Comments

gmuraru picture gmuraru  路  4Comments

MetaT1an picture MetaT1an  路  3Comments

samsontmr picture samsontmr  路  3Comments