Feature #2858 produtil - remove sqlite3 dependency - #3344
Conversation
…to move towards removal
…e config variable to the default value
…n or usage (help) statement is requested, 1 (fail) is returned if no arguments are provided, 2 (fail) is returned if an error occurs in the run, and 3 (fail) is returned if an exception is thrown
…less another python env is requested to ensure base image python is working properly. Refactor to reduce cognitive complexity
…ng into METplusConfig to remove need for a parent class
Coverage Report for CI Build 33792534175Coverage decreased (-0.08%) to 91.992%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
🟡 Changes recommended
A Docker automation path can generate invalid commands when python3 is not discoverable via shutil.which, and there is also a small but user-visible log message typo to fix.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR removes produtil.config (and its sqlite3-backed datastore components) to eliminate sqlite3-related failures in Docker/METbaseimage environments, while preserving needed configuration behavior inside METplus via an updated native METplusConfig. It also updates CLI exit codes and test automation so CI/use-case execution better reflects real container behavior.
Changes:
- Replaced inheritance from
produtil.config.ProdConfigwith a METplus-nativeMETplusConfigimplementation (locking, substitution, default handling, nocheck getters). - Removed produtil modules that introduced sqlite3 dependency (
produtil.config,produtil.datastore,produtil.numerics). - Updated
run_metplus.pyexit codes and adjusted unit/use-case tests and GHA helper logic to align with the container’s Python behavior.
File summaries
| File | Description |
|---|---|
ush/run_metplus.py |
Adjusts CLI exit codes for no-args/help/error/exception cases. |
metplus/util/config_metplus.py |
Reworks METplusConfig to be METplus-native with locking and updated getter/substitution behavior. |
metplus/produtil/config.py |
Removed to drop sqlite3-linked produtil configuration implementation. |
metplus/produtil/datastore.py |
Removed sqlite3 datastore implementation. |
metplus/produtil/numerics.py |
Removed unused produtil numerics utilities associated with removed config/datastore stack. |
internal/tests/pytests/util/config_metplus/test_config_metplus.py |
Adds coverage for nocheck getter behavior. |
internal/tests/pytests/run_metplus/test_run_metplus.py |
Updates expected exit codes for help/no-args/invalid args scenarios. |
.github/jobs/get_use_case_commands.py |
Updates Docker automation environment setup to prefer base-image Python where appropriate and refactors component-install setup. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
JohnHalleyGotway
left a comment
There was a problem hiding this comment.
I approve of these change.
I note that...
- all GHA tests pass
- 3 unused files are removed from
produtil - exit codes in
run_metplus.pyare updated as described. I tested the branch locally to confirm the behavior. - the user's guide makes no mention of codes returned by the
run_metplus.pyscript
That information could be added (perhaps near this Configuration chapter), but isn't strictly required for this PR.
- Lastly as I sanity check, I ran
run_metplus.pyin Docker withdevelopandfeature_2558_produtil_sqlite3to confirm...
The problem:
> docker run -it --rm dtcenter/metplus-dev:develop /metplus/METplus/ush/run_metplus.py
...
ModuleNotFoundError: No module named '_sqlite3'
And the fix:
> docker run -it --rm dtcenter/metplus-dev:feature_2858_produtil_sqlite3-pull_request /metplus/METplus/ush/run_metplus.py
Running METplus v13.0.0-rc1-dev
Usage: run_metplus.py arg1 arg2 arg3
-h|--help Display this usage statement
Arguments:
/path/to/parmfile.conf -- Specify custom configuration file to use
section.option=value -- override conf options on the command line
|
As discussed, I'm proceeding with merging this PR. |
Fixes failures that are preventing dtcenter/MET#3435 from being merged.
Note: This PR should NOT close issue #2858, as the code base still contains other components of produtil.
Change Summary
run_metplus.pyto ensure that Docker containers we provide work as expectedrun_metplusexit codes so that running with help argument, e.g.--helpdoes NOT return in a non-zero (failure) value. Also adjusted failure exit codes to be able to discern failure (no args vs. failure in run vs. exception thrown in python code)Pull Request Testing
Ran GHA testing workflow using MET image that was broken (with sqlite3 errors) to confirm that removal of produtil.config resolves failures
Ran GHA testing workflow on branch without sqlite3 fixes with changes to automated tests to use the Python instance built in METbaseimage to confirm that more tests will properly fail if there is something wrong with the base image Python. Previously, only the GFDL-Tracker and GempakToCF use cases used this Python instance. These tools are not being actively supported, so the removal of these use cases could potentially hide issues with the Docker image without this enhancement.
Review code changes and perform any additional testing you think is necessary
Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [Yes]
Do these changes include sufficient testing updates? [Yes]
Will this PR result in changes to the test suite? [No]
If yes, describe the new output and/or changes to the existing output:
Do these changes introduce new SonarQube findings? [No]
If yes, please describe:
Please complete this pull request review by 9/4/2026.
Pull Request Checklist
See the METplus Workflow for details.
Select: Reviewer(s) and Development issue
Select: Milestone as the version that will include these changes
Select: Coordinated METplus-X.Y Support project for bugfix releases or METplus-Wrappers-X.Y.Z Development project for official releases