Make MPAv2 work with pure Python and with ProcessPoolExecutor #10163
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
Today, when
st.navigationis present in an app, any code usingProcessPoolExecutorwill throw an exception. Turns out this is becauseProcessPoolExecutorspins up a separate pure-Python process, and there's a bug that causesst.navigationnot to work in pure-Python mode (it requires a ScriptRunContext).This wasn't caught before because our pure-Python tests (
make bare-execution-tests) weren't actually running for scripts in subfolders of the main test folder....and when you run those previously-untested tests you discover
st.page_linkalso doesn't work in pure-Python mode!So this PR addresses all of the above:
st.navigationandst.page_linkwork in pure-Python mode -- and therefore also when running inside aProcessPoolExecutorbare-execution-teststest MPAv1 and MPAv2 codeGitHub Issue Link (if applicable)
n/a
Testing Plan
Explanation of why no additional tests are neededContribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.