-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Wrapper to annotate the MIME type of some data #13256
base: master
Are you sure you want to change the base?
Conversation
vs. |
OT. I thought you've got julia running on a oscilloscope... |
The point is that I want it to be passed around automatically. Ideally the |
Fair enough. |
base/multimedia.jl
Outdated
immutable MIMEData{mime} | ||
data::Vector{UInt8} | ||
end | ||
writemime{mime <: MIME}(io::IO,::MIME"text/plain",data::MIMEData{MIME"text/plain"}) = write(io,data.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we normally put spaces after ,
in argument lists, but not around <:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, fair enough. This was quick and dirty, because I have to get something done. Once the name/API is agreed on I'll clean this up, export, add tests/docs, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this definition seems redundant given the one on the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one on the next line is ambigous with (io::IO,::MIME"text/plain", ::Any)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, alright
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ambiguity warning caused by the conflict between this design and the ability to write an arbitrary object as a specific mime type seems concerning to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text/plain
is a bit of a special case, because it falls back to show
.
I thought the whole goal of the |
+1 Good Julia code should not need this, but when you just have one format availible and want to pass it through the display system a shortcut like this seems reasonable. |
+1 |
I'd like something like A constructor that reinterprets anything to |
There's already |
I came across this looking back over old PRs, and I'm pretty sure this is one of the missing pieces that should fit into #13825 somehow. That part still remains to be figured out, however. |
fwiw, i think IPython effectively calls this same concept a |
I don't love the name. I do wonder how much we should be tying all of this to MIME types, per se. @fperez and @ellisonbg, any thoughts on the naming of |
If I am understanding the discussion, I think it may make sense to have at least two levels of APIs.
Does this make sense? |
Thanks for the feedback, @ellisonbg. I think that given our nomenclature, since this type is used to wrap an object that has effectively already had |
I just wanted this again, so bump, I guess ;)? |
Data point on naming: whenever I've thought about this, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a number of deprecations to fix, but I think there's strong consensus now that this should be merged.
@vtjnash: would it be more effective if you just fixed this PR up yourself? |
@vtjnash Yes. This seems very related to #38540 -- I'm looking for a package-independent way to annotate that a particular chunk of data is Is there a way to get this in the Julia 1.7 LTS? It would improve interoperability of otherwise completely independent packages which work with hypertext. Perhaps for Julia 2.0, one could explore breaking changes such as deprecating |
@StefanKarpinski - is this PR still acceptable if updated? There are many cases where otherwise independent applications could use a way to share |
I think this feature could be useful for sharing multimedia content between collaborating libraries that do not otherwise know about each other -- Even so, I was barking up the wrong tree. I've since learned that |
We approved this years ago, but still needs to be rebased as it is likely stale, and docs and tests before we can merge |
cf1198d
to
b38bf5a
Compare
@Keno and/or @clarkevans - can you add tests and docs? |
There is also https://github.com/tkf/DisplayAs.jl. |
ba15319
to
e20bf2a
Compare
Also, CI is failing. |
Still any plans to update this, or can it be closed? |
I frequently find myself in the situation, where I have some data (say `image/png`), that I just want to have show up properly in the REPL without having to create a whole extra type for it. I don't think we currently have something like that. I would propose something like this (name to be bikeshedded), unless there already exists something better.
e20bf2a
to
32910a4
Compare
I rebased this and modernized it, incorporating comments by @vtjnash above, in case we ever want to merge it. Still needs tests if we still want it. (But there doesn't seem to have been a burning need for it?) |
Also needs an export and to be added to docs, but seems still useful even if rare (how much do packages actually notice MIME-type customizations they could be doing anyways?) |
I frequently find myself in the situation, where I have some data (say
image/png
), that I just want to have show up properly in the REPL without having to create a whole extra type for it. I don't think we currently have something like that. I would propose something like this (name to be bikeshedded), unless there already exists something better. cc @stevengjExample usage:
![screen shot 2015-09-21 at 11 32 05 am](https://cloud.githubusercontent.com/assets/1291671/9996303/6c00613c-6054-11e5-8d91-7eac2f7df518.png)