Skip to content

Async dash bio #430

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

Merged
merged 13 commits into from
Nov 5, 2019
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
10 changes: 8 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"presets": ["@babel/env", "@babel/react"]
}
"presets": [
"@babel/env",
"@babel/react"
],
"plugins": [
"@babel/plugin-syntax-dynamic-import"
]
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.4.0] - 2019-11-05
### Added
* [#430](https://github.com/plotly/dash-bio/pull/430) Async AlignmentChart, Circos, Ideogram, Molecule2dViewer, Molecule3dViewer, NeedlePlot, OncoPrint, SequenceViewwer and Speck components

## [0.3.0] - 2019-10-22

### Added
Expand Down
39 changes: 36 additions & 3 deletions dash_bio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,50 @@

_this_module = _sys.modules[__name__]

async_resources = [
'alignment',
'circos',
'ideogram',
'moleculeviewer2',
'moleculeviewer3',
'needle',
'onco',
'sequence',
'speck'
]

_js_dist = []

_js_dist.extend([{
'relative_package_path': 'async~{}.js'.format(async_resource),
'external_url': (
'https://unpkg.com/dash-bio@{}'
'/dash_bio/async~{}.js'
).format(__version__, async_resource),
'namespace': 'dash_bio',
'async': True
} for async_resource in async_resources])

_js_dist = [
_js_dist.extend([{
'relative_package_path': 'async~{}.js.map'.format(async_resource),
'external_url': (
'https://unpkg.com/dash-bio@{}'
'/dash_bio/async~{}.js.map'
).format(__version__, async_resource),
'namespace': 'dash_bio',
'dynamic': True
} for async_resource in async_resources])

_js_dist.extend([
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but at some point - like perhaps, whenever we get around to fully generating __init__.py - this all seems ripe for abstracting into the dash core, like

_js_dist = _dash.development.list_resources(
    ['bundle.js'],
    ['async~{}.js'.format(resource) for resource in async_resources],
    external_prefix='https://unpkg.com/dash-bio@{}/dash_bio'.format(__version__)
)

May still need some tweaking to handle edge cases like async: 'eager'|'lazy', but we should at least be able to auto-detect sourcemaps (which may not exist in release versions plotly/dash#910) and set them all dynamic: True regardless of the resource setting.

{
'relative_package_path': 'bundle.js',
'external_url': (
'https://unpkg.com/dash-bio'
'https://unpkg.com/dash-bio{}'
'/' + package_name + '/bundle.js'
).format(__version__),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey not new in this PR, but __version__ isn't used in this url?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔎 Interesting, due to how unpkg.com processes a this request, this works but will always return the latest released version of that file, could make for pretty nice bugs! Fixing.

Copy link
Contributor Author

@Marc-Andre-Rivet Marc-Andre-Rivet Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone using the remotely hosted code for an old version will have a nasty surprise after this update..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcjohnson Good catch! Surprised we haven't run into it before.

'namespace': package_name
}
]
])

_css_dist = []

Expand Down
63 changes: 63 additions & 0 deletions dash_bio/async~alignment.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dash_bio/async~circos.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dash_bio/async~ideogram.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dash_bio/async~moleculeviewer2.js

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions dash_bio/async~moleculeviewer3.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dash_bio/async~needle.js

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

Loading