Skip to content

Add basic Poetry environment lifecycle support - #1700

Draft
Eduardo Villalpando Mello (edvilme) wants to merge 1 commit into
mainfrom
poetry-environment-lifecycle
Draft

Add basic Poetry environment lifecycle support#1700
Eduardo Villalpando Mello (edvilme) wants to merge 1 commit into
mainfrom
poetry-environment-lifecycle

Conversation

@edvilme

Copy link
Copy Markdown
Contributor

Summary

  • add basic Poetry environment creation for existing projects using a selected global Python 3 interpreter
  • add Poetry environment removal with owning-project detection and selection/cache cleanup
  • add lifecycle unit coverage for creation, package failures, reused environments, removal, and multi-project associations

Validation

  • npm run lint
  • npm run compile-tests
  • npm run unittest

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6b2fe9b5-38ea-442f-b07a-b6c71134d480

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds basic Poetry environment creation and removal for existing Python projects.

Changes:

  • Creates Poetry environments using global Python 3 interpreters.
  • Removes environments and clears cached selections.
  • Adds localized lifecycle messages and unit coverage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/managers/poetry/poetryManager.ts Implements Poetry lifecycle operations.
src/managers/poetry/main.ts Supplies the output channel.
src/common/localize.ts Adds lifecycle messages.
src/test/managers/poetry/poetryManager.createRemove.unit.test.ts Tests creation and removal flows.
Suppressed comments (1)

src/managers/poetry/poetryManager.ts:208

  • After deleting the project mapping, get(root) falls back to globalEnv, but this event always reports new: undefined. When a different global Poetry environment exists, listeners receive a selection that disagrees with the manager's actual result. Report that fallback, except when the global environment is the one being removed.
                        new: undefined,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +151 to +155
this._onDidChangeEnvironment.fire({
uri: projectRoot,
old: previousEnvironment,
new: environment,
});
Comment on lines +563 to +565
const environments = await this.api.getEnvironments('global');
const baseEnvironment = getLatest(
environments.filter(
Comment on lines +554 to +555
if (scope === 'global' || (Array.isArray(scope) && scope.length !== 1)) {
throw new Error(PoetryStrings.create.singleProject);
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.

2 participants