Skip to content

Use type-hints for all function arguments & return values #39

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

Closed
igalic opened this issue Aug 28, 2017 · 12 comments
Closed

Use type-hints for all function arguments & return values #39

igalic opened this issue Aug 28, 2017 · 12 comments

Comments

@igalic
Copy link
Collaborator

igalic commented Aug 28, 2017

Since we're already using Python 3.6, we should consider also specifying all our input parameters with input & return types.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@gronke gronke added the chore label Aug 28, 2017
@gronke
Copy link
Member

gronke commented Aug 28, 2017

@igalic
Copy link
Collaborator Author

igalic commented Aug 28, 2017

oh, interesting! i thought (PEP 484 -- Type Hints)[https://www.python.org/dev/peps/pep-0484/) was all we needed

@gronke
Copy link
Member

gronke commented Aug 28, 2017

Same syntax! Let's do it.

@skarekrow
Copy link
Contributor

They work in concert :D and yay yes this was on my table for "eventually", very happy to see this being worked on 👍

@igalic
Copy link
Collaborator Author

igalic commented Aug 29, 2017

how about formally extending CONTRIBUTING.md with #42, to say that no functions are to be added without a type signature?

@skarekrow
Copy link
Contributor

ba62e1f done

@igalic
Copy link
Collaborator Author

igalic commented Aug 29, 2017

💜

@araujobsd
Copy link

The first goal of mypy was to be an alternative to Python language, something like pypy but with different purpose. The main design wasn't to be a test tool! ;)

I would discourage you to use it, it will add more complexity to the project as well as additional confusion.
Also, I can't see a real benefit of it, and plus it is an experimental project.

Stick with pure python is the right thing to do, force contributors to implement something that is not standard in the market is just a big "no go".

I would revert this commit too: ba62e1f

@igalic
Copy link
Collaborator Author

igalic commented Sep 1, 2017

i thought that part of the reason for choosing python 3.6 was so that the project could make full use of the new language features, including types. mypy is a crutch here, and i would rather revert adding that, than adding types

@araujobsd
Copy link

You can do full use of Python 3.6; but, include an external dependency that is in experimental stage, doesn't sounds good for several reasons: maintainability, interdependence, stability and plus I can't see what improvements it can bring to the project, but it only adds more complexity.

For me it is not clear what problem you are trying to solve here using mypy. So, I'm totally against to include mypy in this project, if there is not a technical debt or a serious problem to be solved.

@igalic
Copy link
Collaborator Author

igalic commented Sep 4, 2017

a first big slew, or rather, the ground-work! has now been laid with the merging of #54.
Thanks to everyone who's helped out here — in particular, @gronke, who did a lot of debugging with me.

You too can help out with this issue! take a look at mypy --strict libiocage/ and choosing, and following a thread. start adding types, validate with mypy libiocage until it comes back clean.

igalic added a commit that referenced this issue Sep 24, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
igalic added a commit that referenced this issue Sep 24, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
@igalic igalic added this to the Stability and Performance milestone Sep 25, 2017
igalic added a commit that referenced this issue Sep 25, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
igalic added a commit that referenced this issue Sep 27, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
igalic added a commit that referenced this issue Sep 30, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
igalic added a commit that referenced this issue Oct 4, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
igalic added a commit that referenced this issue Oct 6, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
gronke pushed a commit that referenced this issue Oct 8, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
gronke pushed a commit that referenced this issue Oct 8, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
igalic added a commit that referenced this issue Oct 11, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
gronke pushed a commit that referenced this issue Oct 21, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
igalic added a commit that referenced this issue Oct 21, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
gronke pushed a commit that referenced this issue Oct 21, 2017
This patchset addresses #39.

we've now added the entire (default) config of flake8-mypy.
The following options deviate from their default (which gets us a step
closer to mypy --strct)

- ignore_missing_imports=False
- follow_imports=True
- cache_dir=.mypy_cache
- disallow_untyped_calls=True
- warn_return_any=True

We've also toggled these two:

- warn_redundant_casts=True
- warn_unused_ignores=True

Finally, we check for

- check_untyped_defs=True

For the full --strict set, we'd also need:

- disallow_untyped_defs=True

But that, we'll need better typedefs.
@gronke
Copy link
Member

gronke commented Oct 2, 2018

Strong typing is established in the entire library.

@gronke gronke closed this as completed Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants