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

Get the list of exporters from entrypoints #3879

Merged
merged 1 commit into from
Sep 7, 2018

Conversation

starcruiseromega
Copy link
Contributor

exporter_map is deprecated, so let's use the list of exporters fetched
from the installed entrypoints.

There's a supposed attribute export_from_notebook that should be set
to a friendly string name if the exporter should be exposed in the
front-end. However, the exporters defined in nbconvert don't have it
set, so I haven't used it to determine inclusion in the list. Instead,
I've used the entrypoint name as the friendly name, which looks like it
was the intention from the way they are named.

I ran the unit tests and tried starting up the notebook server and
accessing the API endpoint to verify the JSON looked correct.

`exporter_map` is deprecated, so let's use the list of exporters fetched
from the installed entrypoints.

There's a supposed attribute `export_from_notebook` that should be set
to a friendly string name if the exporter should be exposed in the
front-end. However, the exporters defined in `nbconvert` don't have it
set, so I haven't used it to determine inclusion in the list. Instead,
I've used the entrypoint name as the friendly name, which looks like it
was the intention from the way they are named.

I ran the unit tests and tried starting up the notebook server and
accessing the API endpoint to verify the JSON looked correct.
@starcruiseromega
Copy link
Contributor Author

The JSON from my test run at http://localhost:8888/api/nbconvert looks like this:

{
	"asciidoc": {
		"output_mimetype": "text/asciidoc"
	},
	"custom": {
		"output_mimetype": ""
	},
	"html": {
		"output_mimetype": "text/html"
	},
	"latex": {
		"output_mimetype": "text/latex"
	},
	"markdown": {
		"output_mimetype": "text/markdown"
	},
	"notebook": {
		"output_mimetype": "application/json"
	},
	"pdf": {
		"output_mimetype": "text/latex"
	},
	"python": {
		"output_mimetype": "text/x-python"
	},
	"rst": {
		"output_mimetype": "text/restructuredtext"
	},
	"script": {
		"output_mimetype": ""
	},
	"slides": {
		"output_mimetype": "text/html"
	}
}

starcruiseromega added a commit to starcruiseromega/nbconvert that referenced this pull request Aug 25, 2018
I was working on jupyter/notebook#3879 and it
looks like the intended way to determine whether the exporter should
show up in the list generated by the notebook server was by checking
`export_from_notebook`, but it isn't defined for any of the builtin
exporters.

The docs also say this specifies a friendly name for the exporter. In
the PR mentioned above, I used the name defined by the entrypoint to key
the exporter. It sounds like maybe we should use the value in
`export_from_notebook` instead, so I've made them match, but perhaps
it's confusing to have a "name" for the entrypoint in two places.
@starcruiseromega
Copy link
Contributor Author

@ivanov @mpacer @dharmaquark

@starcruiseromega
Copy link
Contributor Author

I opened jupyter/nbconvert#864 to add the export_from_notebook so that we could get rid of that XXX. I'm not sure if, in that case, it's better to use the value of export_from_notebook as the name in the list instead of the entrypoint name, so I'd be happy to have some guidance on that. :)

@minrk
Copy link
Member

minrk commented Sep 7, 2018

This is great, thank you!

@minrk minrk merged commit 6c0ee1b into jupyter:master Sep 7, 2018
@minrk minrk added this to the 5.7 milestone Sep 13, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants