GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — vscode-python/pythonFiles/create_microvenv.py at main · JonathanRayner/vscode-python

Expand file tree

/

create_microvenv.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
60 lines (44 loc) · 1.4 KB
/

create_microvenv.py

Copy path

File metadata and controls

60 lines (44 loc) · 1.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import argparse
import os
import pathlib
import subprocess
import sys
from typing import Optional, Sequence
VENV_NAME = ".venv"
LIB_ROOT = pathlib.Path(__file__).parent / "lib" / "python"
CWD = pathlib.Path.cwd()
class MicroVenvError(Exception):
pass
def run_process(args: Sequence[str], error_message: str) -> None:
try:
print("Running: " + " ".join(args))
subprocess.run(args, cwd=os.getcwd(), check=True)
except subprocess.CalledProcessError:
raise MicroVenvError(error_message)
def parse_args(argv: Sequence[str]) -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument(
"--name",
default=VENV_NAME,
type=str,
help="Name of the virtual environment.",
metavar="NAME",
action="store",
)
return parser.parse_args(argv)
def create_microvenv(name: str):
run_process(
[sys.executable, os.fspath(LIB_ROOT / "microvenv.py"), name],
"CREATE_MICROVENV.MICROVENV_FAILED_CREATION",
)
def main(argv: Optional[Sequence[str]] = None) -> None:
if argv is None:
argv = []
args = parse_args(argv)
print("CREATE_MICROVENV.CREATING_MICROVENV")
create_microvenv(args.name)
print("CREATE_MICROVENV.CREATED_MICROVENV")
if __name__ == "__main__":
main(sys.argv[1:])
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.