microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.34k stars 1.19k forks source link

Add a `Python: New Workspace` command #20649

Open karrtikr opened 1 year ago

karrtikr commented 1 year ago

Creates and opens a new workspace folder set up for Python development. One way to do it could be:

We can use it in the first step of getting started to encourage users to start using projects and local environments, which right now isn't done if no project is already opened:

cc/ @cwebster-99

karrtikr commented 1 year ago

Based on discussion, "Project" can be interpreted to contain config files and more. As folder is meant to be empty, it's best if we use other terminology, "Workspace" instead could work better.

luabud commented 1 year ago

I really really like this idea and it's definitely something we hear as something folks missing when trying Python in VS Code for the first time.

cwebster-99 commented 1 year ago

We receive a lot of feedback in user studies that a command like this would be very valuable. A lot of times users want this "initial project setup" done for them since it is pretty consistent across all Python projects. We have also heard users say that they feel there are so many steps before they can actually write/run Python code so something that allows them to get to that point faster is helpful.

Below are some key questions we should consider when defining the functionality and limits for such command:

A base case could look like:

cwebster-99 commented 12 months ago

Some of the most prominent feedback we get is the difficulty that comes with getting started with Python in VS Code. With that comes, the complexities of getting started for each particular project a user is working on. In VS Code this could include creating a workspace folder, a Python file, a virtual environment, a test directory, a dependency file, and so on. The motivation for this feature is to be a lightweight UI/command that users can leverage to get their projects up and going while also adhering to Python best practices.

The ideal outcome for a Create Python Project command would be a user is set up to begin coding with everything configured in order for them to be successful. We hope this will lead more users to a successful first run using Python in VS Code and give them the confidence that they are set up for success. The desire is that this takes away some of the setup and configuration pain and allows the users to focus on coding. Ideally, it would be used anytime the user wants to start a new Python project in VS Code and serve as a convenient way to get started with the basic tools to make their Python project successful, and lowering the barrier to start for newcomers.

One consideration with such a command is that this is an opinionated workflow. By design, we know we will not meet the needs of 100% of cases, but we want to design this in a way that covers as many scenarios as possible given what we know our users are working on. In the future, the command could extend functionality to cater to different types of Python projects and support more configuration.

MVP includes:

One consideration that was brought up was including a pyproject.toml file instead of a requirements.txt file as this would allow for more control over settings and linting rules. This might be an interesting discussion, although unsure how well this fits in with our target user who just wants to get up and coding.

In the future, this command would hopefully provide extensibility for tools extensions to plug into and contribute their own flow (i.e. poetry, hatch, etc.)

Where can we surface this command:

Appreciate all comments and suggestions!