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.

We should add typings to manim:

  1. It allows for more precise intellisense and easier-to-check code (via mypy and whatnot);
  2. It ensures we follow a structure that makes sense (i.e., ensures we don’t have a data model in which people get completely lost);
  3. Writing documentation and specifying types are tied to each other. When we work on documentation, it is inevitable that we will specify types for things, so why not add it to the code as well?

Notes:

  1. We can use stubgen to have a headstart;
  2. We can use stub files in order to keep typings separate from the code and not have to change things much (but this is debatable - please expose your opinions on this);
  3. This is very related to the dataclasses solution proposed in #7, and may ultimately be a consequence of it.

Thoughts?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:23 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
PgBielcommented, Oct 12, 2020

@PgBiel I meant having in-code and not having in-docstring.

got it

What is the benefit of having both? All I could think of is that a user reading the docs might not get the full benefit from in-code, but if Sphinx can be configured to parse in-code and show those to the user, then why bother?

if we can configure that, then it should be fine The only thing that we have to note is that, at the moment, we aren’t adding typehints in code, so they must be added in docstring for now Then a future typings PR may move them from the docstring to the code, and we may have simpler docstring types.

1reaction
behacklcommented, Sep 15, 2021

Seems like this never went anywhere? Bit of a shame. Makes it way harder to learn for beginners.

It’s work in progress. Type hints have been added to some parts of the library; help for adding them to other parts is warmly welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add custom "typings" in typescript 2.0 / 3.0
You can create local custom typings just for your project, where you can declare types for JS libraries. For that, you need to:....
Read more >
How to add custom types into the TypeScript project - drag13.io
Tutorial how to add custom types (typings) for the third-party code into the TypeScript project or how to solve "could not find a...
Read more >
TypeScript: Adding Custom Type Definitions for Existing ...
In these circumstances, you have to add your own custom type definitions for the libraries. This article will show you how to that....
Read more >
Typescript Typings: The Complete Guide: @types Compiler ...
Typescript Typings - The Complete Guide To Type Definitions: @types, ... With ts-node installed, let's add a npm script task to run our...
Read more >
Adding Custom Type Definitions to a Third-Party Library
Add an index.d.ts file with your typings into that folder: types/third-party-library-name/index.d.ts. 5. Add your type definition.
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