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

LSP server Integration via vscode-python-tools-extension + pivot away from FastAPI to direct ZenML library use #6

Merged
merged 191 commits into from
Mar 27, 2024

Conversation

marwan37
Copy link
Contributor

@marwan37 marwan37 commented Mar 18, 2024

This PR marks a significant architectural evolution, incorporating the vscode-python-tools-extension template to enhance TypeScript and ZenML Python library integration. Going beyond typical LSP functions like linting/formatting, it lays down a proven framework for environment and interpreter detection, and an event-driven structure that improves existing features and prepares for future updates.

Rationale behind the change
Previously, we depended on FastAPI and background shell processes to interact with the ZenML Python library. This raised sustainability concerns and limited flexibility to specific ZenML versions. The new approach mitigates these issues, offers flexibility to use any local ZenML version (minimum version pending), and provides a cleaner, and more maintainable solution.

Credits to @strickvl for discovering the python tools extension and suggesting the integration.

Detailed Changes

New: Python Tool (LSP Server Side)

  • All Python-related LSP files, packages, and code is encapsulated within the bundled/tool directory.
  • Dependencies are listed in requirements.in and managed through nox.
  • Core logic and tool-specific specific setup is in the lsp_server.py file.
  • Additions to the template include:
    • zenml_client.py centralizes ZenML library interactions.
    • zenml_language_server.py extends the pygls LanguageServer to include ZenML version checks and custom notifications.
    • Incorporated watchdog to enable real-time config.yaml monitoring, maintaining extension sync with external ZenML environment or configuration adjustments.

On the TypeScript Side

  • Preserved the core structure within the common directory as recommended by the template.
  • Commands overhauled to interact with the LSP server instead of ZenML's FastAPI server.
  • UI command for pipeline run deletions, and status icons for various pipeline states.
  • Added comprehensive tests to evaluate the new integrations.
  • New integrations include:
    • The LSClient class for Language Server interaction.
    • The EventBus class, an extension of EventEmitter, orchestrates notifications from the LSP server.
    • The ZenExtension class to encapsulate the new extension activation process.

Demo: Syncing CLI ZenML operations with the extension automatically
CLI-Sync-Demo

Demo: Prompts to select python interpreter until the correct one with ZenML installed is detected
PythonInterpreterCheck

Summary by CodeRabbit

  • New Features

    • Enhanced ZenML VS Code extension with seamless integration with ZenML CLI, providing Activity Bar view, Python Tool Integration, Real-Time Configuration Monitoring, and Status Bar updates.
    • Introduced Environment View and additional commands for server, stack, pipeline, and environment operations.
  • Enhancements

    • Improved Python interpreter management and server connection handling.
    • Optimized pipeline and environment views for real-time updates and detailed information.
    • Streamlined extension settings for workspace configurations.
  • Documentation

    • Updated README.md with comprehensive details on extension features, a Quick Start Guide, and development instructions.
  • Tests

    • Added tests for server configuration updates, event handling, and server status updates.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between d1468a3 and c19000f.
Files selected for processing (7)
  • bundled/tool/lsp_zenml.py (1 hunks)
  • bundled/tool/zenml_wrappers.py (1 hunks)
  • package.json (1 hunks)
  • src/commands/pipelines/registry.ts (1 hunks)
  • src/types/PipelineTypes.ts (1 hunks)
  • src/views/activityBar/common/PaginationTreeItems.ts (1 hunks)
  • src/views/activityBar/pipelineView/PipelineDataProvider.ts (1 hunks)
Files skipped from review as they are similar to previous changes (7)
  • bundled/tool/lsp_zenml.py
  • bundled/tool/zenml_wrappers.py
  • package.json
  • src/commands/pipelines/registry.ts
  • src/types/PipelineTypes.ts
  • src/views/activityBar/common/PaginationTreeItems.ts
  • src/views/activityBar/pipelineView/PipelineDataProvider.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between c19000f and 46f29fa.
