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

fix: resolve type hint issues and import dependencies #1176

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

leseb
Copy link
Contributor

@leseb leseb commented Feb 20, 2025

What does this PR do?

  • Fixed type hinting and missing imports across multiple modules.
  • Improved compatibility by using TYPE_CHECKING for conditional imports.
  • Updated pyproject.toml to enforce stricter linting.

Signed-off-by: Sébastien Han [email protected]

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 20, 2025
@leseb
Copy link
Contributor Author

leseb commented Feb 20, 2025

Will rebase once #1174 merges so that pre-commit will pass!

from typing import List
from typing import TYPE_CHECKING, List

if TYPE_CHECKING:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeehaaaw!

@@ -19,6 +19,8 @@
# Import necessary components from Matplotlib
from matplotlib.backends.backend_agg import FigureCanvasAgg

from llama_stack.providers.inline.tool_runtime.code_interpreter.code_env_prefix import _open_connections
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually not correct. the _open_connections method is dynamically made available to the interpreter by bundling code from "code_env_prefix.py" -- by literally prefixing it -- and then "eval"ing it within a sandboxed interpreter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -231,7 +231,7 @@ def worker_process_entrypoint(
while True:
try:
task = req_gen.send(result)
if isinstance(task, str) and task == _END_SENTINEL:
if isinstance(task, str) and task == EndSentinel():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait what? this was just referencing some unknown symbol?! 🤦

- Fixed type hinting and missing imports across multiple modules.
- Improved compatibility by using `TYPE_CHECKING` for conditional
  imports.
- Updated `pyproject.toml` to enforce stricter linting.

Signed-off-by: Sébastien Han <[email protected]>
@ashwinb ashwinb merged commit c223b18 into meta-llama:main Feb 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants