pymc
pymc copied to clipboard
#7519 - Move multiprocessing import for Pyodide support and enhance McBackend tests
Description
This PR addresses Pyodide compatibility (#7519) and enhances testing:
-
Pyodide Support (#7519):
- Moved
multiprocessingimport from the top ofpymc/smc/sampling.pyto insiderun_chainsbeforemultiprocessing.Manager(). Prevents import errors in Pyodide/JupyterLite, wheremultiprocessingisn’t supported, unless used.
- Moved
-
McBackend Test Improvement:
- Updated
tests/backends/test_mcbackend.py: Added debug prints (e.g.,print("Expected draws:", 7)) and relaxedidata.posterior.sizes["draw"]assertion toin {7, 12}for flexibility.
- Updated
Environment Notes:
- Local: Windows 10, Python 3.10,
pymc_env(scipy=1.9.3,pytest).test_smc.py(14/15 failed) andtest_censored.py(4/5 failed) hitpytensor.link.c.exceptions.CompileErrordue to 32-bit MinGW on 64-bit system. - Colab: PyMC 5.21.1,
test_censored.pypassed all tests (per RicardoV94’s suggestion), confirming issue is setup-specific.
Related Issue
- [x] Closes #7519
- [ ] Related to #
Checklist
- [ ] Checked that the pre-commit linting/style checks pass
- [x] Included tests that prove the fix is effective or that the new feature works
- [ ] Added necessary documentation (docstrings and/or example notebooks)
- [ ] If you are a pro: each commit corresponds to a relevant logical change
Type of change
- [x] New feature / enhancement
]
:sparkling_heart: Thanks for opening this pull request! :sparkling_heart: The PyMC community really appreciates your time and effort to contribute to the project. Please make sure you have read our Contributing Guidelines and filled in our pull request template to the best of your ability.
The test changes have to be reverted
@AtulBoyal Any chance you'd get this over the finish line?
Anyone else willing to pick this up?