Skip to content

Commit

Permalink
changes to installation & release cleanup
Browse files Browse the repository at this point in the history
* conform to PEP8 naming convention luxWidget --> luxwidget
* bump version to 0.1.0
* switching from NPM to PyPI package (improved setup.py)
* added license header
  • Loading branch information
dorisjlee committed Oct 9, 2020
1 parent cc0f04e commit c36118d
Show file tree
Hide file tree
Showing 23 changed files with 207 additions and 85 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include luxWidget/nbextension/static/*.*
include luxwidget/nbextension/static/*.*
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<p align="center"><a href="#"><img width=77% alt="" src="https://github.com/lux-org/lux-resources/blob/master/readme_img/logo.png?raw=true"></a></p>

<p align="center">
<!-- <p align="center">
<a href="https://badge.fury.io/js/lux-widget"><img src="https://badge.fury.io/js/lux-widget.svg" alt="npm version" height="18" align="center"></a>
</p>
</p> -->

Lux is a library that makes data science easier by automating certain aspects of the data exploration process. Lux is designed to facilitate faster experimentation with data, even when the user does not have a clear idea of what they are looking for.

Expand All @@ -19,15 +19,23 @@ You can find the full demo example in this live [notebook](https://mybinder.org/

# Installation

To get started, install the Lux Jupyter widget through [npm](https://www.npmjs.com/package/lux-widget):
If you don't yet have Jupyter, you should first [install Jupyter](https://jupyter.org/install).
To get started, the Lux Jupyter widget can be installed through PyPI:

```bash
npm i lux-widget
pip install lux-widget
```

To install and activate the Jupyter notebook extension:

```bash
jupyter nbextension install --sys-prefix --symlink --overwrite --py luxwidget
jupyter nbextension enable --sys-prefix --py luxwidget
```

### Dev Installation

To install the widget for dev purposes, we need to install webpack:
To install the widget for dev purposes, we need to install npm and webpack:

```bash
npm install --save-dev webpack webpack-cli
Expand Down
6 changes: 3 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#npm install # run only for the first time
npx webpack # builds tsx --> ts --> js
pip install . # builds python wheel and copies relevant js files to luxWidget/
pip install . # builds python wheel and copies relevant js files to luxwidget/
# When rebuild, these two lines don't need to be rerun since the code is symlinked
jupyter nbextension install --sys-prefix --symlink --overwrite --py luxWidget
jupyter nbextension enable --sys-prefix --py luxWidget
jupyter nbextension install --sys-prefix --symlink --overwrite --py luxwidget
jupyter nbextension enable --sys-prefix --py luxwidget
2 changes: 1 addition & 1 deletion luxWidget/_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
Information about the frontend package of the widgets.
"""

module_name = "luxWidget"
module_name = "luxwidget"
module_version = "^0.0.1"
4 changes: 2 additions & 2 deletions luxWidget/nbextension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def _jupyter_nbextension_paths():
return [{
'section': 'notebook',
'src': 'nbextension/static',
'dest': 'luxWidget',
'require': 'luxWidget/extension'
'dest': 'luxwidget',
'require': 'luxwidget/extension'
}]
2 changes: 1 addition & 1 deletion luxWidget/nbextension/static/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define(function() {
window['requirejs'].config({
map: {
'*': {
'luxWidget': 'nbextensions/luxWidget/index',
'luxwidget': 'nbextensions/luxwidget/index',
},
}
});
Expand Down
4 changes: 2 additions & 2 deletions luxWidget/nbextension/static/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion luxWidget/nbextension/static/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions luxWidget/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import json

class LuxWidget(DOMWidget):
_model_name = Unicode('ExampleModel').tag(sync=True)
_model_name = Unicode('LuxModel').tag(sync=True)
_model_module = Unicode(module_name).tag(sync=True)
_model_module_version = Unicode(module_version).tag(sync=True)
_view_name = Unicode('JupyterWidgetView').tag(sync=True)
_view_name = Unicode('LuxWidgetView').tag(sync=True)
_view_module = Unicode(module_name).tag(sync=True)
_view_module_version = Unicode(module_version).tag(sync=True)

Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "lux-widget",
"version": "0.0.8",
"description": "A Custom Jupyter Widget Library",
"keywords": [
"jupyter",
Expand All @@ -11,8 +10,8 @@
"files": [
"webpack.config.js",
"tsconfig.json",
"luxWidget/*.py",
"luxWidget/nbextension/static/*",
"luxwidget/*.py",
"luxwidget/nbextension/static/*",
"*.py",
"src/*.tsx",
"src/*.ts",
Expand All @@ -37,16 +36,16 @@
"url": "https://github.com/lux-org/lux-widget"
},
"scripts": {
"postinstall": "pip install . && jupyter nbextension install --sys-prefix --symlink --overwrite --py luxWidget && jupyter nbextension enable --sys-prefix --py luxWidget",
"postinstall": "pip install . && jupyter nbextension install --sys-prefix --symlink --overwrite --py luxwidget && jupyter nbextension enable --sys-prefix --py luxwidget",
"build": "npm install; npm run build:lib && npm run build:nbextension",
"build:labextension": "npm run clean:labextension && mkdirp luxWidget/labextension && cd luxWidget/labextension && npm pack ../..",
"build:labextension": "npm run clean:labextension && mkdirp luxwidget/labextension && cd luxwidget/labextension && npm pack ../..",
"build:lib": "tsc",
"build:nbextension": "webpack -p",
"build:all": "npm run build:labextension && npm run build:nbextension",
"clean": "npm run clean:lib && npm run clean:nbextension",
"clean:lib": "rimraf lib",
"clean:labextension": "rimraf luxWidget/labextension",
"clean:nbextension": "rimraf luxWidget/nbextension/static/index.js",
"clean:labextension": "rimraf luxwidget/labextension",
"clean:nbextension": "rimraf luxwidget/nbextension/static/index.js",
"prepack": "npm run build:lib",
"watch": "npm-run-all -p watch:*",
"watch:lib": "tsc -w",
Expand Down
55 changes: 21 additions & 34 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from __future__ import print_function
from glob import glob
from os.path import join as pjoin
from os import path


from setupbase import (
Expand All @@ -17,9 +18,14 @@

from setuptools import setup

HERE = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(HERE, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

# The name of the project
name = 'luxWidget'
name = 'luxwidget'

# Ensure a valid python version
ensure_python('>=3.4')
Expand All @@ -44,10 +50,10 @@
}

data_files_spec = [
('share/jupyter/nbextensions/luxWidget',
('share/jupyter/nbextensions/luxwidget',
nb_path, '*.js*'),
('share/jupyter/lab/extensions', lab_path, '*.tgz'),
('etc/jupyter/nbconfig/notebook.d' , HERE, 'luxWidget.json')
('etc/jupyter/nbconfig/notebook.d' , HERE, 'luxwidget.json')
]


Expand All @@ -61,53 +67,34 @@

setup_args = dict(
name = name,
description = 'A Custom Jupyter Widget Library',
description = 'Jupyter Widget for Intelligent Data Discovery',
long_description= long_description,
long_description_content_type='text/markdown',
version = version,
scripts = glob(pjoin('scripts', '*')),
# cmdclass = cmdclass,
packages = find_packages(),
author = 'Doris Lee',
author = 'Doris Jung-Lin Lee',
author_email = '[email protected]',
url = 'https://github.com/lux-org/lux-widget',
license = 'BSD',
url = 'https://github.com/lux-org/luxwidget',
license = 'Apache-2.0 License',
platforms = "Linux, Mac OS X, Windows",
keywords = ['Jupyter', 'Widgets', 'IPython'],
classifiers = [
'Development Status :: 1 - Planning',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Intended Audience :: Other Audience',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Visualization',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3'
'Framework :: Jupyter',
],
include_package_data = True,
install_requires = [
'ipywidgets>=7.0.0',
],
extras_require = {
'test': [
'pytest>=3.6',
'pytest-cov',
'nbval',
],
'examples': [
# Any requirements for the examples to run
],
'docs': [
'sphinx>=1.5',
'recommonmark',
'sphinx_rtd_theme',
'nbsphinx>=0.2.13,<0.4.0',
'jupyter_sphinx',
'nbsphinx-link',
'pytest_check_links',
'pypandoc',
],
},
entry_points = {
},
)
Expand Down
17 changes: 14 additions & 3 deletions src/chartGallery.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
// Copyright 2019-2020 The Lux Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import React, { Component } from 'react';
// import ReactDOM from 'react-dom';
// import ToolComponent from './tool';
import SelectableCard from './selectableCard';
import { VegaLite } from 'react-vega';
// import { VisualizationSpec } from 'vega-embed';
import ScrollableContent from './scrollableContent'
import {dispatchLogEvent} from './utils';
interface chartGalleryProps{
Expand Down
14 changes: 14 additions & 0 deletions src/currentVis.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2019-2020 The Lux Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import React, { Component } from 'react';
import { VegaLite } from 'react-vega';
import SelectableCard from './selectableCard';
Expand Down
14 changes: 14 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
// Copyright 2019-2020 The Lux Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

export * from './version';
export * from './widget';
14 changes: 14 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2019-2020 The Lux Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import {
Application, IPlugin
} from '@phosphor/application';
Expand Down
14 changes: 14 additions & 0 deletions src/scrollableContent.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2019-2020 The Lux Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import React, { Component } from 'react';
import {dispatchLogEvent} from './utils';
class ScrollableContent extends Component<{galleryItems: JSX.Element[],title:string, currentVisShow: boolean},any> {
Expand Down
14 changes: 14 additions & 0 deletions src/selectableCard.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2019-2020 The Lux Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import React from 'react';

class SelectableCard extends React.Component<{selected:boolean,onClick:(any) => void},any> {
Expand Down
14 changes: 14 additions & 0 deletions src/tool.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2019-2020 The Lux Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import React, { Component } from 'react';
interface toolProps{
graphIdx:number
Expand Down
14 changes: 14 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2019-2020 The Lux Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

export const dispatchLogEvent = function(action:string,param:any){
const LOG:boolean = true; // toggle log on/off
if (LOG){
Expand Down
Loading

0 comments on commit c36118d

Please sign in to comment.