Skip to content

Fix import of styles with relative path #25268

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 2 commits into from
Feb 21, 2023
Merged

Conversation

fjosw
Copy link
Contributor

@fjosw fjosw commented Feb 20, 2023

PR Summary

This PR fixes bug #25242 by also catching TypeError exceptions when importing style files via a relative path. I also added an additional test case for importing styles with relative paths.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [N/A] New plotting related features are documented with examples.

Release Notes

  • [N/A] New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • [N/A] API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • [N/A] Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@rcomer rcomer linked an issue Feb 20, 2023 that may be closed by this pull request
@rcomer rcomer added this to the v3.7.1 milestone Feb 20, 2023
@oscargus
Copy link
Member

Thanks for this and congratulations on your first merged PR! Hope to see you around!

@oscargus oscargus merged commit ee7d75e into matplotlib:main Feb 21, 2023
@lumberbot-app
Copy link

lumberbot-app bot commented Feb 21, 2023

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.7.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 ee7d75eeaecf795d6d2134607139a5864c101b60
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #25268: Fix import of styles with relative path'
  1. Push to a named branch:
git push YOURFORK v3.7.x:auto-backport-of-pr-25268-on-v3.7.x
  1. Create a PR against branch v3.7.x, I would have named this PR:

"Backport PR #25268 on branch v3.7.x (Fix import of styles with relative path)"

And apply the correct labels and milestones.

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

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

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

ksunden pushed a commit to ksunden/matplotlib that referenced this pull request Feb 21, 2023
…ith relative path)

Fix import of styles with relative path

(cherry picked from commit ee7d75e)

Conflict was caused by pyupgrade changing IOError to OSError (which are
aliases of each other since py3.3)
QuLogic added a commit that referenced this pull request Feb 21, 2023
…3.7.x

Backport PR #25268 on branch v3.7.x (Fix import of styles with relative path)
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.

[Bug]: Relative paths in plt.style.use() no longer work in 3.7
5 participants