Convert Figma logo to code with AI

DonJayamanne logopythonVSCode

This extension is now maintained in the Microsoft fork.

2,082
1,481
2,082
83

Top Related Projects

Python extension for Visual Studio Code

Documentation and issues for Pylance

An implementation of the Language Server Protocol for Python

Fork of the python-language-server project, maintained by the Spyder IDE team and the community

Quick Overview

The DonJayamanne/pythonVSCode repository is a collection of Python-related extensions for the Visual Studio Code (VSCode) editor. These extensions aim to enhance the Python development experience within the VSCode environment, providing a range of features and tools to improve productivity and code quality.

Pros

  • Comprehensive Python Support: The extensions in this repository cover a wide range of Python-related features, including code completion, linting, debugging, and more, making VSCode a powerful IDE for Python development.
  • Active Development and Maintenance: The project is actively maintained, with regular updates and bug fixes, ensuring a reliable and up-to-date development experience.
  • Community Engagement: The project has a large and engaged community, with contributors providing feedback, reporting issues, and submitting pull requests to improve the extensions.
  • Customization and Flexibility: The extensions offer a high degree of customization, allowing developers to tailor the development environment to their specific needs and preferences.

Cons

  • Potential Compatibility Issues: As the extensions are developed independently, there may be occasional compatibility issues or conflicts with other VSCode extensions or settings.
  • Learning Curve: The extensive feature set and customization options may present a steeper learning curve for new users, especially those unfamiliar with VSCode and its extension ecosystem.
  • Dependency on VSCode: The extensions are tightly integrated with the VSCode editor, which means that users are required to use VSCode as their primary development environment.
  • Performance Overhead: The extensive functionality provided by the extensions may result in a higher memory and CPU usage, which could impact the performance of VSCode, especially on older or less powerful systems.

Code Examples

N/A (This is not a code library)

Getting Started

N/A (This is not a code library)

Competitor Comparisons

Python extension for Visual Studio Code

Pros of vscode-python

  • More active development and frequent updates
  • Better integration with other Microsoft tools and services
  • Larger community support and more extensive documentation

Cons of vscode-python

  • Potentially heavier resource usage due to additional features
  • Some users report occasional stability issues with newer versions

Code Comparison

pythonVSCode:

def activate(context):
    rootPath = vscode.workspace.rootPath
    if not rootPath:
        return

vscode-python:

def activate(context: ExtensionContext) -> None:
    from .activation.activationManager import ActivationManager
    ActivationManager(context).activate()

The vscode-python example shows a more structured approach to activation, utilizing a dedicated ActivationManager class. This reflects the project's larger scale and more complex architecture compared to pythonVSCode.

Documentation and issues for Pylance

Pros of Pylance-release

  • Faster performance and improved type checking capabilities
  • Deeper integration with Microsoft's Language Server Protocol
  • More frequent updates and active development from Microsoft

Cons of Pylance-release

  • Less customizable than pythonVSCode
  • Requires a separate installation alongside the Python extension
  • Some users report occasional stability issues

Code Comparison

pythonVSCode:

import sys

def greet(name):
    print(f"Hello, {name}!")

greet("World")

Pylance-release:

from typing import List

def greet(names: List[str]) -> None:
    for name in names:
        print(f"Hello, {name}!")

greet(["World", "Python"])

Pylance-release provides more advanced type hinting and checking, as seen in the function parameter and return type annotations. It also offers better autocompletion and code intelligence for more complex Python constructs.

Both extensions significantly enhance the Python development experience in Visual Studio Code, with Pylance-release focusing more on performance and advanced language features, while pythonVSCode offers a broader range of customization options and a more established ecosystem of features.

An implementation of the Language Server Protocol for Python

Pros of python-language-server

  • Focused specifically on providing language server functionality, making it more lightweight and specialized
  • Implements the Language Server Protocol (LSP), allowing it to be used with various editors and IDEs
  • Maintained by a well-known company (Palantir), potentially ensuring long-term support and updates

Cons of python-language-server

  • Limited to language server functionality, lacking additional features found in pythonVSCode
  • May require more setup and configuration to integrate with different development environments
  • Less active development and fewer contributors compared to pythonVSCode

Code Comparison

pythonVSCode:

from vscode import *

class PythonExtension:
    def activate(self, context):
        # Extension activation code

python-language-server:

from pyls import hookimpl

@hookimpl
def pyls_initialize(config, workspace):
    # Language server initialization code

The code snippets show the different approaches: pythonVSCode focuses on VS Code-specific extension development, while python-language-server uses a plugin-based architecture for language server implementation.

Fork of the python-language-server project, maintained by the Spyder IDE team and the community

Pros of python-lsp-server

  • Lightweight and focused solely on providing Language Server Protocol (LSP) functionality
  • Easily integrable with various editors and IDEs that support LSP
  • Actively maintained with regular updates and improvements

