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

Add unsafe flag #1

Closed
tonyfast opened this issue Aug 14, 2015 · 4 comments
Closed

Add unsafe flag #1

tonyfast opened this issue Aug 14, 2015 · 4 comments

Comments

@tonyfast
Copy link

Could you provide an option to load python tags something like

%%yaml foo --unsafe
bar: baz

I am thinking this could be useful in the context of yaml manifests for data with plot representations.

@bollwyvl
Copy link
Owner

Another option would be to pass it a particular loader... that way you can configure it to do your own custom parsing without letting the whole of python be exposed... unless you intentionally pick yaml.Baseloader.

In the case of Bokeh, a custom loader would be nice:
http://pyyaml.org/wiki/PyYAMLDocumentation#Constructorsrepresentersresolvers

bokeh could then just be a URI namespace.

%%yaml foo Loader=BokehLoader
%TAG !bokeh! tag:bokeh.pydata.org,2015:/
plot: !bokeh!charts.line
    args:
    - y: [6, 7, 2, 4, 5]
      z: [1, 5, 12, 4, 2]
    kwds:
        title: simple line example 
        xlabel: x
        ylabel: values
        width: 400
        height: 400

The advantage here is one could imagine not being specifically tied to python for dereferencing, jsyaml supports such namespaced tags as well.

@tonyfast
Copy link
Author

Yes that is a much more pleasing suggestion. The snippet above could emit a Bokeh plot and %%yaml foo Loader=BaseLoader could emit the data structure.

bollwyvl added a commit that referenced this issue Aug 15, 2015
@bollwyvl
Copy link
Owner

Added --loader with #2, up on PyPi as 0.2.0!

@tonyfast
Copy link
Author

Sickkk. Could you make a notebook with what a customer loader might look
like?

On 5:31PM, Sat, Aug 15, 2015 bollwyvl notifications@github.com wrote:

Added --loader with #2 #2, up
on PyPi as 0.2.0 https://pypi.python.org/pypi/yamlmagic/0.2.0!


Reply to this email directly or view it on GitHub
#1 (comment).

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

No branches or pull requests

2 participants