Skip to content

Commit dc8b54b

Browse files
authored
feat: add cli playwright as an entry point. (microsoft#388)
1 parent fcbc86a commit dc8b54b

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

playwright/__main__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@
1818

1919
from playwright._impl._driver import compute_driver_executable
2020

21-
driver_executable = compute_driver_executable()
22-
my_env = os.environ.copy()
23-
# VSCode's JavaScript Debug Terminal provides it but driver/pkg does not support it
24-
my_env.pop("NODE_OPTIONS", None)
25-
my_env["PW_CLI_TARGET_LANG"] = "python"
26-
subprocess.run([str(driver_executable), *sys.argv[1:]], env=my_env)
21+
22+
def main() -> None:
23+
driver_executable = compute_driver_executable()
24+
my_env = os.environ.copy()
25+
# VSCode's JavaScript Debug Terminal provides it but driver/pkg does not support it
26+
my_env.pop("NODE_OPTIONS", None)
27+
my_env["PW_CLI_TARGET_LANG"] = "python"
28+
subprocess.run([str(driver_executable), *sys.argv[1:]], env=my_env)
29+
30+
31+
if __name__ == "__main__":
32+
main()

setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,9 @@ def run(self) -> None:
135135
"write_to_template": 'version = "{version}"\n',
136136
},
137137
setup_requires=["setuptools_scm"],
138+
entry_points={
139+
"console_scripts": [
140+
"playwright=playwright.__main__:main",
141+
],
142+
},
138143
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy