Skip to content

Commit 513337c

Browse files
emilyklgvwilson
authored andcommitted
fix: address code review issues
- fix black exclude parameter in pyproject.toml to properly exclude ONLY directories - reintroduce py38 in codegen/__init__.py - remove commented-out lines - add plotly/validators/_validators.json to pyproject.toml - regenerate code
1 parent 0184bd4 commit 513337c

File tree

6 files changed

+5243
-14
lines changed

6 files changed

+5243
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ See the [Python documentation](https://plotly.com/python/) for more examples.
5555

5656
Built on top of [plotly.js](https://github.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.
5757

58-
`plotly.py` is [MIT Licensed](https://github.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/).
58+
`plotly.py` is [MIT Licensed](https://github.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/).
5959

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

codegen/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
# Target Python version for code formatting with Black.
3131
# Must be one of the values listed in pyproject.toml.
32-
BLACK_TARGET_VERSIONS = "py39 py310 py311 py312"
32+
BLACK_TARGET_VERSIONS = "py38 py39 py310 py311 py312"
3333

3434

3535
# Import notes

codegen/validators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def write_validator_json(outdir, params: dict):
8585
filepath = opath.join(outdir, "validators", "_validators.json")
8686
with open(filepath, "w") as f:
8787
f.write(json.dumps(params, indent=4))
88-
# f.write(str(params))
8988

9089

9190
def build_data_validator_params(base_trace_node: TraceNode):

plotly/basedatatypes.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,9 @@ class is a subclass of both BaseFigure and widgets.DOMWidget.
470470
"""
471471
from .validator_cache import ValidatorCache
472472

473-
DataValidator = ValidatorCache.get_validator("", "data")
474-
FramesValidator = ValidatorCache.get_validator("", "frames")
475-
LayoutValidator = ValidatorCache.get_validator("", "layout")
476-
# from .validators import DataValidator, LayoutValidator, FramesValidator
473+
data_validator = ValidatorCache.get_validator("", "data")
474+
frames_validator = ValidatorCache.get_validator("", "frames")
475+
layout_validator = ValidatorCache.get_validator("", "layout")
477476

478477
super(BaseFigure, self).__init__()
479478

@@ -526,8 +525,8 @@ class is a subclass of both BaseFigure and widgets.DOMWidget.
526525
# This is the validator that handles importing sequences of trace
527526
# objects
528527
# We make a copy because we are overriding the set_uid attribute
529-
# and do not want to alter all other uses of the cached DataValidator
530-
self._data_validator = copy(DataValidator)
528+
# and do not want to alter all other uses of the cached data_validator
529+
self._data_validator = copy(data_validator)
531530
self._data_validator.set_uid = self._set_trace_uid
532531

533532
# ### Import traces ###
@@ -571,7 +570,7 @@ class is a subclass of both BaseFigure and widgets.DOMWidget.
571570
# ------
572571
# ### Construct layout validator ###
573572
# This is the validator that handles importing Layout objects
574-
self._layout_validator = LayoutValidator
573+
self._layout_validator = layout_validator
575574

576575
# ### Import Layout ###
577576
self._layout_obj = self._layout_validator.validate_coerce(
@@ -606,7 +605,7 @@ class is a subclass of both BaseFigure and widgets.DOMWidget.
606605
# ### Construct frames validator ###
607606
# This is the validator that handles importing sequences of frame
608607
# objects
609-
self._frames_validator = FramesValidator
608+
self._frames_validator = frames_validator
610609

611610
# ### Import frames ###
612611
self._frame_objs = self._frames_validator.validate_coerce(

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ plotly = [
6363
"package_data/*",
6464
"package_data/templates/*",
6565
"package_data/datasets/*",
66+
"plotly/validators/_validators.json"
6667
]
6768

6869
[tool.black]
6970
line-length = 88
7071
target_version = ['py38', 'py39', 'py310', 'py311', 'py312']
7172
include = '\.pyi?$'
7273
exclude = '''
73-
74-
(
74+
/(
7575
\.eggs # exclude a few common directories in the
7676
| \.git # root of the project
7777
| \.hg
@@ -85,7 +85,7 @@ exclude = '''
8585
| js
8686
| submodules
8787
| plotly/matplotlylib/mplexporter
88-
)
88+
)/
8989
'''
9090

9191
[tool.jupyter-packaging.builder]

0 commit comments

Comments
 (0)