Skip to content

Conversation

@hettlage
Copy link
Contributor

This PR addresses issue #55.

It adds a new class AstropyQuantityTypeAnnotation, which lets the user define custom types making use of AstroPy's Quantity class.

Tests for this new class are added, and the documentation on defining models is updated.

@jchate6 jchate6 requested a review from Fingel October 21, 2025 15:43
@Fingel
Copy link
Contributor

Fingel commented Oct 21, 2025

Hello again @hettlage ! Thanks for this PR.
It does look like a nice type to have. It doesn't appear to be used anywhere. Is this intentional? For example, in the proper motion field for Targets:

proper_motion_ra: Annotated[float, Le(20000.0)] = 0

@hettlage
Copy link
Contributor Author

I'm happy to update the models. This will need some additional validators, as the validators of the annotated_types library don't support Quantity objects. I'll extend the PR accordingly.

The validators are intended for cases where you cannot use the corresponding validators from the `annotated_types` library (for example, when dealing with AstroPy `Quantity` objects).
The validators are intended for cases where you cannot use the corresponding validators from the `annotated_types` library (for example, when dealing with AstroPy `Quantity` objects).
@hettlage
Copy link
Contributor Author

I have added some validators.

But on second thoughts, I'm reluctant to update the existing models, as this would be a breaking change - consumers of the models might assume that the affected properties have float values, whereas now in fact they would be Quantity objects.

Would you be happy with such breaking changes?

@hettlage
Copy link
Contributor Author

Is there anything else you would need from me for this PR? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants