diff --git a/pynecone/components/graphing/plotly.py b/pynecone/components/graphing/plotly.py index 850bd0688..959121823 100644 --- a/pynecone/components/graphing/plotly.py +++ b/pynecone/components/graphing/plotly.py @@ -32,6 +32,9 @@ class Plotly(PlotlyLib): # The height of the graph. height: Var[str] + # If true, the graph will resize when the window is resized. + use_resize_handler: Var[bool] + def _get_imports(self): return {} diff --git a/pynecone/constants.py b/pynecone/constants.py index 2b0a1fd53..ea423024a 100644 --- a/pynecone/constants.py +++ b/pynecone/constants.py @@ -17,6 +17,11 @@ VERSION = pkg_resources.get_distribution(PACKAGE_NAME).version # Minimum version of Node.js required to run Pynecone. MIN_NODE_VERSION = "12.22.0" +# Valid bun versions. +MIN_BUN_VERSION = "0.5.5" +MAX_BUN_VERSION = "0.5.8" +INVALID_BUN_VERSIONS = ["0.5.6", "0.5.7"] + # Files and directories used to init a new project. # The root directory of the pynecone library. ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) diff --git a/pynecone/utils/prerequisites.py b/pynecone/utils/prerequisites.py index 7ea2053f0..5d32f89a0 100644 --- a/pynecone/utils/prerequisites.py +++ b/pynecone/utils/prerequisites.py @@ -41,6 +41,26 @@ def check_node_version(min_version): return False +def get_bun_version() -> str: + """Get the version of bun. + + Returns: + The version of bun. + + Raises: + FileNotFoundError: If bun is not installed. + """ + try: + # Run the bun -v command and capture the output + result = subprocess.run( + ["bun", "-v"], stdout=subprocess.PIPE, stderr=subprocess.PIPE + ) + version = result.stdout.decode().strip() + return version + except Exception: + raise FileNotFoundError("Pynecone requires bun to be installed.") from None + + def get_package_manager() -> str: """Get the package manager executable. @@ -192,6 +212,12 @@ def install_bun(): Raises: FileNotFoundError: If the required packages are not installed. """ + if get_bun_version() in constants.INVALID_BUN_VERSIONS: + console.print( + f"[red]Bun version {get_bun_version()} is not supported by Pynecone. Please downgrade to bun version {constants.MIN_BUN_VERSION} or upgrade to {constants.MAX_BUN_VERSION} or higher." + ) + return + # Bun is not supported on Windows. if platform.system() == "Windows": console.log("Skipping bun installation on Windows.")