Skip to content

Commit 33711fd

Browse files
committed
edits first pass
1 parent 1d2a93e commit 33711fd

6 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/features/creators/creationHelpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { traceVerbose } from '../../common/logging';
1111
*/
1212
export async function promptForVenv(): Promise<boolean | undefined> {
1313
const venvChoice = await window.showQuickPick(['Yes', 'No'], {
14-
placeHolder: 'Would you like to create a new venv for this package?',
14+
placeHolder: 'Would you like to create a new virtual environment for this package?',
1515
ignoreFocusOut: true,
1616
});
1717
if (!venvChoice) {
@@ -85,7 +85,8 @@ export async function quickCreateNewVenv(envManagers: EnvironmentManagers, destF
8585
// find an environment manager that supports create
8686
const envManager = envManagers.managers.find((m) => m.create);
8787
if (envManager) {
88-
const pyEnv = await envManager.create(destUri, {});
88+
const options: CreateEnvironmentOptions = { quickCreate: true, additionalPackages: [] };
89+
const pyEnv = await envManager.create(destUri, options);
8990
traceVerbose(`Created venv at: ${pyEnv?.environmentPath} using ${envManager.name}`);
9091
}
9192
// If no environment manager supports create, show an error message

src/features/creators/newPackageProject.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ export class NewPackageProject implements PythonProjectCreator {
7272
return undefined;
7373
}
7474
const destRoot = workspaceFolders[0].uri.fsPath; // this doesn't seem right...
75+
// Check if the destination folder already exists
7576
const destFolder = path.join(destRoot, `${packageName}_project`);
77+
if (await fs.pathExists(destFolder)) {
78+
window.showErrorMessage('A project folder by that name already exists, aborting.');
79+
return undefined;
80+
}
7681
await fs.copy(templateFolder, destFolder);
7782

7883
// 2. Replace <package_name> in all files and file/folder names using helper
@@ -103,6 +108,7 @@ export class NewPackageProject implements PythonProjectCreator {
103108
const { executable, args = [] } = execInfo.run;
104109
const execRunStr = [executable, ...args].join(' ');
105110
await replaceInFile(readmeFilePath, '<run_exec>', execRunStr);
111+
await replaceInFile(readmeFilePath, 'packagenamereplacementtext', packageName);
106112
}
107113
// TODO: replace <activation_command> in README.md ?
108114

src/features/creators/templates/newPackageTemplate/.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Copilot Instructions for <package_name>
1+
# Copilot Instructions for package_name
22

3-
- This is a Python package named `<package_name>`.
3+
- This is a Python package named `package_name`.
44
- Follow PEP8 style guidelines.
55
- Use relative imports within the package.
66
- Write clear docstrings for all public functions and classes.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"configurations": [
3-
{ "name": "Python Debugger: Module", "type": "debugpy", "request": "launch", "module": "<package_name>" }
3+
{ "name": "Python Debugger: Module", "type": "debugpy", "request": "launch", "module": "package_name" }
44
]
55
}
6-
// TODO: Add more configurations as needed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,36 @@
77
- [package\_name](#package_name)
88
- [Table of Contents](#table-of-contents)
99
- [How to Run](#how-to-run)
10-
- [How to Package](#how-to-package)
11-
- [How to Test](#how-to-test)
12-
- [Setup for New Contributors](#setup-for-new-contributors)
10+
- [How to package](#how-to-package)
11+
- [How to test](#how-to-test)
12+
- [Setup for new contributors](#setup-for-new-contributors)
1313
- [License](#license)
1414

1515
## How to Run
1616

1717
> TODO: Describe how to use or run your package, with example commands or code.
18-
1. `<run_exec> -m <package_name>`
18+
1. `<run_exec> -m package_name`
1919
20-
## How to Package
20+
## How to package
2121

2222
> TODO: Explain how to build and distribute the package (e.g., using setuptools, poetry, etc.).
2323
2424
1. `<run_exec> -m build`
2525

2626

27-
## How to Test
27+
## How to test
2828
Tests are stored in the `tests` folder. Tests can be run using pytest with the following command:
2929
`<run_exec> pytest`
3030

31-
## Setup for New Contributors
31+
## Setup for new contributors
3232

3333
> TODO: List steps for a new developer to get started.
3434
3535
1. Activate and select the necessary environment, `<activation_command>`
3636
2. Install dependencies:
3737
a. with `<run_exec> pip install -e .[dev]`
3838
b. with `<run_exec> pip install -r dev_requirements.txt` and `<run_exec> pip install -e .`
39-
3. then run the package with: `<run_exec> -m <package_name>`
39+
3. Run the package with: `<run_exec> -m <package_name>`
4040

4141

4242
## License

src/features/creators/templates/newPackageTemplate/package_name/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ def main() -> None:
55
print("Start coding in Python today!")
66

77

8-
main()
8+
if __name__ == "__main__":
9+
main()

0 commit comments

Comments
 (0)