Skip to content

Commit db5c910

Browse files
authored
HiPlot version 0.1.4 (facebookresearch#22)
- Test wheel/package in CircleCI - Add credits to README - The export button will download data as a CSV directly (instead of opening a new window)
1 parent 3ad2d7a commit db5c910

File tree

6 files changed

+42
-7
lines changed

6 files changed

+42
-7
lines changed

.circleci/config.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,14 @@ jobs:
233233
python3 -m venv venv
234234
. venv/bin/activate
235235
pip install -r requirements/dev.txt
236+
pip install -r requirements/main.txt
236237
- run:
237238
name: verify git tag vs. version
238239
command: |
239240
. venv/bin/activate
241+
echo "CIRCLE_TAG = $CIRCLE_TAG"
242+
export CIRCLE_TAG=${CIRCLE_TAG:-`cat hiplot/__init__.py | grep __version__ | cut -d\" -f2`}
243+
echo "Set CIRCLE_TAG = $CIRCLE_TAG"
240244
python setup.py verify
241245
- run:
242246
name: create packages
@@ -248,6 +252,16 @@ jobs:
248252
# create a wheel
249253
python setup.py bdist_wheel
250254
mv dist pypi-build
255+
- run:
256+
name: Run wheel and check package
257+
command: |
258+
python -c "from pathlib import Path;files = Path('hiplot.egg-info/SOURCES.txt').read_text().split(); assert 'LICENSE' in files"
259+
python3 -m venv test_wheel
260+
. test_wheel/bin/activate
261+
cd ..
262+
ls
263+
pip install project/pypi-build/dist/hiplot-*any.whl
264+
python -c "import hiplot as hip; hip.Experiment"
251265
- run:
252266
name: verify package
253267
command: |
@@ -343,9 +357,7 @@ workflows:
343357
- npm-build
344358
filters:
345359
tags:
346-
only: /(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)/
347-
branches:
348-
ignore: /.*/
360+
only: /.*/
349361
- pypi-deploy:
350362
requires:
351363
- pypi-build

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include LICENSE README.md
2+
include requirements/*.txt
3+
include hiplot/static/built/hiplot.bundle.js

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@ hip.Experiment.from_iterable(data).display()
3636
* Pypi package: https://pypi.org/project/hiplot/
3737
* NPM package: https://www.npmjs.com/package/hiplot
3838

39+
## Credits
40+
Inspired by and based on code from [Kai Chang](http://bl.ocks.org/syntagmatic/3150059), [Mike Bostock](http://bl.ocks.org/1341021) and [Jason Davies](http://bl.ocks.org/1341281").
41+
3942
## License
4043
HiPlot is [MIT](LICENSE) licensed, as found in the [LICENSE](LICENSE) file.

docs/getting_started.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Once we have created this object, we can display it with :class:`hiplot.Experime
7373
Option 2: Use HiPlot webserver
7474
-------------------------------
7575

76+
Within the activated environment, use the following command to run HiPlot server:
77+
7678
>>> hiplot
7779

7880

hiplot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
from .server import run_server, run_server_main
88
from . import fetchers
99

10-
__version__ = "0.1.3"
10+
__version__ = "0.1.4"

src/controls.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,26 @@ export class ExcludeDataBtn extends React.Component<HiPlotDataControlProps, HiPl
7878
}
7979
};
8080

81+
function downloadURL(url: string, filename: string) {
82+
var element = document.createElement('a');
83+
element.setAttribute('href', url);
84+
element.setAttribute('download', filename);
85+
86+
element.style.display = 'none';
87+
document.body.appendChild(element);
88+
89+
element.click();
90+
91+
document.body.removeChild(element);
92+
}
93+
8194
export class ExportDataCSVBtn extends React.Component<HiPlotDataControlProps, HiPlotDataControlState> {
8295
onClick() {
83-
var csv: string = d3.csvFormat(this.props.rows['selected'].get()).replace(/\n/g,"<br/>\n");
84-
var styles = "<style>body { font-family: sans-serif; font-size: 12px; }</style>";
85-
window.open("text/csv").document.write(styles + csv);
96+
var all_selected = this.props.rows['selected'].get();
97+
var csv: string = d3.csvFormat(all_selected);
98+
var blob = new Blob([csv], {type: "text/csv"});
99+
var url = window.URL.createObjectURL(blob);
100+
downloadURL(url, `hiplot-selected-${all_selected.length}.csv`);
86101
}
87102

88103
render() {

0 commit comments

Comments
 (0)