Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
31b73ce
Added backslashes to descriptions with '[][]'
daexs Aug 12, 2025
fae9563
Fixed markdown formatting for valType 'info_array'
daexs Aug 14, 2025
f345aef
Fixed double bracket error for regular expressions
daexs Aug 14, 2025
f840f11
Minor code cleanup
daexs Aug 14, 2025
4a7873c
Fixed double bracket error in 'basedatatypes.py'
daexs Aug 14, 2025
b0cd2f9
Merge branch 'mkdocs-conversion' of https://github.com/plotly/plotly.…
daexs Aug 14, 2025
cd623aa
Regenerated code after basevalidators.py changes
daexs Aug 14, 2025
98fab98
Fix SyntaxWarning and adjusted valType 'enumerated' docstring format.
daexs Aug 14, 2025
9ddde0f
Fixed formatting issues with nested enumerated docstrings in info_arr…
daexs Aug 15, 2025
683643c
Fixed list format in 'Dash' and 'String' properties.
daexs Aug 18, 2025
efde201
Fixed formatting for 'Compound' and 'color' properties.
daexs Aug 18, 2025
01da1c6
Fixed formatting for 'Integer' types.
daexs Aug 18, 2025
8d12a05
Fixed formatting for 'Colorscale', 'CompoundArray', and 'BaseData' ty…
daexs Aug 19, 2025
6690116
Fixed confusing indentation & some formatting
daexs Aug 19, 2025
4154910
Fixed formatting issues and consistency
daexs Aug 19, 2025
df9cc3a
feat: allow `--schema path` option to code generation
gvwilson Aug 20, 2025
77d19bb
Merge pull request #17 from gvwilson/mkdocs-conversion
daexs Aug 20, 2025
bdd049b
Fixed code block and type annotation formatting.
daexs Aug 21, 2025
cbd983d
Minor code cleanup
daexs Aug 21, 2025
95ea818
Fixed example parsing error
daexs Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
177 changes: 96 additions & 81 deletions _plotly_utils/basevalidators.py

Large diffs are not rendered by default.

17 changes: 12 additions & 5 deletions bin/codegen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
from pathlib import Path
import shutil
import sys

Expand Down Expand Up @@ -27,6 +28,11 @@
)


PROJECT_ROOT = Path(__file__).parent.parent.parent
PLOT_SCHEMA_RELATIVE = Path("resources") / "plot-schema.json"
PLOT_SCHEMA = PROJECT_ROOT / PLOT_SCHEMA_RELATIVE


# Import notes
# ------------
# Nothing from the plotly/ package should be imported during code
Expand Down Expand Up @@ -94,7 +100,7 @@ def make_paths(codedir):
return validators_dir, graph_objects_dir, graph_objs_path


def perform_codegen(codedir, noformat=False):
def perform_codegen(codedir, noformat=False, schema=PLOT_SCHEMA):
"""Generate code."""

# Get paths
Expand All @@ -108,8 +114,7 @@ def perform_codegen(codedir, noformat=False):

# Load plotly schema
project_root = codedir.parent
plot_schema_path = project_root / "resources" / "plot-schema.json"
with open(plot_schema_path, "r") as f:
with open(schema, "r") as f:
plotly_schema = json.load(f)

# Preprocess Schema
Expand Down Expand Up @@ -284,7 +289,9 @@ def __getattr__(import_name):
init_extra = optional_figure_widget_import
else:
init_extra = ""
write_init_py(graph_objects_pkg, path_parts, rel_modules, rel_classes, init_extra)
write_init_py(
graph_objects_pkg, path_parts, rel_modules, rel_classes, init_extra
)

# Output graph_objs.py alias
graph_objs_rel_classes = [
Expand All @@ -303,7 +310,7 @@ def __getattr__(import_name):
)
graph_objs_path = codedir / "graph_objs"
graph_objs_path.mkdir(parents=True, exist_ok=True)
graph_objs_path /= "__init__.py"
graph_objs_path /= "__init__.py"
with open(graph_objs_path, "wt") as f:
f.write("# ruff: noqa: F401\n")
f.write(graph_objs_init_source)
Expand Down
10 changes: 8 additions & 2 deletions bin/generate_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@ def main():

args = parse_args()
codedir = utils.select_code_directory(args)
utils.perform_codegen(codedir, noformat=args.noformat)
utils.perform_codegen(codedir, noformat=args.noformat, schema=args.schema)


def parse_args():
"""Parse command-line arguments."""

parser = argparse.ArgumentParser()
parser.add_argument("--noformat", action="store_true", help="prevent reformatting")
parser.add_argument("--codedir", type=Path, help="code directory")
parser.add_argument("--noformat", action="store_true", help="prevent reformatting")
parser.add_argument(
"--schema",
type=Path,
default=utils.PLOT_SCHEMA,
help=f"schema file (default {utils.PLOT_SCHEMA})",
)
return parser.parse_args()


Expand Down
10 changes: 5 additions & 5 deletions bin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
import logging
import json
import os
from pathlib import Path
import platform
import requests
import shutil
from subprocess import check_call
import sys
import time

from codegen import perform_codegen

from codegen import (
perform_codegen,
PROJECT_ROOT,
PLOT_SCHEMA,
)

LOGGER = logging.getLogger(__name__)
PROJECT_ROOT = Path(__file__).parent.parent
NODE_ROOT = PROJECT_ROOT / "js"
NODE_MODULES = NODE_ROOT / "node_modules"
PLOT_SCHEMA = PROJECT_ROOT / "resources" / "plot-schema.json"
WIDGET_TARGETS = [PROJECT_ROOT / "plotly" / "package_data" / "widgetbundle.js"]
NPM_PATH = os.pathsep.join(
[
Expand Down
Loading