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

Correctly infer document from bokeh.io._state for bokeh.io.save (instead of creating new one) #5978

Merged
merged 13 commits into from Mar 15, 2017

Conversation

Projects
None yet
2 participants
@canavandl
Contributor

canavandl commented Mar 10, 2017

  • issues: fixes #5977
  • tests added / passed
  • release document entry (if new feature or API change)

Refactor _save_helper to use internally use _ModelInDocument (via bokeh.embed.file_html) in order to correctly handle document state.

For testing purposed, you can use the bug example from the issue (#5977)

Migration Note:

  • bokeh.io.save now will only accept a LayoutDOM item and no longer a document. I don't think this should be much of an interruption, as I don't think any users are saving documents. This also brings the save method in line with the bokeh.io.show method, making things more intuitive.
  • validate kwarg to bokeh.io.save has been deprecated
  • bokeh.embed.standalone_html_page_for_models has been marked as deprecated in place of bokeh.embed.file_html
filename (str, optional) : filename to save document under (default: None)
If None, use the default state configuration, otherwise raise a
``RuntimeError``.

This comment has been minimized.

@canavandl

canavandl Mar 10, 2017

Contributor

This docstring is out-of-date. The implementation now will create a tempfile matching the __file__ name instead of raising a RuntimeError.

@canavandl

canavandl Mar 10, 2017

Contributor

This docstring is out-of-date. The implementation now will create a tempfile matching the __file__ name instead of raising a RuntimeError.

This comment has been minimized.

@bryevdv

bryevdv Mar 10, 2017

Member

Please update any docstrings that need updating :)

@bryevdv

bryevdv Mar 10, 2017

Member

Please update any docstrings that need updating :)

This comment has been minimized.

@canavandl

canavandl Mar 10, 2017

Contributor

done

@canavandl

canavandl Mar 10, 2017

Contributor

done

This comment has been minimized.

@bryevdv

bryevdv Mar 13, 2017

Member

migration note for obj param type change and validate deprecation / ignore

@bryevdv

bryevdv Mar 13, 2017

Member

migration note for obj param type change and validate deprecation / ignore

This comment has been minimized.

@canavandl

canavandl Mar 14, 2017

Contributor

added

@canavandl

canavandl Mar 14, 2017

Contributor

added

Show outdated Hide outdated bokeh/io.py
@@ -105,11 +105,6 @@ def test_default_filename(self):
filename, resources, title = io._get_save_args(io._state, None, "resources", "title")
self.assertEqual(filename, "filename")
def test_missing_filename(self):

This comment has been minimized.

@canavandl

canavandl Mar 10, 2017

Contributor

This test didn't actually test for a missing filename (which now is handled without raising an exception and tested elsewhere). It just happened to raise a RuntimeError related to trying to save an object of type(str).

@canavandl

canavandl Mar 10, 2017

Contributor

This test didn't actually test for a missing filename (which now is handled without raising an exception and tested elsewhere). It just happened to raise a RuntimeError related to trying to save an object of type(str).

Show outdated Hide outdated bokeh/io.py

@canavandl canavandl changed the title from Correctly infers document from bokeh.io._state for bokeh.io.save (instead of creating new one) to Correctly infer document from bokeh.io._state for bokeh.io.save (instead of creating new one) Mar 10, 2017

