Add preference file support for Brian2CUDA (issue #281)#322
Add preference file support for Brian2CUDA (issue #281)#322nishantraghuvanshi wants to merge 1 commit intobrian-team:masterfrom
Conversation
Implement automatic loading of Brian2CUDA-specific preferences from dedicated preference files, avoiding validation errors that occur when external package preferences are added to Brian2's main preference file. Changes: - Added _load_preference_files() function to brian2cuda/__init__.py - Checks ~/.brian2cuda_preferences (user-wide preferences) - Checks ./brian2cuda_preferences (project-specific preferences) - Silently ignores missing files, warns on invalid files - Added 3 unit tests to brian2cuda/tests/test_gpu_detection.py Based on approach suggested by @mstimberg in brian-team/brian2#1340 Fixes brian-team#281
|
Hi @nishantraghuvanshi, thanks for the PR and apologies for taking so long to coming back to it. This looks generally good, but note that in brian-team/brian2#1340 I proposed this as a temporary solution, since we'd have to add basically identical code to brian2cuda, brian2genn, and any other Brian extension package that wants to use preferences. Ideally, we'd come up with a more general solution – either, having some "deferred validation" mechanism, or having code similar to what you propose in a function that is included in brian2 itself, which can be called from within the extension package (e.g. brian2cuda would call |
Implemented automatic loading of Brian2CUDA-specific preferences from dedicated preference files, avoiding validation errors that occur when external package preferences are added to Brian2's main preference file.
Changes:
Based on approach suggested by @mstimberg in brian-team/brian2#1340
Please do tell me if there are any problems with this or any changes required.
@denisalevi
Fixes #281