Skip to content

Commit f2481eb

Browse files
authored
add cli for installing browsers (#20)
1 parent 53f193f commit f2481eb

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

dendrite_sdk/_cli/main.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import argparse
2+
import subprocess
3+
import sys
4+
5+
6+
def run_playwright_install():
7+
try:
8+
subprocess.run(["playwright", "install"], check=True)
9+
print("Playwright browser installation completed successfully.")
10+
except subprocess.CalledProcessError as e:
11+
print(f"Error during Playwright browser installation: {e}")
12+
sys.exit(1)
13+
except FileNotFoundError:
14+
print(
15+
"Playwright command not found. Please ensure Playwright is installed in your environment."
16+
)
17+
sys.exit(1)
18+
19+
20+
def main():
21+
parser = argparse.ArgumentParser(description="Dendrite SDK CLI tool")
22+
parser.add_argument("command", choices=["install"], help="Command to execute")
23+
24+
args = parser.parse_args()
25+
26+
if args.command == "install":
27+
run_playwright_install()
28+
29+
30+
if __name__ == "__main__":
31+
main()

pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ autopep8 = "^2.0.4"
3939
pylint = "^3.2.6"
4040
black = "^24.8.0"
4141

42+
[tool.poetry.scripts]
43+
dendrite = "dendrite_sdk._cli.main:main"
4244

4345
[build-system]
4446
requires = ["poetry-core", "requests", "python-dotenv", "pydantic"]

0 commit comments

Comments
 (0)