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 cli uncertainty package import #2032

Merged

Conversation

daspk04
Copy link
Contributor

@daspk04 daspk04 commented Jul 6, 2024

… package

* This changes the default behaviour for importing "uncertainties" package in cli, as it was enabled by default and was imported even if it was an optional package.

* The default behaviour of the convert function has been adjusted accordingly to only consider 'uncertainties' if the argument "-U" or "--with-unc" is provided.
* The changes in the document illustrate how the `-U` flag is used to enable uncertainty in the pint-convert program.

* Previously, the documentation indicated that the `-U` flag was used to disable uncertainty, but based on current changes `-U` flag would indicate `-U` is enabled.

* Updates also include modifications for multiple examples demonstrating the proper `-U` flag usage.
Copy link

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

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

My 2 small comments

docs/dev/pint-convert.rst Outdated Show resolved Hide resolved
pint/pint_convert.py Show resolved Hide resolved
Copy link

codspeed-hq bot commented Jul 8, 2024

CodSpeed Performance Report

Merging #2032 will not alter performance

Comparing daspk04:fix-cli-uncertainty-package-import (915a889) with master (f9c381c)

Summary

✅ 437 untouched benchmarks

andrewgsavage and others added 8 commits July 8, 2024 13:20
* Added try/except blocks to handle ImportError and AttributeError in pint_convert.py. Now the code tries to import the 'uncertainties' library and falls back to raise an exception if the library is not present.

* Similarly, an AttributeError is caught when calculating correlation of values which requires numpy, prompting users to install the package if not available.
@andrewgsavage andrewgsavage merged commit b2fc74a into hgrecco:master Jul 8, 2024
53 checks passed
@daspk04 daspk04 deleted the fix-cli-uncertainty-package-import branch July 8, 2024 15:14
Copy link

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

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

Nice job! Thanks for working on this :).

CHANGES Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants