Skip to content
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

Old import extras #1836

Merged
merged 3 commits into from
Nov 17, 2021
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
56 changes: 36 additions & 20 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

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

- [#1745](https://github.com/plotly/dash/pull/1745):
Improve our `extras_require`: there are now five options here, each with a well-defined role:
Expand All @@ -14,9 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- `dash[celery]`: required if you use `CeleryLongCallbackManager`
- `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.

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

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

@dash.callback(Output(my_output, 'children'), Input(my_input, 'value'))
def update(value):
return f'You have entered {value}'
return f'You have entered {value}'
```

Or, if using Python >=3.8 you can use the `:=` walrus operator:
```python
app.layout = html.Div([
my_input := dcc.Input(),
my_output := html.Div()
my_input := dcc.Input(),
my_output := html.Div()
])

@dash.callback(Output(my_output, 'children'), Input(my_input, 'value'))
def update(value):
return f'You have entered {value}'

return f'You have entered {value}'
```

## Dash Core Components

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

```python
dcc.Dropdown(
options=[
{'label': 'New York', 'value': 'New York'},
{'label': 'Montreal', 'value': 'Montreal'},
],
value='New York'
options=[
{'label': 'New York', 'value': 'New York'},
{'label': 'Montreal', 'value': 'Montreal'},
],
value='New York'
)
```
```

or

```python
dcc.Dropdown(
options=[
{'label': 'New York', 'value': 'NYC'},
{'label': 'Montreal', 'value': 'MTL'},
],
value='New York'
options=[
{'label': 'New York', 'value': 'NYC'},
{'label': 'Montreal', 'value': 'MTL'},
],
value='New York'
)
```

Expand All @@ -82,6 +81,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
```python
dcc.Dropdown(['New York', 'Montreal'], 'New York')
```

Or

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

After:

```python
dcc.Slider(min=1, max=3, step=1)
```

Or equivalently:

```python
dcc.Slider(1, 3, 1)
```

Step can also be omitted and the `Slider` will attempt to create a nice, human readable step with SI units and around 5 marks:

```python
dcc.Slider(0, 100)
```
Expand Down Expand Up @@ -137,6 +142,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
```python
dash_table.DataTable(data=df.to_dict('records'), columns=[{'name': i, 'id': i} for i in df.columns])
```

After:

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

### Fixed

- [#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`.

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

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

## [2.0.0] - 2021-08-03

## Dash and Dash Renderer
Expand Down
35 changes: 7 additions & 28 deletions components/dash-core-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,19 @@ This package provides the core React component suite for [Dash][].

## Development

The `dash` package contains some tools to build components and drive the bundles build process.
To avoid the circular dependency situation, we don't add `dash` as a required install in the `dash-core-components` setup.
But, in order to do development locally, you need to install `dash` before everything.

1. Install the dependencies with:
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.
From the root of the `dash` repo:

```bash
# it's recommended to install your python packages in a virtualenv
# python 2
$ pip install virtualenv --user && virtualenv venv && . venv/bin/activate
# python 3
# It's recommended to install your python packages in a virtualenv
# As of dash 2.0, python 3 is required
$ python -m venv venv && . venv/bin/activate

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

# run the build process
$ npm i --ignore-scripts && npm run build
# run the build process - this will build all of dash, including dcc
$ npm i && npm run build

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

## Uninstalling python package locally

```sh
$ npm run uninstall-local
```

## Publishing

There's an npm script that will handle publish, provided you have the right credentials. You can run it by running

```sh
$ npm run publish-all
```

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.

## Dash Component Boilerplate

See the [dash-component-boilerplate](https://github.com/plotly/dash-component-boilerplate) repo for more information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@
import dash as _dash

from ._imports_ import * # noqa: F401, F403, E402
from ._imports_ import __all__ # noqa: E402
from ._imports_ import __all__ as _components
from .express import ( # noqa: F401, E402
send_bytes,
send_data_frame,
send_file,
send_string,
)

__all__ = _components + [
"send_bytes",
"send_data_frame",
"send_file",
"send_string",
]

_basepath = _os.path.dirname(__file__)
_filepath = _os.path.abspath(_os.path.join(_basepath, "package-info.json"))
with open(_filepath) as f:
Expand Down
1 change: 0 additions & 1 deletion components/dash-core-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"test": "run-s -c lint test:intg test:pyimport",
"test:intg": "pytest --nopercyfinalize --headless tests/integration",
"test:pyimport": "python -m unittest tests/test_dash_import.py",
"uninstall-local": "pip uninstall dash-core-components -y",
"prebuild:js": "cp node_modules/plotly.js/dist/plotly.min.js dash_core_components_base/plotly.min.js",
"build:js": "webpack --mode production",
"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",
Expand Down
80 changes: 0 additions & 80 deletions components/dash-table/CONTRIBUTING.md

This file was deleted.

9 changes: 4 additions & 5 deletions components/dash-table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ An interactive `DataTable` for [Dash](https://dash.plotly.com/).
## Quickstart

```
pip install dash-table
pip install dash
```

```python
import dash
import dash_table
from dash import Dash, dash_table
import pandas as pd

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

app = dash.Dash(__name__)
app = Dash(__name__)

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

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/).

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.
Note: DataTable is currently supported in Chrome, Firefox, Safari, Edge (version 15+), and Internet Explorer 11.

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

Expand Down
4 changes: 3 additions & 1 deletion components/dash-table/dash_table_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
_sys.exit(1)

from ._imports_ import * # noqa: E402, F401, F403
from ._imports_ import __all__ # noqa: E402
from ._imports_ import __all__ as _components
from . import Format # noqa: F401, E402
from . import FormatTemplate # noqa: F401, E402

__all__ = _components + ["Format", "FormatTemplate"]

_basepath = _os.path.dirname(__file__)
_filepath = _os.path.abspath(_os.path.join(_basepath, "package-info.json"))
with open(_filepath) as f:
Expand Down
Loading