microsoft / vscode-python

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

Investigate a potential opinionated package management workflow #21627

Open cwebster-99 opened 12 months ago

cwebster-99 commented 12 months ago

The Python extension in VS Code is investigating ways to improve our package management support tailored towards beginners with the option for extensibility for your preferred package manager tools via extensions.

Goals

Propose and implement an opinionated workflow as part of the Python extension for VS Code to:

Proposal:

An opinionated workflow (ie. commands) that will integrate with the Python: Create Environment command in order to streamline environment creation and package management in the Python extension.

CLI command coverage we want to match in our opinionated workflow:

Where and how to document dependencies: Default should be to write to a requirements.txt file, including the package version that was installed. Opting to write the version, by default, supports the users' need for reproducibility and ease of collaborating on work. Given the nature of the work done by the target audience and our target usage, a pyproject.toml is out of scope as the target user typically does not build their project nor is there a direct way to only install dependencies listed in a pyproject.toml file.

rchiodo commented 11 months ago

Will there be a way for other extensions to use this facility? Maybe just through a command or something like that with looser coupling would be fine.

We'd need to :

ksandvik commented 11 months ago

VSCode commands + cli tool similar to the code cli tool me thinks would be ideal.

cwebster-99 commented 10 months ago

Will there be a way for other extensions to use this facility? Maybe just through a command or something like that with looser coupling would be fine.

If I am understanding your comment correctly, yes, we have discussed the idea that we would allow other package management extensions to plug into the opinionated workflow but use their own commands. Need more investigation to see how this could be implemented and its integration story.

rootsmusic commented 10 months ago

Courtney, I'm this issue's target user (as described in in your blog post). Usually I use conda, unless I have to use pip CLI.

My most frustrating experience is resolving package errors in an environment. Sometimes, an environment says that it has inconsistencies and conda doctor can troubleshoot which packages are inconsistent. Other times, importing a package raises an error because that package's requirements.txt (hopefully available) conflicts with my environment. When that package shares dependencies with another package in my environment, this error can occur if one package didn't update the versions of its dependencies in its requirements.txt while the other package has done so. But which dependency is causing the error (when my environment has updated multiple dependencies of that package) isn't easily identifiable from the error's traceback, like #21456.