Skip to content

Deprecate appctx - #5427

Open
connorjward wants to merge 3 commits into
mainfrom
connorjward/deprecate-appctx
Open

Deprecate appctx#5427
connorjward wants to merge 3 commits into
mainfrom
connorjward/deprecate-appctx

Conversation

@connorjward

Copy link
Copy Markdown
Contributor

Now that we can pass Python objects in the solver parameters dictionary (firedrakeproject/petsctools#41) we don't need to use the appctx for solvers any more. This PR lays out a deprecation process for moving towards the new approach.

Deprecation process:

  1. Existing code will still run but accessing _SNESContext.appctx (which happens inside PCs) will now throw a DeprecationWarning.
  2. PCs will need to switch to _SNESContext.get_python_option() which tries the new approach but falls back to the appctx if not found. This means that users can continue to pass appctx= but will see a warning.

This is the first of two PRs. The deprecation mechanism is itself a bit confusing so I wanted to review it separately. A subsequent PR will address removing appctx from our own code.

Preconditioners accessing the appctx will now raise a warning telling
them to use _SNESContext.get_python_option instead, and once PCs switch
over users will see warnings if they continue to use appctx.
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.

1 participant