Skip to content

Commit 6fec72d

Browse files
committed
updates based on feedback
1 parent 33711fd commit 6fec72d

5 files changed

Lines changed: 26 additions & 102 deletions

File tree

src/features/creators/creationHelpers.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { window, extensions, Uri } from 'vscode';
22
import * as fs from 'fs-extra';
33
import * as path from 'path';
4-
import { EnvironmentManagers } from '../../internal.api';
5-
import { CreateEnvironmentOptions, EnvironmentManager } from '../../api';
4+
import { EnvironmentManagers, InternalEnvironmentManager } from '../../internal.api';
5+
import { CreateEnvironmentOptions } from '../../api';
66
import { traceVerbose } from '../../common/logging';
77

88
/**
@@ -68,31 +68,32 @@ export async function removeCopilotInstructions(destFolder: string) {
6868
export async function quickCreateNewVenv(envManagers: EnvironmentManagers, destFolder: string) {
6969
try {
7070
// get the environment manager for venv
71-
const envManager: EnvironmentManager | undefined = envManagers.managers.find(
71+
const envManager: InternalEnvironmentManager | undefined = envManagers.managers.find(
7272
(m) => m.id === 'ms-python.python:venv',
7373
);
7474
const destUri = Uri.parse(destFolder);
75-
if (envManager && envManager.create) {
75+
if (envManager?.supportsQuickCreate) {
7676
// with quickCreate enabled, user will not be prompted when creating the environment
7777
const options: CreateEnvironmentOptions = { quickCreate: false };
78-
if (envManager.quickCreateConfig) {
78+
if (envManager.supportsQuickCreate) {
7979
options.quickCreate = true;
8080
}
8181
const pyEnv = await envManager.create(destUri, options);
8282
// comes back as undefined if this doesn't work
8383
traceVerbose(`Created venv at: ${pyEnv?.environmentPath} using ${envManager.name}`);
8484
} else {
85-
// find an environment manager that supports create
86-
const envManager = envManagers.managers.find((m) => m.create);
87-
if (envManager) {
88-
const options: CreateEnvironmentOptions = { quickCreate: true, additionalPackages: [] };
89-
const pyEnv = await envManager.create(destUri, options);
90-
traceVerbose(`Created venv at: ${pyEnv?.environmentPath} using ${envManager.name}`);
91-
}
92-
// If no environment manager supports create, show an error message
93-
window.showErrorMessage(
94-
`No environment manager found that supports creating a new environment, skipping...`,
95-
);
85+
// // find an environment manager that supports create
86+
// const envManager = envManagers.managers.find((m) => m.supportsCreate);
87+
// if (envManager) {
88+
// const options: CreateEnvironmentOptions = { quickCreate: true, additionalPackages: [] };
89+
// const pyEnv = await envManager.create(destUri, options);
90+
// traceVerbose(`Created venv at: ${pyEnv?.environmentPath} using ${envManager.name}`);
91+
// }
92+
// // If no environment manager supports create, show an error message
93+
// window.showErrorMessage(
94+
// `No environment manager found that supports creating a new environment, skipping...`,
95+
// );
96+
//TODO: just throw error
9697
}
9798
} catch (err) {
9899
window.showErrorMessage(`Failed to create virtual environment: ${err}`);

src/features/creators/newPackageProject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class NewPackageProject implements PythonProjectCreator {
2323
constructor(private readonly envManagers: EnvironmentManagers) {}
2424

2525
async create(_options?: PythonProjectCreatorOptions): Promise<PythonProject | undefined> {
26-
// Prompt for package name
26+
// Prompt for package name (TODO: this doesn't make sense if the _options is already being passed in )
2727
const packageName = await window.showInputBox({
2828
prompt: 'What is the name of the package? (e.g. my_package)',
2929
ignoreFocusOut: true,
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Copilot Instructions for package_name
22

3-
- This is a Python package named `package_name`.
4-
- Follow PEP8 style guidelines.
5-
- Use relative imports within the package.
6-
- Write clear docstrings for all public functions and classes.
7-
- Add or update tests in the `tests/` directory for new features or bug fixes and use pytest.
8-
- Use the provided `launch.json` for debugging configurations.
3+
- The package `<package_name>` is a Python Project located in the folder `<package_name>-folder`.
4+
- You need to call the `Get Python Environment Information` tool on the <package_name> path to get the Python executable details.
5+
- Substitute the Python executable you get from the `Get Python Environment Information` tool anywhere you see <python> in these instructions.
6+
- Run command for `<package_name>`: `<python> -m <package_name>`
7+
- Command to run tests for `<package_name>`: `<python> -m pytest <package_name>/tests`
8+
- To run an editable install for the package `<package_name>`, use the `Install Python Package` tool with the `<package_name>-folder` path and arguments ['-e', '.'].
9+
- In the workspace `launch.json` file, configurations related to this package have the prefix `<package_name>`.
10+
- The package `<package_name>` has a defined `pyproject.toml` file that you should use and keep up to date.

src/features/creators/templates/newPackageTemplate/.gitignore

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/features/creators/templates/newPackageTemplate/README.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)