MCPcopy
hub / github.com/marimo-team/marimo / validate_requirements

Method validate_requirements

marimo/_server/lsp.py:593–614  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

591 return await super().start()
592
593 def validate_requirements(self) -> str | Literal[True]:
594 if not DependencyManager.pylsp.has():
595 return "pylsp is missing. Install it with `pip install python-lsp-server`."
596
597 # Try actually running pylsp to validate it works
598 import sys
599
600 try:
601 result = subprocess.run(
602 [sys.executable, "-m", "pylsp", "--version"],
603 capture_output=True,
604 text=True,
605 timeout=5,
606 )
607 if result.returncode != 0:
608 error_msg = result.stderr or result.stdout or "Unknown error"
609 return f"pylsp is installed but failed to run: {error_msg}. Check for dependency conflicts (e.g., jedi version compatibility)."
610 return True
611 except subprocess.TimeoutExpired:
612 return "pylsp command timed out. The server may be unresponsive."
613 except Exception as e:
614 return f"Failed to validate pylsp: {e}"
615
616 def get_command(self) -> list[str]:
617 import sys

Callers 1

test_pylsp_serverFunction · 0.95

Calls 2

hasMethod · 0.45
runMethod · 0.45

Tested by 1

test_pylsp_serverFunction · 0.76