-
-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add warning when existing parameters are updated #3382
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3382 +/- ##
========================================
Coverage 99.59% 99.59%
========================================
Files 258 258
Lines 20755 20757 +2
========================================
+ Hits 20670 20672 +2
Misses 85 85 ☔ View full report in Codecov by Sentry. |
Lychee error is not from this change. Currently looking into the benchmark regression to see if it has to do with the logging. |
Looks like a small regression which is probably random, not too worried about it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
Yeah I figured it was probably random since the test was so simple. Looking into was more of an exercise to learn how to run them locally. Takes forever on my laptop |
Thanks, I agree a warning is better than an error for this. |
If the warning is unwanted, I can just start working on option (2) that I suggested in the original issue. I only intended the warning to be a temporary measure until the larger breaking change was implemented. |
One of the recommended ways for this is to use configuration files that are parsed at the initialisation of a class (in this case, the Some examples are: The easiest of file formats to parse would be JSON (no external dependencies), though, my personal preference has always been TOML due to its readability (note: requires A minimal example could be like [pybamm.plotting]
# override, use six words instead of four
max_words_in_line = 6 It would also provide fine-grained control because of how the TOML format is defined: a table can be expressed and nested too: [pybamm.smoothing]
tolerances.j0__c_e = 1e-8
tolerances.j0__c_s = 1e-8 is the same as [pybamm.smoothing.tolerances]
j0__c_e = 1e-8
j0__c_s = 1e-8 and the |
I am going to close this for now and revisit this ticket later. I am still assigned to the issue as a reminder |
Description
I was looking at #2265 and saw that a lot of tests (34) and examples (22) would be affected by making it an error to update parameters with check_already_exists=False. This makes it seem like a larger change. As an intermediate I propose to implement a warning so users and developers can adjust their scripts before it becomes an error. Similar to adding a deprecation warning.
If this change makes it in before the next release, then users can start adapting their code before the errors begin.
Related #2265
Type of change
Minor change to the way parameters are updated.
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick
(or$ nox -s quick
).Further checks: