-
Notifications
You must be signed in to change notification settings - Fork 7
New package Flow #324
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
base: create-project-branch
Are you sure you want to change the base?
New package Flow #324
Conversation
if (envManager.quickCreateConfig) { | ||
options.quickCreate = true; | ||
} | ||
const pyEnv = await envManager.create(destUri, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getting an error when creating this but see the venv folder correctly setup inside my project. I think it tries to run Running: uv pip install --python /Users/eleanorboyd/testingFiles/notebook-for-copilot/yay_project/.venv/bin/python
right after creating the venv and that is causing issues?
2025-04-22 15:02:57.432 [info] error: / does not appear to be a Python project, as neither `pyproject.toml` nor `setup.py` are present in the directory
2025-04-22 15:02:57.433 [error] Error managing packages Failed to run uv pip install --python /Users/eleanorboyd/testingFiles/notebook-for-copilot/yay_project/.venv/bin/python -r /Users/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no package being passed in for this to install, and that might be causing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok currently investigating. What seems to happen is when calling quickCreateVenv
, it calls const project = api.getPythonProject(venvRoot);
. On the new project folder. This then ends up with the getter for python project which gets nothing for let pythonProject = this._projects.get(uri.toString());
and falls back to pythonProject = this.findProjectByUri(uri);
. Somewhere I must not be setting the project for the given URI and so it attemps to find it during quick create and fails. This causes quick create to get all of the workspace's package installs (which are like all -r dev_requirements.txt) which it tries to install all at once and errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the problem then boils down to, how do I make it so the venv gets created after the project gets registered or remove the requirement for registration as part of the quickEnv process? Since the function for create is called in envCommands.ts
with export async function addPythonProject
. This calls create and only after the create function finishes the project is pushed to the known projects. But as above, when I create the venv it tries to find the project which is not yet registered. Not sure the best design idea- curious your thoughts @karthiknadig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm I am no longer seeing this error anymore and the PR to fix this is not merged with this- need to do more investigation as it seems this is no longer an issue (edit: nvm no error message is being thrown but too many requirements are being installed)
} | ||
const workspaceFolders = workspace.workspaceFolders; | ||
if (!workspaceFolders || workspaceFolders.length === 0) { | ||
window.showErrorMessage('No workspace folder is open.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we able to open a workspace folder for them if it is empty using the logic Bhavya does with Create New?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bhayva should supply a path where the new project should be created- is the concern if that path doesn't exist?
@@ -0,0 +1,8 @@ | |||
# Copilot Instructions for <package_name> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/microsoft/vscode-python-templates/pull/4/files#diff-8263202d70318618891dd1a86fb62ccab9567201cc456e0085703a8c400b95f6 for additional items we can add to the instructions file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my question here is if I should add all these general rules or if that wont feel applicable to the action the user is taking of adding the project? cc @karthiknadig
src/features/creators/templates/newPackageTemplate/.vscode/launch.json
Outdated
Show resolved
Hide resolved
src/features/creators/templates/newPackageTemplate/package_name/__main__.py
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,10 @@ | |||
# Copilot Instructions for package_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I have it right now that the template as a folder called
<my_package>-folder
which then has a folder<my_package>.
Did this so I had somewhere to store thepyproject.toml
anddev-requirements.txt
. This does make it more complicated to do an editable install of the package at the root, not sure if this is worth the concern? I also worry people will delete / more that folder with higher frequency which then makes these instructions out of date
0609ba3
to
5f36663
Compare
633fc62
to
13b993c
Compare
Standardize the display names of various shell providers to use lowercase for consistency. Fixes microsoft#230
- renamed `addPythonProject` in src/features/envCommands.ts to `addPythonProjectCommand` (as it is only a command entry point) - moved responsibility so ProjectCreators are responsible for adding their created projects to the ProjectManager list - updated `addPythonProjectCommand` so it calls the selected ProjectCreator create method OR (if the resource param already a ProjectItem) just add it to the ProjectManager list
ba917f9
to
f45f30c
Compare
Implement the flow to allow for "New Package" support