Show outdated Hide outdated bokeh/io.py
'''
if state is None:
state = _state
filename, resources, title = _get_save_args(state, filename, resources, title)
_save_helper(obj, filename, resources, title, validate)
_save_helper(obj, filename, resources, title)

This comment has been minimized.

@canavandl

canavandl Mar 13, 2017

Contributor

need to warn that the validate arg has been no-op'ed. Now it always happens inside of _ModelInDocument

@canavandl

canavandl Mar 13, 2017

Contributor

need to warn that the validate arg has been no-op'ed. Now it always happens inside of _ModelInDocument

This comment has been minimized.

@bryevdv

bryevdv Mar 13, 2017

Member

This is a private function. Just get rid of it, if it's not used anymore.

@bryevdv

bryevdv Mar 13, 2017

Member

This is a private function. Just get rid of it, if it's not used anymore.

This comment has been minimized.

@canavandl

canavandl Mar 13, 2017

Contributor

I commented that poorly, the validate value comes from the bokeh.io.save function signature, which is user facing. How do we deprecate kwargs in Bokeh?

@canavandl

canavandl Mar 13, 2017

Contributor

I commented that poorly, the validate value comes from the bokeh.io.save function signature, which is user facing. How do we deprecate kwargs in Bokeh?

This comment has been minimized.

@bryevdv

bryevdv Mar 13, 2017

Member

If they are on public APIs by checking for them and calling deprecated explicitly, and then doing whatever fix up is necessary to not propagate the parameter further inside the function.

@bryevdv

bryevdv Mar 13, 2017

Member

If they are on public APIs by checking for them and calling deprecated explicitly, and then doing whatever fix up is necessary to not propagate the parameter further inside the function.

This comment has been minimized.

@bryevdv

bryevdv Mar 13, 2017

Member

Alternatively we can keep it and pass validate through to _ModelInDoc I guess it comes down to whether we want to allow for skipping validation. Though if the old save went through _ModelInDoc I guess we've already effectively been ignoring whether to validate.

@bryevdv

bryevdv Mar 13, 2017

Member

Alternatively we can keep it and pass validate through to _ModelInDoc I guess it comes down to whether we want to allow for skipping validation. Though if the old save went through _ModelInDoc I guess we've already effectively been ignoring whether to validate.

This comment has been minimized.

@canavandl

canavandl Mar 13, 2017

Contributor

We were previously validating an empty document, so essentially not doing validation. I've just removed/deprecated the validate kwarg.

@canavandl

canavandl Mar 13, 2017

Contributor

We were previously validating an empty document, so essentially not doing validation. I've just removed/deprecated the validate kwarg.

This comment has been minimized.

@bryevdv

bryevdv Mar 13, 2017

Member

Fair enough. FYI CI will fail until scripy docs site is back up.

@bryevdv

bryevdv Mar 13, 2017

Member

Fair enough. FYI CI will fail until scripy docs site is back up.

@canavandl

This comment has been minimized.

Show comment
Hide comment
@canavandl

canavandl Mar 13, 2017

Contributor

I believe this is ready for final review. ping @bryevdv

Contributor

canavandl commented Mar 13, 2017

I believe this is ready for final review. ping @bryevdv

filename (str, optional) : filename to save document under (default: None)
If None, use the default state configuration, otherwise raise a
``RuntimeError``.

This comment has been minimized.

@bryevdv

bryevdv Mar 13, 2017

Member

migration note for obj param type change and validate deprecation / ignore

@bryevdv

bryevdv Mar 13, 2017

Member

migration note for obj param type change and validate deprecation / ignore

@@ -659,6 +658,7 @@ def standalone_html_page_for_models(models, resources, title):
UTF-8 encoded HTML
'''
deprecated((0, 12, 5), 'bokeh.io.standalone_html_page_for_models', 'bokeh.io.file_html')

This comment has been minimized.

@bryevdv

bryevdv Mar 13, 2017

Member

migration note for function deprecation

@bryevdv

bryevdv Mar 13, 2017

Member

migration note for function deprecation

This comment has been minimized.

@canavandl

canavandl Mar 14, 2017

Contributor

added

@canavandl

canavandl Mar 14, 2017

Contributor

added

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Mar 13, 2017

Member

LGTM I think it just needs a migration note in 0.12.5.rst

(moved MIGRATION to the issue, I believe that is the current agreed place)

Member

bryevdv commented Mar 13, 2017

LGTM I think it just needs a migration note in 0.12.5.rst

(moved MIGRATION to the issue, I believe that is the current agreed place)

@bryevdv bryevdv removed the MIGRATION label Mar 13, 2017

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Mar 14, 2017

Member

@canavandl there is a conflict to resolve?

Member

bryevdv commented Mar 14, 2017

@canavandl there is a conflict to resolve?

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Mar 15, 2017

Member

Failing only due to known issue with scipy.org being down. Merging now.

Member

bryevdv commented Mar 15, 2017

Failing only due to known issue with scipy.org being down. Merging now.

@bryevdv bryevdv merged commit 5a0aff2 into master Mar 15, 2017

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

@bryevdv bryevdv deleted the canavandl/save_document branch Mar 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment