Skip to content
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

Ngl SideBySide fix and Mol3d isosurface/shapes #547

Merged
merged 49 commits into from
Apr 14, 2021
Merged

Conversation

HammadTheOne
Copy link
Contributor

@HammadTheOne HammadTheOne commented Mar 11, 2021

Closes #526
Closes #518

About

  • I am closing an issue
  • I am adding a feature to an existing component, or improving an existing feature

Description of changes

This PR adds the isosurfaces and shapes props to the Molecule3dViewer component, and fixes an issue with sideByside not working correctly with ALL chains selected in NglMoleculeViewer.

  • Fix ngl sidebyside fb4ffa1
  • Add isosurfaces and shapes c77d79b
  • Fix integration tests and Percy snapshots flakiness

TODO:

@HammadTheOne HammadTheOne changed the title 0.6.2 Release Updates with Ngl and Mol3d fixes Ngl SideBySide fix and Mol3d isosurface/shapes Mar 11, 2021
CHANGELOG.md Outdated Show resolved Hide resolved
* labels corresponding to the atoms of the molecule
* Labels corresponding to the atoms of the molecule.
* The text key sets the label content, and additional
* styling options can be set with the parameters key.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we document this as part of the propType? So instead of labels: PropTypes.array we would have something like (if I'm understanding this correctly):

/**
 * Labels corresponding to the atoms of the molecule.
 */
labels: PropTypes.arrayOf(PropTypes.exact({
    /**
     * The label content
     */
    text: PropTypes.string,

    /**
     * additional styling options. See <docs url> for details
     */
    parameters: PropTypes.object
}))

Notice I used exact - this is preferred over shape unless it's specifically desirable to allow arbitrary extra keys in the object. Should we change this for orbital below, or does it support extra keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For orbital, while it doesn't support extra keys, the component itself supplies defaults for missing keys. I think changing it to exact is fine, if the warning for additional or missing keys is what we're looking to have. Fixed in 078ebc7.

Copy link
Collaborator

Choose a reason for hiding this comment

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

exact is fine, if the warning for additional or missing keys is what we're looking to have

exact doesn't warn on missing keys - that's still fine unless the individual key has .isRequired. All it does is forbid including additional keys. So yes, this is what we want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After looking at it again, the parameters are just input as extra keys to the label object. In 3010db8 I changed it to remove the explicit parameters prop and changed it back to shape so arbitrary keys can be passed in without warnings. Does that make sense for this prop?

Copy link
Collaborator

Choose a reason for hiding this comment

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

See below #547 (comment) - FYI all of this would be clearer if there were a test using the labels key so we could both be looking at the same behavior 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a Percy snapshot test in the last couple of commits. One thing I'm confused about is that the Percy build isn't showing the new screenshot for approval in the build. Does that require manual setup aside from just adding in dash_duo.percy_snapshot('test-mol3d_labels') to the test?

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh boy... we have a problem, all the percy snapshots are getting separate builds on their side. Check out https://percy.io/plotly/dash-bio and see all the ones from the same commit. Try using the percy-finalize pattern like we use elsewhere, see eg plotly/dash-html-components@72796c4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, after a long series of commits, the tests are finally consolidated into one build with percy-finalize, and running successfully on 3.7 after fixing flakiness for a few of them.

One thing I am noticing for the Percy snapshots is that the molecules don't seem to be rendered for the mol-3d and ngl-moleculeviewer tests. I tried adding in a delay with a check using wait_for_text_to_equal and a dummy div, but it seems to be the same case, despite loading fine locally.

Do you have any suggestions on how to make these snapshots more reliable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Excellent, nice job! The unrendered pieces are probably in canvases (WebGL or otherwise) - you'll need convert_canvases in the snapshot call, like here:

https://github.com/plotly/dash/blob/e8ac94919105a91c76a966c21aca2ec7b0297e22/tests/integration/devtools/test_devtools_ui.py#L103

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, that worked perfectly, and now all but the Speck ones are generated successfully! I can't readily see what might be causing it since Speck is also a WebGL rendered component, and locally it doesn't seem like there's a problem, but I think it might be worth addressing that in a separate PR and wrapping this one up (I feel like it's gotten a little out of scope already 😅 ).

@HammadTheOne
Copy link
Contributor Author

HammadTheOne commented Apr 12, 2021

@alexcjohnson Tests successfully running again 🚀

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

Excellent! 💃

@HammadTheOne HammadTheOne merged commit 6ebfd28 into master Apr 14, 2021
@HammadTheOne HammadTheOne deleted the 0.6.2-update branch April 14, 2021 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Molecule3D shapes and isosurfaces Update Contributing.md and Demos to match current repo structure
2 participants