Skip to content

Add unit_support() to enable quantity and time support together#17979

Closed
elmostafa-abdelaal wants to merge 6 commits into
astropy:mainfrom
elmostafa-abdelaal:astro-support-function
Closed

Add unit_support() to enable quantity and time support together#17979
elmostafa-abdelaal wants to merge 6 commits into
astropy:mainfrom
elmostafa-abdelaal:astro-support-function

Conversation

@elmostafa-abdelaal
Copy link
Copy Markdown

@elmostafa-abdelaal elmostafa-abdelaal commented Apr 5, 2025

Description

This pull request is to fix #8860

Alternative to #17575

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 5, 2025

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

Copy link
Copy Markdown
Contributor

@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.

Welcome to Astropy 👋 and congratulations on your first pull request! 🎉

A project member will respond to you as soon as possible; in the meantime, please have a look over the Checklist for Contributed Code and make sure you've addressed as many of the questions there as possible.

If you feel that this pull request has not been responded to in a timely manner, please send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail feedback@astropy.org.

@pllim pllim added this to the v7.1.0 milestone Apr 5, 2025
Copy link
Copy Markdown
Contributor

@neutrinoceros neutrinoceros left a comment

Choose a reason for hiding this comment

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

Hi @elmostafa-abdelaal, thanks for your contribution and sorry for the long wait !
I pointed a couple undue changes in your PR, but the most important thing is that it's missing a test. Please let us know if you need help writing one. Thank you !

Comment thread CHANGES.rst
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We do not edit this file directly in PRs. Instead, please add a note as a new file, as described in docs/changes/README.rst.

import numpy as np

__all__ = ["quantity_support"]
__all__ = ["quantity_support", "unit_support"] # ✅ أضفنا unit_support هنا
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We only allow comments in english, so most contributors can understand them

Suggested change
__all__ = ["quantity_support", "unit_support"] # ✅ أضفنا unit_support هنا
__all__ = [
"quantity_support",
"unit_support",
]

... plt.figure()
... plt.plot([1, 2, 3] * u.m)
[...]
...
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please revert this line

...
... plt.plot([101, 125, 150] * u.cm)
[...]
...
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this one too

"""
Enable both quantity and time support for matplotlib.

This is a convenience function that enables both astropy's
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't recall seeing that style in our docs, let's avoid it

Suggested change
This is a convenience function that enables both astropy's
This is a convenience function that enables both

Comment thread docs/changelog.rst
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this file also shouldn't be updated in this PR

Comment on lines +52 to +57
.. function:: unit_support(format="latex_inline")

Enable both quantity and time support for matplotlib.

:param format: Format for unit labels (default: 'latex_inline').
:returns: Context manager enabling both supports.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this is needed: ref_api will automatically generate the text we want to include here

@github-actions github-actions Bot added the Close? Tell stale bot that this issue/PR is stale label Sep 2, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 2, 2025

Hi humans 👋 - this pull request hasn't had any new commits for approximately 4 months. I plan to close this in 30 days if the pull request doesn't have any new commits by then.

In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary.

If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock.

If you believe I commented on this pull request incorrectly, please report this here.

@github-actions github-actions Bot added the closed-by-bot Closed by stale bot label Oct 3, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 3, 2025

I'm going to close this pull request as per my previous message. If you think what is being added/fixed here is still important, please remember to open an issue to keep track of it. Thanks!

If this is the first time I am commenting on this issue, or if you believe I closed this issue incorrectly, please report this here.

@github-actions github-actions Bot closed this Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Close? Tell stale bot that this issue/PR is stale closed-by-bot Closed by stale bot visualization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a way to enable both quantity_support and time_support in one go

4 participants