Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for % (percent) unit (missing unary operator "%") #5527

Merged
merged 3 commits into from
Sep 12, 2023

Conversation

30350n
Copy link
Contributor

@30350n 30350n commented Sep 11, 2023

If using the newest version from master, adding a PartParameter with a PartParameterTemplate that uses % as its unit results in a pint.errors.DefinitionSyntaxError: missing unary operator "%" error.

This seems to be a pint issue (see pint #1758) which is sadly still present on pint 0.22 and 0.23. The user who created the mentioned issue provided a workaround though, which this patch applies. Imo this is the way to go for now, because otherwise the % unit is just unusable.

@netlify
Copy link

netlify bot commented Sep 11, 2023

Deploy Preview for inventree canceled.

Name Link
🔨 Latest commit 5c5a745
🔍 Latest deploy log https://app.netlify.com/sites/inventree/deploys/64ffa62c5ea62400072214a6

@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed backport Apply this label to a PR to enable auto-backport action backport-to-0.12.x labels Sep 11, 2023
@SchrodingersGat SchrodingersGat added this to the 0.13.0 milestone Sep 11, 2023
@SchrodingersGat
Copy link
Member

@30350n thanks for the fix, and nice addition of unit tests :)

@30350n
Copy link
Contributor Author

30350n commented Sep 11, 2023

No problem! :) Just fixed the fomatting, Style checks should pass now hopefully.

@SchrodingersGat SchrodingersGat merged commit f11a9e9 into inventree:master Sep 12, 2023
21 checks passed
@SchrodingersGat
Copy link
Member

Thanks for the contribution :)

@github-actions
Copy link
Contributor

💔 All backports failed

Status Branch Result
0.12.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

backport --pr 5527

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@lafrech
Copy link

lafrech commented Feb 13, 2024

I believe the workaround I proposed in hgrecco/pint#1758 is not needed anymore since Pint 0.23.

@SchrodingersGat SchrodingersGat mentioned this pull request Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Apply this label to a PR to enable auto-backport action bug Identifies a bug which needs to be addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants