Skip to content

Conversation

@ela-kotulska-frequenz
Copy link
Contributor

No description provided.

@ela-kotulska-frequenz ela-kotulska-frequenz added the type:enhancement New feature or enhancement visitble to users label Oct 13, 2024
@ela-kotulska-frequenz ela-kotulska-frequenz self-assigned this Oct 13, 2024
@ela-kotulska-frequenz ela-kotulska-frequenz requested a review from a team as a code owner October 13, 2024 14:22
@github-actions github-actions bot added the part:code Affects the code in general label Oct 13, 2024
@github-actions github-actions bot added the part:docs Affects the documentation label Oct 13, 2024
Copy link
Contributor

@llucax llucax left a comment

Choose a reason for hiding this comment

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

I'm not sure if I would declare QuantityT here, I think this is only a requirement for the formula engine because of the time when mypy wasn't working and formula engine was added and the type checking was messed up. Ideally I think a TypeVar for quantities should be TypeVar("QuantityT", bound=Quantity), so it resolves to the concrete type, I'm not sure why we had to go with the current version, I think this actually always will resolve to Quantity.

I think for now I would keep this as a hack in the SDK.


## Summary

This is the initial release, extracted from the [SDK v1.0.0rc601](https://github.com/frequenz-floss/frequenz-sdk-python/releases/tag/v1.0.0-rc601).
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't remove this until we release v1.0.0, we can add that it is based on that code but with some updates.

## New Features

- Added support for `__round__` (`round(quantity)`), `__pos__` (`+quantity`) and `__mod__` (`quantity % quantity`) operators.
- Add `QuantityT` type alias for `Quantity` and `QuantityLike` types.
Copy link
Contributor

Choose a reason for hiding this comment

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

What is QuantityLike?

@llucax
Copy link
Contributor

llucax commented Oct 14, 2024

Just to clarify, I'm not completely against adding it here if it is better/more easy for some reason, just it wouldn't be my first choice for the reasons I mentioned above.

@ela-kotulska-frequenz ela-kotulska-frequenz marked this pull request as draft October 15, 2024 07:56
@ela-kotulska-frequenz ela-kotulska-frequenz force-pushed the types branch 2 times, most recently from b4add4e to 3ba8950 Compare October 15, 2024 10:12
@ela-kotulska-frequenz ela-kotulska-frequenz marked this pull request as ready for review October 16, 2024 12:09
@ela-kotulska-frequenz
Copy link
Contributor Author

As suggested QuantityT was moved back to frequenz-sdk

@llucax llucax added this to the Dropped milestone Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:code Affects the code in general part:docs Affects the documentation type:enhancement New feature or enhancement visitble to users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants