Add PEP 484 type annotations to orbit/utils/ modules

Open
#892 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python

Research direction

For the first PR, read orbit/utils/general.py and identify its public functions. Add PEP 484 annotations using Python 3.9+ syntax and future annotations without changing logic. Done means the public functions in general.py are annotated; extend the same approach to the remaining orbit/utils/ modules only after feedback.

Written by the indexing model from the issue text.

Description

enhancement

Is your feature request related to a problem? Please describe.
I have been exploring the codebase and noticed that orbit/utils/ has no type annotations across most of its modules (the only exception is logger.py). As someone trying to contribute, I found myself constantly jumping between files to figure out what types functions expect and return, especially for the NumPy/Pandas-heavy ones.

Describe the solution you'd like
Add PEP 484 type annotations to the public functions in orbit/utils/. I did a quick audit and found 28 functions across 8 files missing annotations. I would like to contribute these as a series of small PRs, starting with general.py.
Approach I would follow:

  • Python 3.9+ built-in generics (list[str] not List[str])
  • from __future__ import annotations for the | union syntax on Python 3.9
  • no logic changes whatsoever, annotations only

Describe alternatives you've considered
just documenting types in docstrings but that doesn't help with static analysis or IDE support, which is half the value here.

Additional context
im happy to start small with just general.py and adjust my approach based on feedback before going further.

Dominant language
Python
Stars
2.1k
Forks
147
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uber/orbit

All issues in uber/orbit

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.