Skip to content

Convert PC Python objects into strings - #46

Closed
connorjward wants to merge 5 commits into
connorjward/appctx-autofrom
connorjward/pcpython-detect
Closed

Convert PC Python objects into strings#46
connorjward wants to merge 5 commits into
connorjward/appctx-autofrom
connorjward/pcpython-detect

Conversation

@connorjward

Copy link
Copy Markdown
Collaborator

Makes it much more pleasant to construct preconditioners.

It really is that easy.

(Tests and Firedrake PR to follow)

Makes it much more pleasant to construct preconditioners.
Comment thread petsctools/options.py
Comment thread petsctools/options.py
@JHopeCollins

Copy link
Copy Markdown
Member

I am very happy with this functionality!

One small request. Can we have a test that non-PC objects also get converted?
Doesn't have to set up a solver or anything, just something like:

class MyPythonSNES:
	pass

def test_python_type_option():
	with petsctools.inserted_options(
		parameters={
			"snes_type": "python",
			"snes_python_type": MyPythonSNES,
		}
	):
		assert PETSc.Options()["snes_python_type"] == f"{__name__}.MyPythonSNES", "Python type name was not substituted into the options dictionary"

@JHopeCollins

Copy link
Copy Markdown
Member

One small request. Can we have a test that non-PC objects also get converted?
Doesn't have to set up a solver or anything, just something like:

As discussed, I added the test in 78ded27

@connorjward
connorjward marked this pull request as ready for review August 25, 2026 13:14
Comment thread petsctools/options.py Outdated
@connorjward
connorjward changed the base branch from connorjward/appctx-auto to main August 26, 2026 11:45
@connorjward
connorjward changed the base branch from main to connorjward/appctx-auto August 26, 2026 11:56
@connorjward
connorjward force-pushed the connorjward/pcpython-detect branch from d3d3a70 to c84c8df Compare August 26, 2026 11:56
@connorjward

Copy link
Copy Markdown
Collaborator Author

Closing for #49

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