Thanks to visit codestin.com
Credit goes to github.com

Skip to content

For non-html output, let sphinx pick the best format. #14683

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

Merged
merged 1 commit into from
Jul 5, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 3, 2019

See https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html?highlight=figure#images

We were hardcoding the image format before anyways (for html, things are
different because we make the format configurable).

This enables one to support third-party builders instead of having to
explicitly list them in the template.

Admittedly this will now break if someone tries e.g. to do a build
without generating figures in any of the formats supported by the
sphinx builder, whereas previously we would just skip all images; I
think that's reasonable though...

Alternative for #14681.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

See https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html?highlight=figure#images

We were hardcoding the image format before anyways (for html, things are
different because we make the format configurable).

This enables one to support third-party builders instead of having to
explicitly list them in the template.

Admittedly this will now break if someone tries e.g. to do a build
without generating figures in *any* of the formats supported by the
sphinx builder, whereas previously we would just skip all images; I
think that's reasonable though...
@jjcaballero
Copy link

@anntzer, sorry, I think I don't fully understand the alternative. With this, plot directive only would create the images and then, users should call explicitly image directive to include them? Thanks

@anntzer
Copy link
Contributor Author

anntzer commented Jul 3, 2019

I think this should still properly cause the images to be included, doesn't it? (I may be wrong...)

@jjcaballero
Copy link

Right, apologies, I messed up with my testing. Indeed, this causes the images to be included.

Now, I face another problem related to the third party builder: confluence builder does not handle the star at the end of the image name.

@anntzer
Copy link
Contributor Author

anntzer commented Jul 3, 2019

It should be handled by sphinx, but the confluence builder may need to define https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.html.StandaloneHTMLBuilder.supported_image_types?

@tacaswell tacaswell added this to the v3.2.0 milestone Jul 5, 2019
@tacaswell
Copy link
Member

I'm going to merge this as it simplifies the code significantly.

@jjcaballero If you can not get the confluence builder to support * we can re-address #14681

@tacaswell
Copy link
Member

@meeseeksbot backport to v3.1.x backport to v2.2.x

@tacaswell
Copy link
Member

@meeseeksbot backport to v3.1.x

@tacaswell
Copy link
Member

@meeseeksdev backport to v3.1.x

@meeseeksdev backport to v2.2.x

@lumberbot-app
Copy link

lumberbot-app bot commented Jul 17, 2019

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.1.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 c19ebd6d6705cd845b6c69a1a19595b25825bf2e
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #14683: For non-html output, let sphinx pick the best format.'
  1. Push to a named branch :
git push YOURFORK v3.1.x:auto-backport-of-pr-14683-on-v3.1.x
  1. Create a PR against branch v3.1.x, I would have named this PR:

"Backport PR #14683 on branch v3.1.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@tacaswell
Copy link
Member

@meeseeksdev backport to v2.2.x

@lumberbot-app
Copy link

lumberbot-app bot commented Jul 17, 2019

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v2.2.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 c19ebd6d6705cd845b6c69a1a19595b25825bf2e
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #14683: For non-html output, let sphinx pick the best format.'
  1. Push to a named branch :
git push YOURFORK v2.2.x:auto-backport-of-pr-14683-on-v2.2.x
  1. Create a PR against branch v2.2.x, I would have named this PR:

"Backport PR #14683 on branch v2.2.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

1 similar comment
@lumberbot-app
Copy link

lumberbot-app bot commented Jul 17, 2019

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v2.2.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 c19ebd6d6705cd845b6c69a1a19595b25825bf2e
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #14683: For non-html output, let sphinx pick the best format.'
  1. Push to a named branch :
git push YOURFORK v2.2.x:auto-backport-of-pr-14683-on-v2.2.x
  1. Create a PR against branch v2.2.x, I would have named this PR:

"Backport PR #14683 on branch v2.2.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Sep 5, 2019
@tacaswell tacaswell modified the milestones: v3.2.0, v3.1.2 Sep 5, 2019
@tacaswell
Copy link
Member

This can be backported to v2.2.x if there is a champion for it.

dstansby added a commit that referenced this pull request Sep 5, 2019
…-v3.1.x

Backport PR #14683: For non-html output, let sphinx pick the best format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants