Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pikhovkin committed Jun 5, 2018
1 parent ba7e134 commit faca9c4
Show file tree
Hide file tree
Showing 26 changed files with 8,801 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/dash-components-archetype/config/babel/babelrc"
}
3 changes: 3 additions & 0 deletions .builderrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
archetypes:
- dash-components-archetype
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
extends: ./node_modules/dash-components-archetype/config/eslint/eslintrc-react.json
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
build/
coverage/
dist/
lib/
lib/bundle.js*
node_modules/
dash_devextreme/bundle.js*
.npm
vv/
venv/
*.pyc
*.egg-info
*.log
.DS_Store
.idea
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules/
.npm
.git/
vv/
venv/
*.pyc
*.log
.DS_Store
.idea
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Change Log for dash-devextreme
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

### Added
- Feature x

### Fixed
- Bug y

## 0.0.1 - 2018-06-05
- Initial release

[Unreleased]: https://github.com/pikhovkin/dash-devextreme/v0.0.1...HEAD
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include dash_devextreme/bundle.js
include dash_devextreme/bundle.js.map
include dash_devextreme/metadata.json
include README.md
include LICENSE.md
162 changes: 162 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,164 @@
# dash-devextreme

Wrapper of DevExtreme components for Plotly Dash

## Dash

Go to this link to learn about [Dash][].

## Getting started

```sh
# Install dependencies
$ npm install

# Watch source for changes and build to `lib/`
$ npm start
```

## Development

### Demo server

You can start up a demo development server to see a demo of the rendered
components:

```sh
$ builder run demo
$ open http://localhost:9000
```

You have to maintain the list of components in `demo/Demo.react.js`.

### Code quality and tests

#### To run lint and unit tests:

```sh
$ npm test
```

#### To run unit tests and watch for changes:

```sh
$ npm run test-watch
```

#### To debug unit tests in a browser (Chrome):

```sh
$ npm run test-debug
```

1. Wait until Chrome launches.
2. Click the "DEBUG" button in the top right corner.
3. Open up Chrome Devtools (`Cmd+opt+i`).
4. Click the "Sources" tab.
5. Find source files
- Navigate to `webpack:// -> . -> spec/components` to find your test source files.
- Navigate to `webpack:// -> [your/repo/path]] -> dash-devextreme -> src` to find your component source files.
6. Now you can set breakpoints and reload the page to hit them.
7. The test output is available in the "Console" tab, or in any tab by pressing "Esc".

#### To run a specific test

In your test, append `.only` to a `describe` or `it` statement:

```javascript
describe.only('Foo component', () => {
// ...
})l
```

### Testing your components in Dash

1. Build development bundle to `lib/` and watch for changes

# Once this is started, you can just leave it running.
$ npm start

2. Install module locally (after every change)

# Generate metadata, and build the JavaScript bundle
$ npm run install-local

# Now you're done. For subsequent changes, if you've got `npm start`
# running in a separate process, it's enough to just do:
$ python setup.py install

3. Run the dash layout you want to test

# Import dash-devextreme to your layout, then run it:
$ python my_dash_layout.py


**TODO:** There is a workflow that links your module into `site-packages` which would
make it unnecessary to re-run `2.` on every change: `python setup.py develop`.
Unfortunately, this doesn't seem to work with resources defined in
`package_data`.

See https://github.com/plotly/dash-components-archetype/issues/20


## Installing python package locally

Before publishing to PyPi, you can test installing the module locally:

```sh
# Install in `site-packages` on your machine
$ npm run install-local
```

## Uninstalling python package locally

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

## Publishing

For now, multiple steps are necessary for publishing to NPM and PyPi,
respectively. **TODO:**
[#5](https://github.com/plotly/dash-components-archetype/issues/5) will roll up
publishing steps into one workflow.

Ask @chriddyp to get NPM / PyPi package publishing accesss.

1. Preparing to publish to NPM

# Bump the package version
$ npm version major|minor|patch

# Push branch and tags to repo
$ git push --follow-tags

2. Preparing to publish to PyPi

# Bump the PyPi package to the same version
$ vi setup.py

# Commit to github
$ git add setup.py
$ git commit -m "Bump pypi package version to vx.x.x"

3. Publish to npm and PyPi

$ npm run publish-all

## Builder / Archetype

We use [Builder][] to centrally manage build configuration, dependencies, and
scripts.

To see all `builder` scripts available:

```sh
$ builder help
```

See the [dash-components-archetype][] repo for more information.


[Builder]: https://github.com/FormidableLabs/builder
[Dash]: https://github.com/plotly/dash2
[dash-components-archetype]: https://github.com/plotly/dash-components-archetype
33 changes: 33 additions & 0 deletions dash_devextreme/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os as _os
import dash as _dash
import sys as _sys
from .version import __version__

_current_path = _os.path.dirname(_os.path.abspath(__file__))

_components = _dash.development.component_loader.load_components(
_os.path.join(_current_path, 'metadata.json'),
'dash_devextreme'
)

_this_module = _sys.modules[__name__]


_js_dist = [
{
"relative_package_path": "bundle.js",
"external_url": (
"https://unpkg.com/dash-devextreme@{}"
"/dash_devextreme/bundle.js"
).format(__version__),
"namespace": "dash_devextreme"
}
]

_css_dist = []


for _component in _components:
setattr(_this_module, _component.__name__, _component)
setattr(_component, '_js_dist', _js_dist)
setattr(_component, '_css_dist', _css_dist)
134 changes: 134 additions & 0 deletions dash_devextreme/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"src/components/PivotGrid.react.js": {
"description": "",
"displayName": "PivotGrid",
"methods": [],
"props": {
"id": {
"type": {
"name": "string"
},
"required": false,
"description": ""
},
"dataSource": {
"type": {
"name": "object"
},
"required": false,
"description": ""
},
"setProps": {
"type": {
"name": "func"
},
"required": false,
"description": ""
}
}
},
"src/components/SelectBox.react.js": {
"description": "",
"displayName": "SelectBox",
"methods": [
{
"name": "onValueChanged",
"docblock": null,
"modifiers": [],
"params": [
{
"name": "e",
"type": null
}
],
"returns": null
}
],
"props": {
"id": {
"type": {
"name": "string"
},
"required": false,
"description": ""
},
"dataSource": {
"type": {
"name": "object"
},
"required": false,
"description": ""
},
"value": {
"type": {
"name": "union",
"value": [
{
"name": "string"
},
{
"name": "number"
}
]
},
"required": false,
"description": ""
},
"setProps": {
"type": {
"name": "func"
},
"required": false,
"description": ""
},
"dashEvents": {
"type": {
"name": "enum",
"value": [
{
"value": "'change'",
"computed": false
}
]
},
"required": false,
"description": ""
}
}
},
"src/components/TextBox.react.js": {
"description": "",
"displayName": "TextBox",
"methods": [],
"props": {
"id": {
"type": {
"name": "string"
},
"required": false,
"description": "The ID used to identify this compnent in Dash callbacks"
},
"value": {
"type": {
"name": "string"
},
"required": false,
"description": "The value displayed in the input"
},
"valueChangeEvent": {
"type": {
"name": "string"
},
"required": false,
"description": ""
},
"setProps": {
"type": {
"name": "func"
},
"required": false,
"description": "Dash-assigned callback that should be called whenever any of the\r\nproperties change"
}
}
}
}
1 change: 1 addition & 0 deletions dash_devextreme/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.0.1'
Loading

0 comments on commit faca9c4

Please sign in to comment.