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

better error handling for managed site installations #13

Merged
merged 1 commit into from
Dec 8, 2024

Conversation

mbway
Copy link
Collaborator

@mbway mbway commented Dec 7, 2024

With MaturinBuildSettings and MaturinDevelopSettings removed in #11 I was concerned about what would happen if users are importing these classes in sitecustomize.py. Looking at the 0.1.0 release, the presets option wasn't available so it's unlikely many user's installs will break.

It seems that when something breaks in sitecustomize.py an error is printed but the interpreter continues. To help the user resolve the problem, managed installations now print a message informing the user how they can remove the installation to resolve the error:

$ python
Error in sitecustomize; set PYTHONVERBOSE for traceback:
RuntimeError: MaturinSettings.__init__() got an unexpected keyword argument 'asdf'
>> ERROR in managed maturin_import_hook installation. Remove with `python -m maturin_import_hook site uninstall`

Python 3.13.1 (main, Dec  6 2024, 18:40:43) [Clang 18.1.8 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

In future, if any maturin flags change and MaturinSettings changes to match, breakages could become more common so it is important to handle this case properly.

@mbway mbway self-assigned this Dec 7, 2024
@mbway mbway requested a review from messense December 7, 2024 22:10
@messense messense merged commit 496c0fe into PyO3:main Dec 8, 2024
5 checks passed
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