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

Add note about mpdecimal requirement on some Unix platforms #108

Merged

Conversation

antonok-edm
Copy link
Contributor

#25 (comment)

mpdecimal can't really be added as a dependency of RP2 since it's a system library rather than a Python package, but at least we can document it in the installation/setup instructions.

@antonok-edm
Copy link
Contributor Author

Potentially, another option is to include a check like this during some initialization routine:

try:
    from _decimal import *
except ImportError:
    print(MPDECIMAL_NOT_AVAILABLE_WARNING)
    sys.exit(-1)

README.dev.md Outdated Show resolved Hide resolved
@eprbell
Copy link
Owner

eprbell commented Mar 20, 2024

Potentially, another option is to include a check like this during some initialization routine:

try:
    from _decimal import *
except ImportError:
    print(MPDECIMAL_NOT_AVAILABLE_WARNING)
    sys.exit(-1)

I think this is a good approach. It could go here: https://github.com/eprbell/rp2/blob/main/src/rp2/rp2_main.py#L70. The only changes needed are:

  • use LOGGER.error instead of print;
  • sys.exit(1) instead of -1;

Then I think we no longer need the changes to the README files.

@antonok-edm antonok-edm force-pushed the installation-instructions-mpdecimal branch from 333e6aa to 4927365 Compare March 20, 2024 16:10
@antonok-edm
Copy link
Contributor Author

antonok-edm commented Mar 20, 2024

updated!

I also changed the import to as _ to avoid polluting the namespace.

Copy link
Owner

@eprbell eprbell left a comment

Choose a reason for hiding this comment

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

LGTM! I just suggested a comment to describe the issue. Also I think it's fine to disable the import-outside-toplevel pylint warning on the line where it occurs.

src/rp2/rp2_main.py Show resolved Hide resolved
@antonok-edm antonok-edm force-pushed the installation-instructions-mpdecimal branch from 4927365 to 6ea0bd3 Compare March 20, 2024 18:42
Copy link
Owner

@eprbell eprbell left a comment

Choose a reason for hiding this comment

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

Good stuff!

@eprbell eprbell merged commit f06d273 into eprbell:main Mar 21, 2024
16 checks passed
@antonok-edm antonok-edm deleted the installation-instructions-mpdecimal branch March 26, 2024 04:21
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.

2 participants