Repository navigation
Enable formatting Quantity units through string format specification - #13050
Conversation
|
Maybe they couldn't figure out what to make chicken taste like, which is why chicken tastes like everything. (A special day message.) |
|
@eerovaher. This is a cool idea. |
|
Hmm, not completely sure: for A bit more generally, I've long wanted a sensible extension of the mini-language to quantities, angles, times, coordinates, etc. But the difficulty is of course to agree on what is "sensible". I do think we have to try hard to ensure we do not close off avenues -- in this case, linking more explicitly to |
|
I don't think I'll have time to work on quantity formatting before the next feature freeze, but if merging the documentation updates in d434857 is considered to be a good idea then I can open a separate pull request for that. |
|
@eerovaher - I'd say go for a small PR with just the doc updates - I just looked at them and they are all good to go in. |
37a57ba to
2a4341d
Compare
|
There were 191 failures in the dev version of key dependencies tests, but the same tests have the same number of failures on
|
2a4341d to
24f1bc1
Compare
I don't think it's necessary. |
|
Re-base for CI bot |
It is now possible to use unit format names as string format specifiers
for a `Quantity`, e.g. `f'{1*u.m/u.s:vounit}'` now produces the string
`'1.0 m.s**-1'`.
24f1bc1 to
3a35def
Compare
mhvk
left a comment
There was a problem hiding this comment.
Looking over units PRs for 5.2, I see I missed the rebase here quite a while back. I think here the obvious convenience outweighs my remaining minor worries about exactly how to use the formatting; this seems decently future proof.
|
@nstarman, @eerovaher - since this has been quite a while, just a quick check you are both heppy with the PR as is! |
|
No objections to merging from me. |
|
OK, in it goes! Thanks, @eerovaher! |
Description
This pull request enables using unit format names as string format specifiers for
Quantityobjects, e.g.When I was updating the documentation I saw the potential for a few improvements which seemed too small for a separate pull request, so I included them here in a separate commit.(EDIT: The documentation fixes were moved to a separate pull request)
Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
Extra CIlabel.no-changelog-entry-neededlabel. If this is a manual backport, use theskip-changelog-checkslabel unless special changelog handling is necessary.astropy-botcheck might be missing; do not let the green checkmark fool you.backport-X.Y.xlabel(s) before merge.