Skip to content

Commit c742630

Browse files
Xingalexcjohnson
andauthored
Pre-v0.2.0 PR: Change package manager to npm, improve readme, update changelog, fix emails/tagging, upgrade package versions (#100)
* README: Reorder R instructions, detail about SVG, link to tests * Code of conduct: fix email * Clearly specify usage of yarn over npm * Specify yarn in the PR templates * Add unlogged changes * yarn upgrade Upgrade everything * Log yarn upgrade's * yarn run build:all * Fix interactions (again) * Change emails for Code of conduct * Remove yarn.lock, use package-lock * Update docs to specify usage of npm instead of yarn * Apply suggestions from code review Co-authored-by: alexcjohnson <[email protected]> * Create CODEOWNERS * Update .github/CODEOWNERS Co-authored-by: alexcjohnson <[email protected]> Co-authored-by: alexcjohnson <[email protected]>
1 parent a018eaf commit c742630

16 files changed

+14352
-7489
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These owners will be the default owners for everything in
2+
# the repo. Unless a later match takes precedence
3+
* @alexcjohnson @Marc-Andre-Rivet @xhlulu

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ What does this implement/fix? Explain your changes.
2121

2222
## Pre-Merge checklist
2323
- [ ] The project was correctly built with `npm run build:all`.
24-
- [ ] If there was any conflict, it was solved correctly
24+
- [ ] If there was any conflict, it was solved correctly.
2525
- [ ] All changes were documented in CHANGELOG.md.
2626
- [ ] All tests on CircleCI have passed.
2727
- [ ] All Percy visual changes have been approved.

CHANGELOG.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
* Contributed initial build of R package.
1111
* Added access to cytoscape.js PNG and JPG image generation API through `generateImage` and
12-
`imageData` properties.
12+
`imageData` properties (PR [#88](https://github.com/plotly/dash-cytoscape/pull/88)).
1313
* Added ability to download image files generated with `generateImage` client-side without sending
14-
data to the server.
15-
* Used the newly added `generateImage` and `imageData` properties to enable svg generation using https://github.com/kinimesi/cytoscape-svg
16-
* Added responsive cytoscape.js graph feature toggled using the `responsive` property.
14+
data to the server (PR [#88](https://github.com/plotly/dash-cytoscape/pull/88)).
15+
* Used the newly added `generateImage` and `imageData` properties to enable svg generation using [cytoscape-svg](https://github.com/kinimesi/cytoscape-svg).
16+
* Added responsive cytoscape.js graph feature toggled using the `responsive` property (PR [#93](https://github.com/plotly/dash-cytoscape/pull/92)).
1717
* One new demo:
1818
* `demos/usage-responsive-graph.py`: Example of graph with the ability to toggle the responsive feature on and off.
19+
* `demos/usage-image-export.py`: Shows how to export images as JPG, PNG or SVG.
1920

2021
### Changed
22+
* Changed the official package manager from `yarn` to `npm`.
2123
* `utils.Tree`: v0.1.1 broke compatibility with Python 2. Therefore, modified code to be compatible
2224
with Python 2. Added `props` and `edge_props` properties to accept arguments passed directly to
2325
the node's and edge's dictionaries, respectively (e.g., 'classes', 'positions', etc.).
2426
* Removed `Tree`'s method `add_child`, because it is redundant with `add_children` called with an
2527
argument of length 1.
26-
* `setup.py`: Remove `dash-html-components` and `dash_renderer` from `install_requires`
28+
* `setup.py`: Remove `dash-html-components` and `dash_renderer` from `install_requires`.
29+
* `usage-events.py`: Fix the size of the cytoscape graph to 500px by 500px.
30+
* Upgrade `react-cytoscape.js` to latest.
2731

2832
### Fixed
2933
* `setup.py`: Use `packages=find_packages(include=[package_name, package_name + ".*"])` so that all
3034
subpackages like `utils` will be included when you `pip install dash-cytoscape`.
35+
* Issue where `dash-cytoscape` cannot read property of 'length' of undefined when elements is not specified.
36+
* `tests.test_interactions`.
3137

3238
## [0.1.1] - 2019-04-05
3339

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe
3434

3535
## Enforcement
3636

37-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected] or [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
3838

3939
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
4040

CONTRIBUTING.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ venv\Scripts\activate
2727

2828
3. Install the JavaScript dependencies and build the code:
2929
```commandline
30-
yarn
31-
yarn run build:all
30+
npm install
31+
npm run build:all
3232
```
3333

34+
#### Package manager
35+
36+
Before v0.2.0, our preferred package manager for this project is Yarn. Starting with v0.2.0, we will be using `npm` in order to create less confusion and ensure a unified package manager with other Dash components. Therefore we use `package-lock.json` rather than `yarn.lock.`. If you are contributing a PR to dash-cytoscape, we encourage you to also use `npm`.
37+
3438
## Coding Style
3539

3640
Please lint any additions to Python code with `pylint` and `flake8`:
@@ -108,7 +112,7 @@ Those tests are rendered into images located inside `tests/screenshots`, which a
108112

109113
## Publishing
110114

111-
Create a pull request and tag the Plotly team (`@plotly/dash_bio`) and tag / request review from [@xhlulu](https://github.com/xhlulu).
115+
Create a pull request and tag the Plotly team (`@plotly/dash-core`) and tag / request review from [@xhlulu](https://github.com/xhlulu).
112116

113117
After a review has been done and your changes have been approved, create a prerelease and comment in the PR. Version numbers should follow [semantic versioning][].
114118

@@ -190,12 +194,7 @@ Complete the "Publishing" section.
190194
- [ ] Step 1 and 2 of Post-merge checklist are completed.
191195
- [ ] You have closed all issues that this pull request solves, and commented the new version number users should install.
192196
- [ ] If significant enough, you have created an issue about documenting the new feature or change and you have added it to the [Documentation] project.
193-
- [ ] You have created a pull request in [Dash Docs] with the new release of your feature by editing that project's [`requirements.txt` file](https://github.com/plotly/dash-docs/blob/master/requirements.txt) and you have assigned `@chriddyp` to review.
194-
195-
## Notes
196-
197-
#### Package manager
198-
Our preferred package manager for this project is Yarn. Therefore we use `yarn.lock` rather than `package-lock.json`. If you decide to start using npm for package management (which will create package-lock.json) and you commit this project to Dokku, make sure to delete `yarn.lock`.
197+
- [ ] You have created a pull request in [Dash Docs] with the new release of your feature by editing that project's [`requirements.txt` file](https://github.com/plotly/dash-docs/blob/master/requirements.txt).
199198

200199

201200
## Financial Contributions

README.md

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,20 @@ A Dash component library for creating interactive and customizable networks in P
1212
* 🗺 [Component Reference](https://dash.plotly.com/cytoscape/reference)
1313
* 📺 [Webinar Recording](https://www.youtube.com/watch?v=snXcIsCMQgk)
1414

15-
## Getting Started
15+
## Getting Started in Python
1616

17-
### Prerequisites (Python)
17+
### Prerequisites
1818

1919
Make sure that dash and its dependent libraries are correctly installed:
2020
```commandline
21-
pip install dash dash-html-components
21+
pip install dash
2222
```
2323

2424
If you want to install the latest versions, check out the [Dash docs on installation](https://dash.plotly.com/installation).
2525

26-
### Prerequisites (R)
26+
### Usage
2727

28-
```R
29-
install.packages(c("devtools", "dash"))
30-
```
31-
32-
### Usage (Python)
33-
34-
Install the library using pip:
28+
Install the library using `pip`:
3529

3630
```
3731
pip install dash-cytoscape
@@ -63,7 +57,34 @@ if __name__ == '__main__':
6357

6458
![basic-usage](https://raw.githubusercontent.com/plotly/dash-cytoscape/master/demos/images/basic-usage.gif)
6559

66-
### Usage (R)
60+
### External layouts
61+
62+
You can also add external layouts. Use the `cyto.load_extra_layouts()` function to get started:
63+
64+
```python
65+
import dash
66+
import dash_cytoscape as cyto
67+
import dash_html_components as html
68+
69+
cyto.load_extra_layouts()
70+
71+
app = dash.Dash(__name__)
72+
app.layout = html.Div([
73+
cyto.Cytoscape(...)
74+
])
75+
```
76+
77+
Calling `cyto.load_extra_layouts()` also enables generating SVG images.
78+
79+
80+
## Getting Started in R
81+
82+
### Prerequisites
83+
84+
```R
85+
install.packages(c("devtools", "dash"))
86+
```
87+
### Usage
6788

6889
Install the library using devtools:
6990

@@ -100,23 +121,6 @@ app$layout(
100121
app$run_server()
101122
```
102123

103-
### External layouts
104-
105-
You can also add external layouts. Use the `cyto.load_extra_layouts()` function to get started:
106-
107-
```python
108-
import dash
109-
import dash_cytoscape as cyto
110-
import dash_html_components as html
111-
112-
cyto.load_extra_layouts()
113-
114-
app = dash.Dash(__name__)
115-
app.layout = html.Div([
116-
cyto.Cytoscape(...)
117-
])
118-
```
119-
120124
## Documentation
121125

122126
The [Dash Cytoscape User Guide](https://dash.plotly.com/cytoscape/) contains everything you need to know about the library. It contains useful examples, functioning code, and is fully interactive. You can also use the [component reference](https://dash.plotly.com/cytoscape/reference/) for a complete and concise specification of the API.
@@ -127,7 +131,11 @@ For supplementary information about the underlying Javascript API, view the [Cy
127131

128132
## Contributing
129133

130-
Make sure that you have read and understood our [code of conduct](CODE_OF_CONDUCT.md), then head over to [CONTRIBUTING](CONTRIBUTING.md) to get started.
134+
Make sure that you have read and understood our [code of conduct](CODE_OF_CONDUCT.md), then head over to [CONTRIBUTING](CONTRIBUTING.md) to get started.
135+
136+
### Testing
137+
138+
Instructions on how to run [tests](CONTRIBUTING.md#tests) are given in [CONTRIBUTING.md](CONTRIBUTING.md).
131139

132140
## License
133141

dash_cytoscape/Cytoscape.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class Cytoscape(Component):
1212
- id (string; optional): The ID used to identify this component in Dash callbacks.
1313
- className (string; optional): Sets the class name of the element (the value of an element's html
1414
class attribute).
15-
- style (dict; default {width: '600px', height: '600px'}): Add inline styles to the root element.
16-
- elements (list of dicts | dict; optional): A list of dictionaries representing the elements of the networks.
15+
- style (dict; optional): Add inline styles to the root element.
16+
- elements (list | dict; optional): A list of dictionaries representing the elements of the networks.
1717
1. Each dictionary describes an element, and specifies its purpose.
1818
- `group` (string): Either 'nodes' or 'edges'. If not given, it's automatically inferred.
1919
- `data` (dictionary): Element specific data.
@@ -33,7 +33,7 @@ class attribute).
3333
3434
2. The [official Cytoscape.js documentation](http://js.cytoscape.org/#notation/elements-json) offers an extensive overview and examples of element declaration.
3535
Alternatively, a dictionary with the format { 'nodes': [], 'edges': [] } is allowed at initialization, but arrays remain the recommended format.
36-
- stylesheet (list of dicts; optional): A list of dictionaries representing the styles of the elements.
36+
- stylesheet (list; optional): A list of dictionaries representing the styles of the elements.
3737
1. Each dictionary requires the following keys:
3838
- `selector` (string): Which elements you are styling. Generally, you select a group of elements (node, edges, both), a class (that you declare in the element dictionary), or an element by ID.
3939
- `style` (dictionary): What aspects of the elements you want to modify. This could be the size or color of a node, the shape of an edge arrow, or many more.
@@ -43,7 +43,7 @@ class attribute).
4343
exhaustively documented in the Cytoscape.js docs. Although methods such
4444
as `cy.elements(...)` and `cy.filter(...)` are not available, the selector
4545
string syntax stays the same.
46-
- layout (dict; default {name: 'grid'}): A dictionary specifying how to set the position of the elements in your
46+
- layout (dict; optional): A dictionary specifying how to set the position of the elements in your
4747
graph. The `'name'` key is required, and indicates which layout (algorithm) to
4848
use.
4949
1. The layouts available by default are:
@@ -81,33 +81,33 @@ class attribute).
8181
Note that certain keys are not supported in Dash since the value is a
8282
JavaScript function or a callback. Please visit [this issue](https://github.com/plotly/dash-cytoscape/issues/25)
8383
for more information.
84-
- pan (dict; default {x: 0, y: 0}): Dictionary indicating the initial panning position of the graph. The
84+
- pan (dict; optional): Dictionary indicating the initial panning position of the graph. The
8585
following keys are accepted:
8686
- `x` (number): The x-coordinate of the position.
8787
- `y` (number): The y-coordinate of the position.
88-
- zoom (number; default 1): The initial zoom level of the graph. You can set `minZoom` and
88+
- zoom (number; optional): The initial zoom level of the graph. You can set `minZoom` and
8989
`maxZoom` to set restrictions on the zoom level.
90-
- panningEnabled (boolean; default True): Whether panning the graph is enabled (i.e., the position of the graph is
90+
- panningEnabled (boolean; optional): Whether panning the graph is enabled (i.e., the position of the graph is
9191
mutable overall).
92-
- userPanningEnabled (boolean; default True): Whether user events (e.g. dragging the graph background) are allowed to
92+
- userPanningEnabled (boolean; optional): Whether user events (e.g. dragging the graph background) are allowed to
9393
pan the graph.
94-
- minZoom (number; default 1e-50): A minimum bound on the zoom level of the graph. The viewport can not be
94+
- minZoom (number; optional): A minimum bound on the zoom level of the graph. The viewport can not be
9595
scaled smaller than this zoom level.
96-
- maxZoom (number; default 1e50): A maximum bound on the zoom level of the graph. The viewport can not be
96+
- maxZoom (number; optional): A maximum bound on the zoom level of the graph. The viewport can not be
9797
scaled larger than this zoom level.
98-
- zoomingEnabled (boolean; default True): Whether zooming the graph is enabled (i.e., the zoom level of the graph
98+
- zoomingEnabled (boolean; optional): Whether zooming the graph is enabled (i.e., the zoom level of the graph
9999
is mutable overall).
100-
- userZoomingEnabled (boolean; default True): Whether user events (e.g. dragging the graph background) are allowed
100+
- userZoomingEnabled (boolean; optional): Whether user events (e.g. dragging the graph background) are allowed
101101
to pan the graph.
102-
- boxSelectionEnabled (boolean; default False): Whether box selection (i.e. drag a box overlay around, and release it
102+
- boxSelectionEnabled (boolean; optional): Whether box selection (i.e. drag a box overlay around, and release it
103103
to select) is enabled. If enabled, the user must taphold to pan the graph.
104-
- autoungrabify (boolean; default False): Whether nodes should be ungrabified (not grabbable by user) by
104+
- autoungrabify (boolean; optional): Whether nodes should be ungrabified (not grabbable by user) by
105105
default (if true, overrides individual node state).
106-
- autolock (boolean; default False): Whether nodes should be locked (not draggable at all) by default
106+
- autolock (boolean; optional): Whether nodes should be locked (not draggable at all) by default
107107
(if true, overrides individual node state).
108-
- autounselectify (boolean; default False): Whether nodes should be unselectified (immutable selection state) by
108+
- autounselectify (boolean; optional): Whether nodes should be unselectified (immutable selection state) by
109109
default (if true, overrides individual element state).
110-
- autoRefreshLayout (boolean; default True): Whether the layout should be refreshed when elements are added or removed.
110+
- autoRefreshLayout (boolean; optional): Whether the layout should be refreshed when elements are added or removed.
111111
- tapNode (dict; optional): The complete node dictionary returned when you tap or click it. Read-only.
112112
113113
1. Node-specific items:
@@ -189,7 +189,7 @@ class attribute).
189189
`'store'` to improve performance by preventing transfer of data to the server.
190190
- imageData (string; optional): String representation of the image requested with generateImage. Null if no
191191
image was requested yet or the previous request failed. Read-only.
192-
- responsive (boolean; default False): Toggles intelligent responsive resize of Cytoscape graph with viewport size change"""
192+
- responsive (boolean; optional): Toggles intelligent responsive resize of Cytoscape graph with viewport size change"""
193193
@_explicitize_args
194194
def __init__(self, id=Component.UNDEFINED, className=Component.UNDEFINED, style=Component.UNDEFINED, elements=Component.UNDEFINED, stylesheet=Component.UNDEFINED, layout=Component.UNDEFINED, pan=Component.UNDEFINED, zoom=Component.UNDEFINED, panningEnabled=Component.UNDEFINED, userPanningEnabled=Component.UNDEFINED, minZoom=Component.UNDEFINED, maxZoom=Component.UNDEFINED, zoomingEnabled=Component.UNDEFINED, userZoomingEnabled=Component.UNDEFINED, boxSelectionEnabled=Component.UNDEFINED, autoungrabify=Component.UNDEFINED, autolock=Component.UNDEFINED, autounselectify=Component.UNDEFINED, autoRefreshLayout=Component.UNDEFINED, tapNode=Component.UNDEFINED, tapNodeData=Component.UNDEFINED, tapEdge=Component.UNDEFINED, tapEdgeData=Component.UNDEFINED, mouseoverNodeData=Component.UNDEFINED, mouseoverEdgeData=Component.UNDEFINED, selectedNodeData=Component.UNDEFINED, selectedEdgeData=Component.UNDEFINED, generateImage=Component.UNDEFINED, imageData=Component.UNDEFINED, responsive=Component.UNDEFINED, **kwargs):
195195
self._prop_names = ['id', 'className', 'style', 'elements', 'stylesheet', 'layout', 'pan', 'zoom', 'panningEnabled', 'userPanningEnabled', 'minZoom', 'maxZoom', 'zoomingEnabled', 'userZoomingEnabled', 'boxSelectionEnabled', 'autoungrabify', 'autolock', 'autounselectify', 'autoRefreshLayout', 'tapNode', 'tapNodeData', 'tapEdge', 'tapEdgeData', 'mouseoverNodeData', 'mouseoverEdgeData', 'selectedNodeData', 'selectedEdgeData', 'generateImage', 'imageData', 'responsive']

dash_cytoscape/dash_cytoscape.dev.js

Lines changed: 31 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_cytoscape/dash_cytoscape.min.js

Lines changed: 7 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_cytoscape/dash_cytoscape_extra.dev.js

Lines changed: 115 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)