Rename have_optional_dependency#3866
Rename have_optional_dependency#3866arjxn-py merged 7 commits intopybamm-team:developfrom kratman:feat/renameFunction
Conversation
agriyakhetarpal
left a comment
There was a problem hiding this comment.
Thanks, @kratman! For next time we should look at removing such functions from the public API – I don't think it is being used by anyone currently and does not provide any useful functionality to users either.
Yeah, python's handling of private methods makes me miss C++ |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3866 +/- ##
===========================================
- Coverage 99.60% 99.60% -0.01%
===========================================
Files 259 259
Lines 21272 21270 -2
===========================================
- Hits 21188 21186 -2
Misses 84 84 ☔ View full report in Codecov by Sentry. |
Saransh-cpp
left a comment
There was a problem hiding this comment.
Thanks! We should also look into adding __all__ to pybamm modules; not in this PR though.
|
@arjxn-py, @Saransh-cpp I saw this in I assume this no longer make sense here either. There used to be an "import_optional_dependency" above it |
Yes! IIRC we did do some hacky stuff to make sympy optional, maybe this was left behind. |
Yes, please also consider removing the import of |
I agree, xref: #2427 for public and private API discussions |
* Rename have_optional_dependency * Change log * Fix import * style: pre-commit fixes * Update pybamm/util.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com>
* Enable flake8-bugbear Fix unused-loop-control-variable (B007) Fix function-uses-loop-variable (B023) Fix raise-without-from-inside-except (B904) Fix mutable-argument-default (B006) Fix no-explicit-stacklevel (B028) Fix get-attr-with-constant (B009) Fix loop-variable-overrides-iterator (B020) Fix unary-prefix-increment-decrement (B002) Fix function-call-in-default-argument (B008) Fix cached-instance-method (B019) * Show exception chain (B904) * Disable single lint check (B019) * delay xarray.DataArray initialization * revert example * Bump the actions group with 1 update (#3861) Bumps the actions group with 1 update: [awalsh128/cache-apt-pkgs-action](https://github.com/awalsh128/cache-apt-pkgs-action). Updates `awalsh128/cache-apt-pkgs-action` from 1.4.1 to 1.4.2 - [Release notes](https://github.com/awalsh128/cache-apt-pkgs-action/releases) - [Commits](awalsh128/cache-apt-pkgs-action@v1.4.1...v1.4.2) --- updated-dependencies: - dependency-name: awalsh128/cache-apt-pkgs-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Make `typing-extensions` and `sympy` required dependencies to fix PyBaMM import (#3848) * import `typing_extensions` as optional_dependency * Make `typing-extensions` a required dependency * Try forward referencing for `sympy` in `IndependentVariable` * Make `sympy` a required dependency * Update docs for SymPy * Import `sympy` without `have_optional_dependency` * Import `sympy` without `TYPE_CHECKING` * Changelog * Update CHANGELOG.md Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> * Rearrange position in changelog --------- Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com> * Rename have_optional_dependency (#3866) * Rename have_optional_dependency * Change log * Fix import * style: pre-commit fixes * Update pybamm/util.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com> * update changelog for #3862 (#3869) * update changelog for #3862 * reword * fix deprecation warning and check for electrode/particle diffusivity * update test * Edit naming for unused loop control variable (B007) * #3883 updates to install from source (#3884) * Disable benchmarks on PRs (#3876) * Remove`[ latexify` extra (#3888) * Improve Getting Started notebooks (#3750) * improve tutorials 1 to 3 * use new syntax for plot_voltage_components * style: pre-commit fixes * simplify notebook by removing drive cycle * add additional comment on dynamic_plot * improve tutorial 5 * remove the use of solution in notebook 5, this is introduced in notebook 6 * fix minor typo * minor text updates * style: pre-commit fixes * minor text updates plus extra links * minor text updates! * minor text updates * remove tutorial 10 as very similar to tutorial 3 in creating models * move and rename tutorial 11 to creating models section * style: pre-commit fixes * fix minor typo in current_with_time * implement Rob & Eric's comments * update docs links * Valentin's comments * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com> * chore: update pre-commit hooks (#3890) * chore: update pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](astral-sh/ruff-pre-commit@v0.2.2...v0.3.2) * style: pre-commit fixes * Update .git-blame-ignore-revs --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> * style: pre-commit fixes * Resolve conflicts (B904, B028, B020) * Added a schedule on `needs-reply remove` workflow (#3891) * added schedule to need-reply workflow * added schedule to need-reply workflow --------- Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com> * style: pre-commit fixes --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Valentin Sulzer <valentinsulzer@hotmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com> Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Martin Robinson <martinjrobins@gmail.com> Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk> Co-authored-by: Santhosh <52504160+santacodes@users.noreply.github.com>
* Rename have_optional_dependency * Change log * Fix import * style: pre-commit fixes * Update pybamm/util.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com>
* Enable flake8-bugbear Fix unused-loop-control-variable (B007) Fix function-uses-loop-variable (B023) Fix raise-without-from-inside-except (B904) Fix mutable-argument-default (B006) Fix no-explicit-stacklevel (B028) Fix get-attr-with-constant (B009) Fix loop-variable-overrides-iterator (B020) Fix unary-prefix-increment-decrement (B002) Fix function-call-in-default-argument (B008) Fix cached-instance-method (B019) * Show exception chain (B904) * Disable single lint check (B019) * delay xarray.DataArray initialization * revert example * Bump the actions group with 1 update (pybamm-team#3861) Bumps the actions group with 1 update: [awalsh128/cache-apt-pkgs-action](https://github.com/awalsh128/cache-apt-pkgs-action). Updates `awalsh128/cache-apt-pkgs-action` from 1.4.1 to 1.4.2 - [Release notes](https://github.com/awalsh128/cache-apt-pkgs-action/releases) - [Commits](awalsh128/cache-apt-pkgs-action@v1.4.1...v1.4.2) --- updated-dependencies: - dependency-name: awalsh128/cache-apt-pkgs-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Make `typing-extensions` and `sympy` required dependencies to fix PyBaMM import (pybamm-team#3848) * import `typing_extensions` as optional_dependency * Make `typing-extensions` a required dependency * Try forward referencing for `sympy` in `IndependentVariable` * Make `sympy` a required dependency * Update docs for SymPy * Import `sympy` without `have_optional_dependency` * Import `sympy` without `TYPE_CHECKING` * Changelog * Update CHANGELOG.md Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> * Rearrange position in changelog --------- Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com> * Rename have_optional_dependency (pybamm-team#3866) * Rename have_optional_dependency * Change log * Fix import * style: pre-commit fixes * Update pybamm/util.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com> * update changelog for pybamm-team#3862 (pybamm-team#3869) * update changelog for pybamm-team#3862 * reword * fix deprecation warning and check for electrode/particle diffusivity * update test * Edit naming for unused loop control variable (B007) * pybamm-team#3883 updates to install from source (pybamm-team#3884) * Disable benchmarks on PRs (pybamm-team#3876) * Remove`[ latexify` extra (pybamm-team#3888) * Improve Getting Started notebooks (pybamm-team#3750) * improve tutorials 1 to 3 * use new syntax for plot_voltage_components * style: pre-commit fixes * simplify notebook by removing drive cycle * add additional comment on dynamic_plot * improve tutorial 5 * remove the use of solution in notebook 5, this is introduced in notebook 6 * fix minor typo * minor text updates * style: pre-commit fixes * minor text updates plus extra links * minor text updates! * minor text updates * remove tutorial 10 as very similar to tutorial 3 in creating models * move and rename tutorial 11 to creating models section * style: pre-commit fixes * fix minor typo in current_with_time * implement Rob & Eric's comments * update docs links * Valentin's comments * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com> * chore: update pre-commit hooks (pybamm-team#3890) * chore: update pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](astral-sh/ruff-pre-commit@v0.2.2...v0.3.2) * style: pre-commit fixes * Update .git-blame-ignore-revs --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> * style: pre-commit fixes * Resolve conflicts (B904, B028, B020) * Added a schedule on `needs-reply remove` workflow (pybamm-team#3891) * added schedule to need-reply workflow * added schedule to need-reply workflow --------- Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com> * style: pre-commit fixes --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Valentin Sulzer <valentinsulzer@hotmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com> Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Martin Robinson <martinjrobins@gmail.com> Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk> Co-authored-by: Santhosh <52504160+santacodes@users.noreply.github.com>
Description
Renames
have_optional_dependency()toimport_optional_dependency()Fixes #3864
Type of change
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: