Skip to content

Conversation

@connorjward
Copy link
Collaborator

@connorjward connorjward commented Jun 25, 2025

This is particularly important for when someone forgets to pass --no-build-isolation when pip installing firedrake (or some other downstream library). If petsc4py isn't in the isolated build environment then you get an unhelpful missing attribute error for petsctools.init, which doesn't explain why init is missing`.

@connorjward connorjward requested a review from JHopeCollins July 4, 2025 14:00
Copy link
Member

@JHopeCollins JHopeCollins left a comment

Choose a reason for hiding this comment

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

This is a very good addition, thanks @connorjward.
I just have one suggestion to improve the error message even further, other than that I think it's good to go.

For the record, if I "forget" to pass --no-build-isolation with the current petsctools main branch then I get this error:

  AttributeError: module 'petsctools' has no attribute 'init'
  error: subprocess-exited-with-error
  
  × Getting requirements to build editable did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

Whereas if I "forget" using this branch then I get:

  ImportError: Cannot load 'init' from module 'petsctools' because petsc4py is not available
  error: subprocess-exited-with-error
  
  × Getting requirements to build editable did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

connorjward and others added 3 commits July 14, 2025 16:20
Co-authored-by: Josh Hope-Collins <jhc.jss@gmail.com>
Copy link
Member

@JHopeCollins JHopeCollins left a comment

Choose a reason for hiding this comment

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

I fixed a syntax error in my suggestion. LGTM now.

@JHopeCollins JHopeCollins merged commit 0e38005 into main Jul 15, 2025
1 check passed
@JHopeCollins JHopeCollins deleted the connorjward/dummy-attrs branch November 10, 2025 21:55
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.

3 participants