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

[DX] make mypy run in the IDE (VSCode) #215

Open
mikeldking opened this issue Feb 15, 2024 · 1 comment
Open

[DX] make mypy run in the IDE (VSCode) #215

mikeldking opened this issue Feb 15, 2024 · 1 comment
Labels
enhancement New feature or request language: python Related to Python integration

Comments

@mikeldking
Copy link
Contributor

Right now because of the sub-moduling, mypy (and ruff?) fail to run via IDE plugins. This is critical for fast development flow.

Copy link

dosubot bot commented Feb 15, 2024

🤖

Hey @mikeldking! Great to see you back here, diving into the depths of code with us. How's the coding universe treating you?

To configure mypy to run in your VSCode IDE, you can follow these steps:

  1. Install the mypy extension for VSCode. You can do this by searching for "mypy" in the Extensions view (Ctrl+Shift+X) and installing the one by "matangover".

  2. Configure the mypy extension to use your mypy.ini file. To do this, open your settings.json file (File > Preferences > Settings, then search for "settings.json" and click on "Edit in settings.json"). Add the following lines:

"python.linting.mypyEnabled": true,
"python.linting.mypyArgs": [
    "--config-file=${workspaceFolder}/python/mypy.ini"
],

This tells the mypy extension to enable linting and to use your mypy.ini file for its configuration.

  1. Save your settings.json file and restart VSCode. Now, mypy should run automatically in your IDE using the configuration from your mypy.ini file.

Please note that the path to the mypy.ini file in the "config-file" argument should be adjusted if your mypy.ini file is located in a different directory. The "${workspaceFolder}" variable refers to the root directory of your current workspace.

As for the sub-moduling, the OpenInference codebase, specifically the openinference-instrumentation-openai package, contains several sub-modules. These include the OpenAIInstrumentation class, the InstrumentationNodeModuleDefinition, and several helper functions. The OpenAIInstrumentation class is responsible for initializing the instrumentation, patching and unpatching the OpenAI module. The InstrumentationNodeModuleDefinition is used to define the module that needs to be instrumented. The helper functions are used to handle specific tasks such as checking the type of a response, getting attributes from a request, and getting output attributes from a result.

If you're still having trouble getting mypy to run in your IDE, please provide more details about the issues you're encountering so I can assist you further.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added bug Something isn't working enhancement New feature or request language: python Related to Python integration labels Feb 15, 2024
@mikeldking mikeldking removed the bug Something isn't working label Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request language: python Related to Python integration
Projects
Status: 📘 Todo
Development

No branches or pull requests

1 participant