Cons of python-lsp-server

  • Limited features compared to the more comprehensive pythonVSCode extension
  • Requires additional setup and configuration for full functionality
  • May lack some VS Code-specific optimizations and integrations

Code Comparison

pythonVSCode (extension.ts):

export function activate(context: vscode.ExtensionContext) {
    const pythonPath = getPythonPath();
    const lspClient = new LanguageClient('python', 'Python', serverOptions, clientOptions);
    context.subscriptions.push(lspClient.start());
}

python-lsp-server (setup.py):

setup(
    name="python-lsp-server",
    version=__version__,
    description="Python Language Server for the Language Server Protocol",
    long_description=long_description,
    packages=find_packages(exclude=["test"]),
    install_requires=["jedi>=0.17.2,<0.19.0", "python-jsonrpc-server>=0.4.0"],
)

The code snippets show the different approaches: pythonVSCode focuses on VS Code integration, while python-lsp-server is a standalone LSP implementation that can be used with various editors.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Python extension for Visual Studio Code

A Visual Studio Code extension with rich support for the Python language (for all actively supported Python versions), providing access points for extensions to seamlessly integrate and offer support for IntelliSense (Pylance), debugging (Python Debugger), formatting, linting, code navigation, refactoring, variable explorer, test explorer, and more!

Support for vscode.dev

The Python extension does offer some support when running on vscode.dev (which includes github.dev). This includes partial IntelliSense for open files in the editor.

Installed extensions

The Python extension will automatically install the following extensions by default to provide the best Python development experience in VS Code:

  • Pylance - to provide performant Python language support
  • Python Debugger - to provide a seamless debug experience with debugpy

These extensions are optional dependencies, meaning the Python extension will remain fully functional if they fail to be installed. Any or all of these extensions can be disabled or uninstalled at the expense of some features. Extensions installed through the marketplace are subject to the Marketplace Terms of Use.

Extensibility

The Python extension provides pluggable access points for extensions that extend various feature areas to further improve your Python development experience. These extensions are all optional and depend on your project configuration and preferences.

If you encounter issues with any of the listed extensions, please file an issue in its corresponding repo.

Quick start

Set up your environment

Jupyter Notebook quick start

The Python extension offers support for Jupyter notebooks via the Jupyter extension to provide you a great Python notebook experience in VS Code.

For more information you can:

Useful commands

Open the Command Palette (Command+Shift+P on macOS and Ctrl+Shift+P on Windows/Linux) and type in one of the following commands:

CommandDescription
Python: Select InterpreterSwitch between Python interpreters, versions, and environments.
Python: Start Terminal REPLStart an interactive Python REPL using the selected interpreter in the VS Code terminal.
Python: Run Python File in TerminalRuns the active Python file in the VS Code terminal. You can also run a Python file by right-clicking on the file and selecting Run Python File in Terminal.
Python: Configure TestsSelect a test framework and configure it to display the Test Explorer.

To see all available Python commands, open the Command Palette and type Python. For Jupyter extension commands, just type Jupyter.

Feature details

Learn more about the rich features of the Python extension:

  • IntelliSense: Edit your code with auto-completion, code navigation, syntax checking and more
  • Linting: Get additional code analysis with Pylint, Flake8 and more
  • Code formatting: Format your code with black, autopep or yapf
  • Debugging: Debug your Python scripts, web apps, remote or multi-threaded processes
  • Testing: Run and debug tests through the Test Explorer with unittest or pytest.
  • Jupyter Notebooks: Create and edit Jupyter Notebooks, add and run code cells, render plots, visualize variables through the variable explorer, visualize dataframes with the data viewer, and more
  • Environments: Automatically activate and switch between virtualenv, venv, pipenv, conda and pyenv environments
  • Refactoring: Restructure your Python code with variable extraction and method extraction. Additionally, there is componentized support to enable additional refactoring, such as import sorting, through extensions including isort and Ruff.

Supported locales

The extension is available in multiple languages: de, en, es, fa, fr, it, ja, ko-kr, nl, pl, pt-br, ru, tr, zh-cn, zh-tw

Questions, issues, feature requests, and contributions

  • If you have a question about how to accomplish something with the extension, please ask on our Discussions page.
  • If you come across a problem with the extension, please file an issue.
  • Contributions are always welcome! Please see our contributing guide for more details.
  • Any and all feedback is appreciated and welcome!
    • If someone has already filed an issue that encompasses your feedback, please leave a 👍/👎 reaction on the issue.
    • Otherwise please start a new discussion.
  • If you're interested in the development of the extension, you can read about our development process.

Data and telemetry

The Microsoft Python Extension for Visual Studio Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. This extension respects the telemetry.enableTelemetry setting which you can learn more about at https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting.