question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC: Use type hints in larq source code

See original GitHub issue

Objective

Python 3.6 and above supports type hints and optional statically typing of Python code. Since its introduction is has seen a lot of adoption in many Python projects in particular in larger code bases. Type hints are completely optional and are stripped by the Python parser before runtime.

I am not the only one @plumerai anymore who likes type hints for Python and we only support Python 3.6+ already so I’d like to discuss if we should introduce type hints to the larq code base. I have never used typings in a big project, but below is a list of some pros and cons I can think of on top of my head.

Pros

  • Makes it easy to reason about the code due to the self documenting nature of statically typed functions
  • Helps with code review
  • Can catch subtle bugs of in places of insufficient code coverage
  • Has good integrations for editors that help with autocomplete and linting

Cons

  • TensorFlow doesn’t use type hints so I don’t know how well type stubs are maintained
  • Needs additional setup on CI and to maintain type stubs
  • Might be confusing for novice Python users since it adds new syntax to the larq code base

Tooling

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
AdamHilliercommented, Jan 10, 2020

Sounds like a great idea! One small remark: as TensorFlow currently doesn’t have typehints I would prefer to keep all examples provided in the documentation free of typehints, so as to not raise the threshold for users who are not familiar with them.

The most important thing is for the external API to have type hints so that this gets picked up in editors/IDEs; any private methods or tests don’t need them, and examples definitely don’t.

2reactions
lgeigercommented, Jan 14, 2020

Just for reference TensorFlow Addons is also looking into introducting type checking: https://github.com/tensorflow/addons/issues/743

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · larq/larq - GitHub
RFC : Use type hints in larq source code good first issue Good for newcomers internal-improvement Internal Improvements and Maintenance RFC - accepted ......
Read more >
RFC 7594: A Framework for Large-Scale Measurement of ...
Several use cases have been proposed for large-scale measurements including: ... Data Model: The implementation of an Information Model in a particular data ......
Read more >
Use of BGP for Routing in Large-Scale Data Centers RFC 7938
This document summarizes operational experience in designing and operating large-scale data centers using BGP as the only routing protocol.
Read more >
ITU-T Rec. G.9954 (02/2005) Phoneline networking transceivers
Summary. This Recommendation defines the PHY, MAC, LINK and CONVERGENCE protocol stack layers for the G.9954 system providing the following features:.
Read more >
tr-181-2-13-0-usp.xml
Redistribution and use in source and binary forms, with or without ... [RFC7398], RFC 7398, A Reference Path and Measurement Points for Large-Scale ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found