• Thursday

    • Lots of private work.
    • NBA trade deadline. All official transactions here: https://www.nba.com/players/transactions
    • Laser tag at Area 53 in DUMBO.
    • Updated my address (nyc) and payment method (zelle) in the class action for: Yahoo Data Breach Settlement.
    • Watched knock at the cabin. I love single setting movies.
    • Keyboard was working ok today after ~24hrs of drying. I still wanted a new one anyway, so I’ll leave the V2 brown as my backup and set V3 blue as my primary.
    • SBSC. Typechecked and annotated the whole package.
    • https://gitlab.com/bmahlstedt/supercontest/-/issues/183
    • Compared mypy, pytype, pyre, and pyright. Ultimately chose the latter. Has inference, supports py3.11, doesn’t ship with a bunch of deps, and very popular.
    • Used pylance vscode extension (pyre-vscode for pyre).
    • All of these use python’s native typeshed under the hood: https://github.com/python/typeshed
    • All speak LSP (language server protocol), the bridge between the IDE and the running code (provides autocompletion, typechecking, etc). Eg between vscode and a python executable.
    • The pyright cli uses Node.
    • Type stubs are .pyi files. They’re the public contract for a python file.
    • You may run pyright --createstub <import> to generate the stubs, or in vscode just hover->quickfix->createstub. They’re organized by module.
    • The default stubpath is ./typings. If that doesn’t exist, it will try to infer from code usage (if useLibraryCodeForTypes = true). This should be committed to VCS.
    • Some third-party packages ship with them, some don’t. Some have a separate <pkg>-stubs (I don’t like that, just ship with the pkg), some have no typings at all (and you have to generate them for the interfaces that you use, if desired).
    • For first-party packages, you shouldn’t need stubs. Your code should be directly annotated with types. You may do this with the same process as the above, by using pyright to generate the stubs, and then using another tool like merge-pyi or libcst to autoannotate your code from the types in the stubs. But you have direct access to the code – it’s usually best to go through and just incrementally add annotations.
    • Went through and started with very lenient scope, then slowly ratcheted the strictness while adding annotations and fixing bugs.