Files selected for processing (4)
  • package.json (1 hunks)
  • package.nls.json (1 hunks)
  • src/commands/pipelines/registry.ts (1 hunks)
  • src/views/activityBar/pipelineView/PipelineDataProvider.ts (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • package.json
  • package.nls.json
  • src/commands/pipelines/registry.ts
  • src/views/activityBar/pipelineView/PipelineDataProvider.ts

@strickvl strickvl added the enhancement New feature or request label Mar 27, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between 46f29fa and 286857a.
Files selected for processing (2)
  • README.md (1 hunks)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json
Additional comments: 5
README.md (5)
  • 5-15: The introduction and current features sections provide a clear and comprehensive overview of the extension's capabilities and integration with the ZenML CLI. Well done on detailing these aspects.
  • 17-51: The new additions and commands sections are well-detailed, providing users with clear instructions on how to utilize the new features and commands introduced in this update. Great job on this section.
  • 53-115: The limitations, quick start guide, and setup instructions sections are clear and comprehensive, effectively guiding users through the initial setup and highlighting important compatibility information.
  • 117-152: The usage, development, and testing instructions sections are well-organized and informative, providing users and developers with clear guidance on how to utilize, develop, and test the extension effectively.
  • 154-185: The ZenML version and installation, troubleshooting, contributing, and pull requests sections are comprehensive and provide valuable information for users and contributors alike. Excellent work on compiling these helpful resources.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between 286857a and e512dba.
Files selected for processing (1)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between e512dba and 0ebe969.
Files selected for processing (3)
  • README.md (1 hunks)
  • src/common/constants.ts (1 hunks)
  • src/test/ts_tests/extension.test.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/common/constants.ts
  • src/test/ts_tests/extension.test.ts

README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between 0ebe969 and 4aaae68.
Files selected for processing (1)
  • README.md (1 hunks)
Additional comments: 3
README.md (3)
  • 12-15: The features section clearly outlines the new capabilities of the ZenML VSCode extension, aligning well with the PR objectives.
  • 35-37: The requirements section is updated to reflect the necessary conditions for using the ZenML VSCode extension effectively, including ZenML and Python version requirements.
  • 39-47: The sections on feedback, contributions, and further assistance are well-structured, providing clear paths for community engagement and support.

README.md Outdated
Comment on lines 19 to 20
Note that you'll need to have ZenML installed in your Python environment to use
this extension and your Python version needs to be 3.8 or greater.
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a comma for clarity in the sentence about Python version requirements.

- this extension and your Python version needs to be 3.8 or greater.
+ this extension, and your Python version needs to be 3.8 or greater.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
Note that you'll need to have ZenML installed in your Python environment to use
this extension and your Python version needs to be 3.8 or greater.
Note that you'll need to have ZenML installed in your Python environment to use
this extension, and your Python version needs to be 3.8 or greater.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between 4aaae68 and 2985e77.
Files selected for processing (3)
  • CONTRIBUTING.md (1 hunks)
  • README.md (1 hunks)
  • src/views/statusBar/index.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/views/statusBar/index.ts

Comment on lines +18 to +19
Note that you'll need to have [ZenML](https://github.com/zenml-io/zenml) installed in your Python environment to use
this extension and your Python version needs to be 3.8 or greater.
Copy link
Contributor

Choose a reason for hiding this comment

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

The sentence about the Python version requirement could be improved for clarity by adding a comma.

- this extension and your Python version needs to be 3.8 or greater.
+ this extension, and your Python version needs to be 3.8 or greater.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
Note that you'll need to have [ZenML](https://github.com/zenml-io/zenml) installed in your Python environment to use
this extension and your Python version needs to be 3.8 or greater.
Note that you'll need to have [ZenML](https://github.com/zenml-io/zenml) installed in your Python environment to use
this extension, and your Python version needs to be 3.8 or greater.

CONTRIBUTING.md Outdated
### Additional Resources

- [ZenML VSCode Extension Repository](https://github.com/zenml-io/vscode-zenml)
- [ZenML Documentation](https://docs.zenml.io)
Copy link
Contributor

Choose a reason for hiding this comment

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

The URL for the ZenML Documentation has been updated. Ensure it points to the correct location.

- - [ZenML Documentation](https://docs.zenml.io)
+ - [ZenML Documentation](https://zenml.io/docs)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- [ZenML Documentation](https://docs.zenml.io)
- [ZenML Documentation](https://zenml.io/docs)

@strickvl strickvl merged commit be2fc19 into zenml-io:develop Mar 27, 2024
1 check passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between 2985e77 and 038cb22.
Files selected for processing (1)
  • CONTRIBUTING.md (1 hunks)

### Additional Resources

- [ZenML VSCode Extension Repository](https://github.com/zenml-io/vscode-zenml)
- [ZenML Documentation](https://docs.zenml.io)
Copy link
Contributor

Choose a reason for hiding this comment

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

The URL for the ZenML Documentation is outdated. Please update it to point to the correct location.

- - [ZenML Documentation](https://docs.zenml.io)
+ - [ZenML Documentation](https://zenml.io/docs)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- [ZenML Documentation](https://docs.zenml.io)
- [ZenML Documentation](https://zenml.io/docs)


## Troubleshooting Common Issues

- Ensure all dependencies are up to date and compatible.
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding hyphens to "up to date" to form the correct adjective "up-to-date".

- Ensure all dependencies are up to date and compatible.
+ Ensure all dependencies are up-to-date and compatible.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- Ensure all dependencies are up to date and compatible.
Ensure all dependencies are up-to-date and compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants