Skip to content

Conversation

@tlambert03
Copy link
Contributor

@tlambert03 tlambert03 commented Mar 7, 2024

Adds a Unit type (for discussion, see #64).

examples:

width: Annotated[float, Unit('m')] = 1
angle: Annotated[float, Unit('rad') = 0
temperature: Annotated[float, Unit('celsius')] = 100
weight: Annotated[float, Unit('kg') = 42

annotated_types makes no attempt to parse the unit string

@codecov-commenter
Copy link

codecov-commenter commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 56.25000% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 94.93%. Comparing base (89e3d2e) to head (6c27462).

Files Patch % Lines
annotated_types/__init__.py 53.33% 0 Missing and 7 partials ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #65      +/-   ##
==========================================
- Coverage   95.00%   94.93%   -0.07%     
==========================================
  Files           2        2              
  Lines         220      217       -3     
  Branches       33       41       +8     
==========================================
- Hits          209      206       -3     
+ Misses          9        2       -7     
- Partials        2        9       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Thanks for including an example implementation to discuss! It's in good shape, but we'll want to finish discussing the design over in #64 before merging 🙂

@tlambert03
Copy link
Contributor Author

renamed to Unit as per general preference in #64

@tlambert03 tlambert03 changed the title Add Quantity type Add Unit type Mar 14, 2024
@tlambert03
Copy link
Contributor Author

ok @Zac-HD @adriangb and @hgrecco. Please have a look at the added docs and readme, and let me know if you'd like anything changed

@tlambert03
Copy link
Contributor Author

friendly ping

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Thanks for the ping @tlambert03 - this looks good to me, and since we've had no other objections I'm going to go ahead and merge 🙂

@Zac-HD Zac-HD merged commit 99dbac8 into annotated-types:main Apr 22, 2024
@tlambert03 tlambert03 deleted the quantity branch May 20, 2024 11:24
@tlambert03
Copy link
Contributor Author

@adriangb, if you're not waiting for other issues to resolve first, could I trouble you for a release on this?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants