Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Add LiteLLM Type stubs for mypy #360

Closed
ishaan-jaff opened this issue Sep 13, 2023 · 5 comments · Fixed by #3925
Closed

[Feature]: Add LiteLLM Type stubs for mypy #360

ishaan-jaff opened this issue Sep 13, 2023 · 5 comments · Fixed by #3925
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ishaan-jaff
Copy link
Contributor

The Feature

Request from @nsbradford on this

Motivation, pitch

-

Twitter / LinkedIn details

No response

@ishaan-jaff ishaan-jaff added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Sep 13, 2023
@Rohxn16
Copy link

Rohxn16 commented Oct 22, 2023

can I get some more info on exactly what to do here? I wanna work on this issue.

@nsbradford
Copy link

You can start by adding type hints to this project and using mypy in CI to check this project's type safety 😄
https://chat.openai.com/share/e531e4b3-0257-4adf-93b2-bc4318c28f5f

@mikeslattery
Copy link
Contributor

A quick thing you can do is simply create a file called litellm/py.typed. The contents don't matter, it's a marker file.

I get this error when I run mypy app.py:

app.py:17: error: Skipping analyzing "litellm.utils": module is installed, but missing library stubs or py.typed marker  [import-untyped]
app.py:17: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

Which I was able to workaround with:

touch venv/lib/python3.12/site-packages/litellm/py.typed

A better method is to generate library stubs, *.pyi. They speed up mypy analysis. They can be generated with stubgen, but I've not done it before.

@ishaan-jaff
Copy link
Contributor Author

ishaan-jaff commented May 28, 2024

@mikeslattery We'd love a PR on this if possible . Will give you a shoutout on release notes too

mikeslattery added a commit to mikeslattery/litellm that referenced this issue May 30, 2024
@mikeslattery
Copy link
Contributor

@ishaan-jaff Done. Someone else already did it in a more complex PR. See my PR description.

mikeslattery added a commit to mikeslattery/litellm that referenced this issue May 30, 2024
ishaan-jaff added a commit that referenced this issue Jun 7, 2024
feature - Types for mypy - issue #360
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants