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

fix css style #1389

Merged
merged 3 commits into from
Sep 21, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* Update diagnostics to be on par with posterior package ([#1366](https://github.com/arviz-devs/arviz/pull/1366))
* Use method="average" in `scipy.stats.rankdata` ([#1380](https://github.com/arviz-devs/arviz/pull/1380))
* Add more `plot_parallel` examples ([#1380](https://github.com/arviz-devs/arviz/pull/1380))
* Bump minimum xarray version to 0.16.1 ([#1389](https://github.com/arviz-devs/arviz/pull/1389)

### Deprecation

Expand Down
3 changes: 2 additions & 1 deletion arviz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,5 +696,6 @@ class HtmlTemplate:
</div>
</li>
"""
_, css_style = xr.core.formatting_html._load_static_files() # pylint: disable=protected-access
Copy link
Member

Choose a reason for hiding this comment

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

I am fine with enforcing the lazy load but we then have to update requirements to xarray 0.16.1 too, otherwise we need and if/else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, what should we do? Have our own css file, or copy the lazy load function?

Copy link
Member

Choose a reason for hiding this comment

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

I gravitate towards requiring xarray 0.16.1 so this code works without problem or having our lazy load function that calls xarray's one if possible and gets css style otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's update xarray to 0.16.1

Copy link

Choose a reason for hiding this comment

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

Just to warn you, this line is definitely using an internal xarray function that could go away or be disabled in the future. That's why you had to add the lint comment to disable protected-access :).

If you are OK copying the CSS file into arViz, that would be my preference for the safest/simplest way to do this (without any chance of things breaking in the future).

Otherwise, if for some reason you need to keep it in sync with xarray's version, we could definitely consider adding a public API option for getting this information from xarray. In that case, please open an issue in xarray's issue tracker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we are using internal function. Until we figure out a good way to solve this, I think we are ok with this solution.

xarray should not (and probably are not) worry changing their internal functionality.

specific_style = ".xr-wrap{width:700px!important;}"
css_template = f"<style> {xr.core.formatting_html.CSS_STYLE}{specific_style} </style>"
css_template = f"<style> {css_style}{specific_style} </style>"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ numpy>=1.12
scipy>=0.19
packaging
pandas>=0.23
xarray>=0.11
xarray>=0.16.1
netcdf4