Skip to content

Commit 0d0f72d

Browse files
authored
Merge pull request #1836 from plotly/old-import-extras
Old import extras
2 parents 4bdc6e9 + dfdc549 commit 0d0f72d

File tree

9 files changed

+100
-223
lines changed

9 files changed

+100
-223
lines changed

CHANGELOG.md

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
44

55
## [Unreleased]
66

7-
- [#1822](https://github.com/plotly/dash/pull/1822) Remove Radium from renderer dependencies, as part of investigating React 17 support.
7+
### Changed
88

99
- [#1745](https://github.com/plotly/dash/pull/1745):
1010
Improve our `extras_require`: there are now five options here, each with a well-defined role:
@@ -14,9 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1414
- `dash[celery]`: required if you use `CeleryLongCallbackManager`
1515
- `dash[ci]`: mainly for internal use, these are additional requirements for the Dash CI tests, exposed for other component libraries to use a matching configuration.
1616

17-
- [#1779](https://github.com/plotly/dash/pull/1779):
18-
- Clean up our handling of serialization problems, including fixing `orjson` for Python 3.6
19-
- Added the ability for `dash.testing` `percy_snapshot` methods to choose widths to generate.
17+
### Added
2018

2119
- [#1763](https://github.com/plotly/dash/pull/1763):
2220
## Dash and Dash Renderer
@@ -30,21 +28,21 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3028

3129
@dash.callback(Output(my_output, 'children'), Input(my_input, 'value'))
3230
def update(value):
33-
return f'You have entered {value}'
31+
return f'You have entered {value}'
3432
```
3533

3634
Or, if using Python >=3.8 you can use the `:=` walrus operator:
3735
```python
3836
app.layout = html.Div([
39-
my_input := dcc.Input(),
40-
my_output := html.Div()
37+
my_input := dcc.Input(),
38+
my_output := html.Div()
4139
])
4240

4341
@dash.callback(Output(my_output, 'children'), Input(my_input, 'value'))
4442
def update(value):
45-
return f'You have entered {value}'
46-
43+
return f'You have entered {value}'
4744
```
45+
4846
## Dash Core Components
4947

5048
### Rearranged Keyword Arguments & Flexible Types
@@ -58,22 +56,23 @@ This project adheres to [Semantic Versioning](https://semver.org/).
5856

5957
```python
6058
dcc.Dropdown(
61-
options=[
62-
{'label': 'New York', 'value': 'New York'},
63-
{'label': 'Montreal', 'value': 'Montreal'},
64-
],
65-
value='New York'
59+
options=[
60+
{'label': 'New York', 'value': 'New York'},
61+
{'label': 'Montreal', 'value': 'Montreal'},
62+
],
63+
value='New York'
6664
)
67-
```
65+
```
66+
6867
or
6968

7069
```python
7170
dcc.Dropdown(
72-
options=[
73-
{'label': 'New York', 'value': 'NYC'},
74-
{'label': 'Montreal', 'value': 'MTL'},
75-
],
76-
value='New York'
71+
options=[
72+
{'label': 'New York', 'value': 'NYC'},
73+
{'label': 'Montreal', 'value': 'MTL'},
74+
],
75+
value='New York'
7776
)
7877
```
7978

@@ -82,6 +81,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
8281
```python
8382
dcc.Dropdown(['New York', 'Montreal'], 'New York')
8483
```
84+
8585
Or
8686

8787
```python
@@ -102,14 +102,19 @@ This project adheres to [Semantic Versioning](https://semver.org/).
102102
```
103103

104104
After:
105+
105106
```python
106107
dcc.Slider(min=1, max=3, step=1)
107108
```
109+
108110
Or equivalently:
111+
109112
```python
110113
dcc.Slider(1, 3, 1)
111114
```
115+
112116
Step can also be omitted and the `Slider` will attempt to create a nice, human readable step with SI units and around 5 marks:
117+
113118
```python
114119
dcc.Slider(0, 100)
115120
```
@@ -137,6 +142,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
137142
```python
138143
dash_table.DataTable(data=df.to_dict('records'), columns=[{'name': i, 'id': i} for i in df.columns])
139144
```
145+
140146
After:
141147

142148
```python
@@ -153,6 +159,16 @@ This project adheres to [Semantic Versioning](https://semver.org/).
153159
dcc.Checklist(inline=True)
154160
```
155161

162+
### Fixed
163+
164+
- [#1836](https://github.com/plotly/dash/pull/1836) Fix `__all__` in dcc and table for extras: dcc download helpers and table format helpers. This also restores this functionality to the obsolete top-level packages `dash_core_components` and `dash_table`.
165+
166+
- [#1822](https://github.com/plotly/dash/pull/1822) Remove Radium from renderer dependencies, as part of investigating React 17 support.
167+
168+
- [#1779](https://github.com/plotly/dash/pull/1779):
169+
- Clean up our handling of serialization problems, including fixing `orjson` for Python 3.6
170+
- Added the ability for `dash.testing` `percy_snapshot` methods to choose widths to generate.
171+
156172
## [2.0.0] - 2021-08-03
157173

158174
## Dash and Dash Renderer

components/dash-core-components/README.md

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,19 @@ This package provides the core React component suite for [Dash][].
66

77
## Development
88

9-
The `dash` package contains some tools to build components and drive the bundles build process.
10-
To avoid the circular dependency situation, we don't add `dash` as a required install in the `dash-core-components` setup.
11-
But, in order to do development locally, you need to install `dash` before everything.
12-
13-
1. Install the dependencies with:
9+
This package is part of `dash`, and if you install `dash` in development mode with extras as below, you can develop in this portion as well.
10+
From the root of the `dash` repo:
1411

1512
```bash
16-
# it's recommended to install your python packages in a virtualenv
17-
# python 2
18-
$ pip install virtualenv --user && virtualenv venv && . venv/bin/activate
19-
# python 3
13+
# It's recommended to install your python packages in a virtualenv
14+
# As of dash 2.0, python 3 is required
2015
$ python -m venv venv && . venv/bin/activate
2116

2217
# make sure dash is installed with dev and testing dependencies
23-
$ pip install dash[dev,testing] # in some shells you need \ to escape []
18+
$ pip install -e .[dev,testing] # in some shells you need \ to escape []
2419

25-
# run the build process
26-
$ npm i --ignore-scripts && npm run build
20+
# run the build process - this will build all of dash, including dcc
21+
$ npm i && npm run build
2722

2823
# install dcc in editable mode
2924
$ pip install -e .
@@ -46,22 +41,6 @@ npm test
4641
# Import dash_core_components to your layout, then run it:
4742
$ python my_dash_layout.py
4843

49-
## Uninstalling python package locally
50-
51-
```sh
52-
$ npm run uninstall-local
53-
```
54-
55-
## Publishing
56-
57-
There's an npm script that will handle publish, provided you have the right credentials. You can run it by running
58-
59-
```sh
60-
$ npm run publish-all
61-
```
62-
63-
See the [Publishing New Components/Features](CONTRIBUTING.md#publishing-new-componentsfeatures) section of the Contributing guide for step-by-step instructions on publishing new components.
64-
6544
## Dash Component Boilerplate
6645

6746
See the [dash-component-boilerplate](https://github.com/plotly/dash-component-boilerplate) repo for more information.

components/dash-core-components/dash_core_components_base/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@
44
import dash as _dash
55

66
from ._imports_ import * # noqa: F401, F403, E402
7-
from ._imports_ import __all__ # noqa: E402
7+
from ._imports_ import __all__ as _components
88
from .express import ( # noqa: F401, E402
99
send_bytes,
1010
send_data_frame,
1111
send_file,
1212
send_string,
1313
)
1414

15+
__all__ = _components + [
16+
"send_bytes",
17+
"send_data_frame",
18+
"send_file",
19+
"send_string",
20+
]
21+
1522
_basepath = _os.path.dirname(__file__)
1623
_filepath = _os.path.abspath(_os.path.join(_basepath, "package-info.json"))
1724
with open(_filepath) as f:

components/dash-core-components/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"test": "run-s -c lint test:intg test:pyimport",
2424
"test:intg": "pytest --nopercyfinalize --headless tests/integration",
2525
"test:pyimport": "python -m unittest tests/test_dash_import.py",
26-
"uninstall-local": "pip uninstall dash-core-components -y",
2726
"prebuild:js": "cp node_modules/plotly.js/dist/plotly.min.js dash_core_components_base/plotly.min.js",
2827
"build:js": "webpack --mode production",
2928
"build:backends": "dash-generate-components ./src/components dash_core_components -p package-info.json && cp dash_core_components_base/** dash_core_components/ && dash-generate-components ./src/components dash_core_components -p package-info.json --r-prefix 'dcc' --r-suggests 'dash,dashHtmlComponents,jsonlite,plotly' --jl-prefix 'dcc' && black dash_core_components",

components/dash-table/CONTRIBUTING.md

Lines changed: 0 additions & 80 deletions
This file was deleted.

components/dash-table/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ An interactive `DataTable` for [Dash](https://dash.plotly.com/).
77
## Quickstart
88

99
```
10-
pip install dash-table
10+
pip install dash
1111
```
1212

1313
```python
14-
import dash
15-
import dash_table
14+
from dash import Dash, dash_table
1615
import pandas as pd
1716

1817
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
1918

20-
app = dash.Dash(__name__)
19+
app = Dash(__name__)
2120

2221
app.layout = dash_table.DataTable(
2322
id='table',
@@ -41,7 +40,7 @@ This component was written from scratch in React.js and Typescript specifically
4140

4241
DataTable was designed with a featureset that allows that Dash users to create complex, spreadsheet driven applications with no compromises. We're excited to continue to work with users and companies that [invest in DataTable's future](https://plotly.com/products/consulting-and-oem/).
4342

44-
Please subscribe to [dash-table#207](https://github.com/plotly/dash-table/issues/207) and the [CHANGELOG.md](https://github.com/plotly/dash-table/blob/master/CHANGELOG.md) to stay up-to-date with any breaking changes. Note: DataTable is currently supported in Chrome, Firefox, Safari, Edge (version 15+), and Internet Explorer 11.
43+
Note: DataTable is currently supported in Chrome, Firefox, Safari, Edge (version 15+), and Internet Explorer 11.
4544

4645
Share your DataTable Dash apps on the [community forum](https://community.plotly.com/t/show-and-tell-community-thread/7554)!
4746

components/dash-table/dash_table_base/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
_sys.exit(1)
1515

1616
from ._imports_ import * # noqa: E402, F401, F403
17-
from ._imports_ import __all__ # noqa: E402
17+
from ._imports_ import __all__ as _components
1818
from . import Format # noqa: F401, E402
1919
from . import FormatTemplate # noqa: F401, E402
2020

21+
__all__ = _components + ["Format", "FormatTemplate"]
22+
2123
_basepath = _os.path.dirname(__file__)
2224
_filepath = _os.path.abspath(_os.path.join(_basepath, "package-info.json"))
2325
with open(_filepath) as f:

0 commit comments

Comments
 (0)