Skip to content

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

Open
wants to merge 23 commits into
base: create-project-branch
Choose a base branch
from

Conversation

eleanorjboyd
Copy link
Member

Implement the flow to allow for "New Package" support

if (envManager.quickCreateConfig) {
options.quickCreate = true;
}
const pyEnv = await envManager.create(destUri, options);
Copy link
Member Author

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/

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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

Copy link
Member Author

@eleanorjboyd eleanorjboyd Apr 25, 2025

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.');
Copy link
Member

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?

Copy link
Member Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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

@@ -0,0 +1,10 @@
# Copilot Instructions for package_name
Copy link
Member Author

@eleanorjboyd eleanorjboyd Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karthiknadig:

  • 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 the pyproject.toml and dev-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

@eleanorjboyd eleanorjboyd force-pushed the create-project-branch branch from 633fc62 to 13b993c Compare April 24, 2025 22:11
@eleanorjboyd eleanorjboyd marked this pull request as ready for review April 25, 2025 16:28
karthiknadig and others added 11 commits April 25, 2025 11:27
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants