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

Add a Python: New Workspace command #20649

Open
karrtikr opened this issue Feb 5, 2023 · 4 comments
Open

Add a Python: New Workspace command #20649

karrtikr opened this issue Feb 5, 2023 · 4 comments
Assignees
Labels
area-editor-* User-facing catch-all feature-request Request for new features or functionality needs proposal Need to make some design decisions

Comments

@karrtikr
Copy link

karrtikr commented Feb 5, 2023

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

  • Prompts to enter path to project with prefilled input, similar to:
  • Creates it and opens it as workspace
  • Runs Create Environment and selects it for workspace
  • (Optional) Creates a main.py entrypoint

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 karrtikr added the feature-request Request for new features or functionality label Feb 5, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 5, 2023
@karthiknadig karthiknadig added area-editor-* User-facing catch-all needs proposal Need to make some design decisions and removed triage-needed Needs assignment to the proper sub-team labels Feb 6, 2023
@karrtikr karrtikr changed the title Add a Python: New Project command Add a Python: New Workspace command Feb 7, 2023
@karrtikr
Copy link
Author

karrtikr commented Feb 7, 2023

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
Copy link
Member

luabud commented Feb 7, 2023

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
Copy link
Member

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:

  • Why this and not cookiecutter?
  • What is the expected outcome?
  • What should be included in it?
    -- Test dir? Docs dir? Readme? requirements.txt file? virtual environment? main.py?
  • How much is it about instruction vs convenience/get up and get going?
  • Is this for a script, an app, or a package?
  • How often do we expect users will use this command?
  • Do we want to have an extensions.json to recommend extensions or could that be too distracting?

A base case could look like:

  • Make a directory, create a file with the same name, make test directory, req.txt, req-dev.txt to include pytest

@cwebster-99
Copy link
Member

cwebster-99 commented Nov 15, 2023

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:
- Create and name a workspace folder
- Create a virtual environment (choose venv or conda and the Python interpreter by plugging into the Python : Create Environment command)
- Create a main.py file (or name the file the same as the workspace name)
- Include a requirements.txt file (could be a check box - not required)
Upon completion, the new workspace will be opened in VS Code

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:
- Python Getting Started walkthrough
- Explore panel
- Command Palette

Appreciate all comments and suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-editor-* User-facing catch-all feature-request Request for new features or functionality needs proposal Need to make some design decisions
Projects
None yet
Development

No branches or pull requests

4 participants