Merged
Show file tree
Hide file tree
Changes from all commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2cf19ff
removing old generated validators
bmaranvilleMay 8, 2025
1f911b6
write single json instead of python files
bmaranvilleMay 8, 2025
930509f
generate validator class instances from json data
bmaranvilleMay 8, 2025
3fd1cfd
use validators from ValidatorCache
bmaranvilleMay 8, 2025
665595d
use validators from ValidatorCache
bmaranvilleMay 8, 2025
af43f68
use DataValidator from ValidatorCache
bmaranvilleMay 8, 2025
771f918
trace validator should be instance not class of DataValidator
bmaranvilleMay 8, 2025
6d905e7
use validators from ValidatorCache
bmaranvilleMay 8, 2025
58ab3e1
use template validator from ValidatorCache
bmaranvilleMay 8, 2025
44f7a4e
allow overlaying args on derived classes
bmaranvilleMay 8, 2025
2507be9
add DataValidator to autogenerated instances provided by ValidatorCac…
bmaranvilleMay 8, 2025
5d1ccdb
add DataValidator to autogenerated instances provided by ValidatorCac…
bmaranvilleMay 8, 2025
6bd2bb3
add DataValidator to autogenerated instances provided by ValidatorCac…
bmaranvilleMay 8, 2025
fdaf441
use a copy of the DataValidator in BaseFigure, with local set_uid att…
bmaranvilleMay 8, 2025
7baa252
update validator params store
bmaranvilleMay 8, 2025
0e913eb
DataValidator is an instance already, and is not callable
bmaranvilleMay 8, 2025
ba8ec10
use heatmap colorscale validator
bmaranvilleMay 8, 2025
2454767
update documentation example to use validator from ValidatorCache
bmaranvilleMay 8, 2025
c62f6cb
cleanup
bmaranvilleMay 9, 2025
cb4c504
black formatting
bmaranvilleMay 9, 2025
6f777ef
black formatting
bmaranvilleMay 9, 2025
6be6f28
revert this file - it is auto-generated
bmaranvilleMay 9, 2025
1b99411
cleanup
bmaranvilleMay 9, 2025
03d85de
use ValidatorCache for generated Layout validators
bmaranvilleMay 9, 2025
f8daca4
black formatting
bmaranvilleMay 9, 2025
0184bd4
feat: regenerating validators with all recent changes
gvwilsonJun 4, 2025
513337c
fix: address code review issues
emilyklJun 4, 2025
37c387e
fix path to _validators.json
emilyklJun 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,7 +55,7 @@ See the [Python documentation](https://plotly.com/python/) for more examples.

Built on top of [plotly.js](https://.com/plotly/plotly.js), `plotly.py` is a high-level, declarative charting library. plotly.js ships with over 30 chart types, including scientific charts, 3D graphs, statistical charts, SVG maps, financial charts, and more.

`plotly.py` is [MIT Licensed](https://.com/plotly/plotly.py/blob/main/LICENSE.txt). Plotly graphs can be viewed in Jupyter and marimo notebooks, standalone HTML files, or integrated into [Dash applications](https://dash.plotly.com/).
`plotly.py` is [MIT Licensed](https://.com/plotly/plotly.py/blob/main/LICENSE.txt). Plotly graphs can be viewed in [Jupyter notebooks](https://jupyter.org), other Python notebook software such as [marimo](https://marimo.io), as standalone HTML files, or integrated into [Dash applications](https://dash.plotly.com/).

[Contact us](https://plotly.com/consulting-and-oem/) for consulting, dasard development, application integration, and feature additions.

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,8 +21,9 @@
build_from_imports_py,
)
from codegen.validators import (
write_validator_py,
write_data_validator_py,
get_data_validator_params,
get_validator_params,
write_validator_json,
get_data_validator_instance,
)

Expand DownExpand Up@@ -171,22 +172,27 @@ def perform_codegen(reformat=True):
if node.is_compound and not isinstance(node, ElementDefaultsNode)
]

validator_params = {}
# Write out validators
# --------------------
# # ### Layout ###
for node in all_layout_nodes:
write_validator_py(outdir, node)
get_validator_params(node, validator_params)

# ### Trace ###
for node in all_trace_nodes:
write_validator_py(outdir, node)
get_validator_params(node, validator_params)

# ### Frames ###
for node in all_frame_nodes:
write_validator_py(outdir, node)
get_validator_params(node, validator_params)

# ### Data (traces) validator ###
write_data_validator_py(outdir, base_traces_node)
get_data_validator_params(base_traces_node, validator_params)

# Write out the JSON data for the validators
os.makedirs(validators_pkgdir, exist_ok=True)
write_validator_json(outdir, validator_params)

# Alls
# ----
Expand DownExpand Up@@ -217,27 +223,6 @@ def perform_codegen(reformat=True):
layout_array_nodes,
)

# Write validator __init__.py files
# ---------------------------------
# ### Write __init__.py files for each validator package ###
validator_rel_class_imports = {}
for node in all_datatype_nodes:
if node.is_mapped:
continue
key = node.parent_path_parts
validator_rel_class_imports.setdefault(key, []).append(
f"._{node.name_property}.{node.name_validator_class}"
)

# Add Data validator
root_validator_pairs = validator_rel_class_imports[()]
root_validator_pairs.append("._data.DataValidator")

# Output validator __init__.py files
validators_pkg = opath.join(outdir, "validators")
for path_parts, rel_classes in validator_rel_class_imports.items():
write_init_py(validators_pkg, path_parts, [], rel_classes)

# Write datatype __init__.py files
# --------------------------------
datatype_rel_class_imports = {}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,14 +130,11 @@ class {datatype_class}(_{node.name_base_datatype}):\n"""
"""
)

subplot_validator_names = [n.name_validator_class for n in subplot_nodes]

validator_csv = ", ".join(subplot_validator_names)
subplot_dict_str = (
"{"
+ ", ".join(
f"'{subname}': {valname}"
for subname, valname in zip(subplot_names, subplot_validator_names)
f'"{subname}": ValidatorCache.get_validator("layout", "{subname}")'
for subname in subplot_names
)
+ "}"
)
Expand All@@ -153,7 +150,7 @@ def _subplotid_validators(self):
-------
dict
\"\"\"
from plotly.validators.layout import ({validator_csv})
from plotly.validator_cache import ValidatorCache

return {subplot_dict_str}

Expand Down
Loading