{"id":5371,"library":"plotly-stubs","title":"Plotly Type Stubs","description":"plotly-stubs is a stub-only package providing static type annotations for the Plotly Python graphing library. It enables type checkers like Mypy to validate Plotly-related code, improving code quality and maintainability. Currently, it is in 'Beta' development status.","status":"active","version":"0.1.3","language":"python","source_language":"en","source_url":"https://github.com/ClaasRostock/plotly-stubs.git","tags":["typing","stubs","plotly","type hints","mypy"],"install":[{"cmd":"pip install plotly-stubs","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"This package provides type stubs for 'plotly'; the 'plotly' library itself is required for actual runtime execution of plotting code.","package":"plotly","optional":false}],"imports":[{"wrong":"from plotly-stubs.graph_objects import Figure","symbol":"Figure","correct":"from plotly.graph_objects import Figure"}],"quickstart":{"code":"import plotly.express as px\nimport pandas as pd\nfrom plotly.graph_objects import Figure # Type hint for the return\n\ndef create_population_chart(df: pd.DataFrame) -> Figure:\n    \"\"\"Creates a population scatter plot using Plotly Express.\"\"\"\n    fig = px.scatter(\n        df,\n        x=\"gdpPercap\",\n        y=\"lifeExp\",\n        size=\"pop\",\n        color=\"continent\",\n        hover_name=\"country\",\n        log_x=True,\n        size_max=60\n    )\n    return fig\n\n# Example usage (assuming 'gapminder' dataset is available, e.g., from px.data.gapminder())\n# df_gapminder = px.data.gapminder()\n# fig = create_population_chart(df_gapminder)\n# fig.show()","lang":"python","description":"To use plotly-stubs, simply install it alongside `plotly`. Type checkers will automatically pick up the stub files. The example demonstrates a function that creates a Plotly figure with type hints, leveraging the stubs for static analysis."},"warnings":[{"fix":"Ensure `plotly` is installed: `pip install plotly`.","message":"The `plotly-stubs` package provides *only* type hints. For actual runtime execution of plotting code, the `plotly` library itself must be installed (e.g., `pip install plotly`). `plotly-stubs` does not install `plotly` as a dependency.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your development environment uses Python 3.11 or later. Check `python --version`.","message":"The `plotly-stubs` package strictly requires Python >=3.11 and <3.15. While the core `plotly` library might support older Python versions, using `plotly-stubs` will enforce this Python version constraint during development and type checking.","severity":"breaking","affected_versions":"All versions"},{"fix":"Monitor the project's GitHub for updates and be prepared for potential changes in type signatures or coverage. Report missing types to the repository.","message":"As of `plotly-stubs` version 0.1.3, the project is still in 'Beta' development status. This implies that the API for type stubs might evolve, and complete coverage for all `plotly` features may not yet be available or fully stable.","severity":"gotcha","affected_versions":"All versions up to 0.1.3"},{"fix":"Consult the `Dash` documentation and community forums for specific workarounds or updates regarding `Dash`'s type annotations. Consider adding `ignore_missing_imports = true` for `dash.*` in `mypy` configuration if issues persist.","message":"When using `plotly` with `Dash`, users have reported issues with `Dash` version 3.0 introducing breaking type annotations that do not comply with `mypy`, leading to `Untyped decorator` errors for `dash.callback`. This can indirectly affect the perceived type-completeness when `plotly-stubs` is used in a `Dash` application.","severity":"gotcha","affected_versions":"Dash 3.x"}],"env_vars":null,"search_vec":"'annot':16 'beta':44 'checker':26 'code':34,36 'current':40 'develop':45 'enabl':24 'graph':21 'hint':51 'improv':35 'librari':22 'like':27 'maintain':39 'mypi':28,52 'packag':12 'plot':1,5,19,32,49 'plotly-rel':31 'plotly-stub':4 'provid':13 'python':20 'qualiti':37 'relat':33 'static':14 'status':46 'stub':3,6,10,48 'stub-on':9 'type':2,15,25,47,50 'valid':30","created_at":"2026-04-14T01:30:57.794506+00:00","updated_at":"2026-04-17T14:32:12.870089+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'plotly'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1.4","cli_name":"","cli_version":null,"type":"library","homepage":"https://plotly.com/python/","github":"https://github.com/ClaasRostock/plotly-stubs","docs":"https://ClaasRostock.github.io/plotly-stubs/README.html","changelog":"https://github.com/ClaasRostock/plotly-stubs/blob/main/CHANGELOG.md","pypi":"https://pypi.org/project/plotly-stubs/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-30","next_check":"2026-07-10","install_tag":null}}