OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Implement strict type checking and add missing type hints

Open jannikwinghart opened this issue 1 year ago • 8 comments

Summary Implement strict type checking for backend and add missing type hints

Motivation Most parts of the backend already have type hints. Having complete type hints everywhere is required by (or at least supports) future improvements like autogenerated diagrams and documentation. Also it can increase the understanding of the code and improve code quality & consistency.

To achieve consistent type checking everywhere it is neccessary to add a type checker / linter to the CI pipeline / pre-commit hooks.

Technical Design

  • Add a type checker / linter to the CI pipeline / pre-commit hooks.
  • Add missing type hints / fix all existing findings of the type checker to have a clean baseline

Alternatives to Consider Alternative is to not add a type checker (yet), to keep a low barrier of entry for new commits (conflict: development speed vs. code quality)

Additional context Tools like py2puml rely on type hints to generate code diagrams for documentation, and require manual modifications if the type hints are not correct/complete

jannikwinghart avatar Mar 30 '24 19:03 jannikwinghart

This would also be a good first issue, as it doesn't require deep understanding of the project

jannikwinghart avatar Mar 30 '24 19:03 jannikwinghart

👍 agree, this would be great

rbren avatar Mar 30 '24 23:03 rbren

This issue doesn't seem to be in development yet. I'm ready to take it on. I guess some confirmation from the team is needed?

omutist avatar Apr 01 '24 10:04 omutist

Go for it!

rbren avatar Apr 01 '24 14:04 rbren

This issue doesn't seem to be in development yet. I'm ready to take it on. I guess some confirmation from the team is needed?

Hey Omut, it seems the issue can be broken up into multiple parts. Can I join you in developing this?

therohanrao avatar Apr 02 '24 20:04 therohanrao

Can I join you in developing this?

Hi @therohanrao I'm actively working on type checking with mypy. You can take linter part - ruff is already configured in CI, not sure about pre-commit hooks.

omutist avatar Apr 02 '24 23:04 omutist

https://github.com/OpenDevin/OpenDevin/pull/958

omutist avatar Apr 10 '24 00:04 omutist