Skip to content

Fix bugs in 0.23.1 #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@

## 0.24.1 - 2018-08-10
## Fixed
- Fixed bug in 0.23.1 where importing Dash components with no props would result in an error. (Fixes [#321](https://github.com/plotly/dash/issues/321)).
- Fixed bug in 0.23.1 where importing components with arguments that are python keywords could cause an error. In particular, this fixes `dash-html-components` while using Python 3.7.

## 0.24.0 - 2018-08-10
## Added
- Add a modified time query string to the assets included in the index in order to bust the cache. [#319](https://github.com/plotly/dash/pull/309)


## 0.23.1 - 2018-08-02
## Added
- Add ie-compat meta tag to the index by default. [#316](https://github.com/plotly/dash/pull/316)
- Add `external_script` and `external_css` keywords to dash `__init__`. [#305](https://github.com/plotly/dash/pull/305)

## 0.23.0 - 2018-08-01
## Added
- Dash components are now generated at build-time and then imported rather than generated when a module is imported. This should reduce the time it takes to import Dash component libraries, and makes Dash compatible with IDEs.

## 0.22.1 - 2018-08-01
Expand Down
6 changes: 4 additions & 2 deletions dash/development/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import copy
import os
import inspect
import keyword


def is_number(s):
Expand Down Expand Up @@ -303,7 +304,7 @@ def generate_class_string(typename, props, description, namespace):
c = '''class {typename}(Component):
"""{docstring}"""
@_explicitize_args
def __init__(self, {default_argtext}, **kwargs):
def __init__(self, {default_argtext}):
self._prop_names = {list_of_valid_keys}
self._type = '{typename}'
self._namespace = '{namespace}'
Expand Down Expand Up @@ -378,7 +379,8 @@ def __repr__(self):
'{:s}=Component.UNDEFINED'.format(p))
for p in prop_keys
if not p.endswith("-*") and
p not in ['dashEvents', 'fireEvent', 'setProps']]
p not in keyword.kwlist and
p not in ['dashEvents', 'fireEvent', 'setProps']] + ['**kwargs']
)

required_args = required_props(props)
Expand Down
2 changes: 1 addition & 1 deletion dash/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.24.0'
__version__ = '0.24.1'
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dash_core_components>=0.4.0
dash_html_components>=0.11.0rc1
dash_flow_example==0.0.3
dash-dangerously-set-inner-html
dash_renderer
percy
selenium
Expand Down
7 changes: 7 additions & 0 deletions tests/development/metadata_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@
"required": false,
"description": ""
},
"in": {
"type": {
"name": "string"
},
"required": false,
"description": ""
},
"id": {
"type": {
"name": "string"
Expand Down
5 changes: 3 additions & 2 deletions tests/development/metadata_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@ class Table(Component):
- customArrayProp (list; optional)
- data-* (string; optional)
- aria-* (string; optional)
- in (string; optional)
- id (string; optional)

Available events: 'restyle', 'relayout', 'click'"""
@_explicitize_args
def __init__(self, children=None, optionalArray=Component.UNDEFINED, optionalBool=Component.UNDEFINED, optionalFunc=Component.UNDEFINED, optionalNumber=Component.UNDEFINED, optionalObject=Component.UNDEFINED, optionalString=Component.UNDEFINED, optionalSymbol=Component.UNDEFINED, optionalNode=Component.UNDEFINED, optionalElement=Component.UNDEFINED, optionalMessage=Component.UNDEFINED, optionalEnum=Component.UNDEFINED, optionalUnion=Component.UNDEFINED, optionalArrayOf=Component.UNDEFINED, optionalObjectOf=Component.UNDEFINED, optionalObjectWithShapeAndNestedDescription=Component.UNDEFINED, optionalAny=Component.UNDEFINED, customProp=Component.UNDEFINED, customArrayProp=Component.UNDEFINED, id=Component.UNDEFINED, **kwargs):
self._prop_names = ['children', 'optionalArray', 'optionalBool', 'optionalNumber', 'optionalObject', 'optionalString', 'optionalNode', 'optionalElement', 'optionalEnum', 'optionalUnion', 'optionalArrayOf', 'optionalObjectOf', 'optionalObjectWithShapeAndNestedDescription', 'optionalAny', 'customProp', 'customArrayProp', 'data-*', 'aria-*', 'id']
self._prop_names = ['children', 'optionalArray', 'optionalBool', 'optionalNumber', 'optionalObject', 'optionalString', 'optionalNode', 'optionalElement', 'optionalEnum', 'optionalUnion', 'optionalArrayOf', 'optionalObjectOf', 'optionalObjectWithShapeAndNestedDescription', 'optionalAny', 'customProp', 'customArrayProp', 'data-*', 'aria-*', 'in', 'id']
self._type = 'Table'
self._namespace = 'TableComponents'
self._valid_wildcard_attributes = ['data-', 'aria-']
self.available_events = ['restyle', 'relayout', 'click']
self.available_properties = ['children', 'optionalArray', 'optionalBool', 'optionalNumber', 'optionalObject', 'optionalString', 'optionalNode', 'optionalElement', 'optionalEnum', 'optionalUnion', 'optionalArrayOf', 'optionalObjectOf', 'optionalObjectWithShapeAndNestedDescription', 'optionalAny', 'customProp', 'customArrayProp', 'data-*', 'aria-*', 'id']
self.available_properties = ['children', 'optionalArray', 'optionalBool', 'optionalNumber', 'optionalObject', 'optionalString', 'optionalNode', 'optionalElement', 'optionalEnum', 'optionalUnion', 'optionalArrayOf', 'optionalObjectOf', 'optionalObjectWithShapeAndNestedDescription', 'optionalAny', 'customProp', 'customArrayProp', 'data-*', 'aria-*', 'in', 'id']
self.available_wildcard_properties = ['data-', 'aria-']

_explicit_args = kwargs.pop('_explicit_args')
Expand Down
3 changes: 3 additions & 0 deletions tests/development/test_base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,8 @@ def setUp(self):

['aria-*', 'string'],

['in', 'string'],

['id', 'string'],

['dashEvents', "a value equal to: 'restyle', 'relayout', 'click'"]
Expand Down Expand Up @@ -885,6 +887,7 @@ def assert_docstring(assertEqual, docstring):
"- customArrayProp (list; optional)",
'- data-* (string; optional)',
'- aria-* (string; optional)',
'- in (string; optional)',
'- id (string; optional)',
'',
"Available events: 'restyle', 'relayout', 'click'",
Expand Down
12 changes: 12 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import dash_html_components as html
import dash_core_components as dcc
import dash_flow_example
import dash_dangerously_set_inner_html

import dash
import time
Expand Down Expand Up @@ -235,6 +236,17 @@ def test_wildcard_data_attributes(self):

assert_clean_console(self)

def test_no_props_component(self):
app = dash.Dash()
app.layout = html.Div([
dash_dangerously_set_inner_html.DangerouslySetInnerHTML('''
<h1>No Props Component</h1>
''')
])
self.startServer(app)
assert_clean_console(self)
self.percy_snapshot(name='no-props-component')

def test_flow_component(self):
app = dash.Dash()

Expand Down