Strip .json extension from CSV filenames in json2csv (Fixes #1679)#1967
Merged
nfahlgren merged 2 commits intoJul 10, 2026
Merged
Conversation
When plantcv-run-workflow converts results to CSV it reuses the JSON results filename as the CSV prefix, producing filenames like output_control.json-single-value-traits.csv. Strip a trailing .json extension from the prefix so the output is output_control-single-value-traits.csv. Fixes danforthcenter#1679
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Python | Jul 10, 2026 5:02p.m. | Review ↗ | |
| Code coverage | Jul 10, 2026 5:32p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
nfahlgren
approved these changes
Jul 10, 2026
Member
|
@all-contributors please add @Mohit-Ak for code, testing |
Contributor
|
I've put up a pull request to add @Mohit-Ak! 🎉 |
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #1679.
When running
plantcv-run-workflow, the CSV files it generates from the JSONresults keep the
.jsonextension embedded in their names. For example, with aconfig pointing at
./results/output_control.json, the workflow writes:instead of the expected
output_control-single-value-traits.csv.Root cause
In
plantcv/parallel/cli.py, the JSON results filename is passed directly as theCSV prefix:
json2csvthen builds its outputs ascsv_prefix + "-single-value-traits.csv",so the
.jsonextension ends up glued in front of the-single-value-traits.csvsuffix. Anyone calling
json2csvdirectly with a.json-suffixed prefix hits thesame thing.
Fix
Strip a trailing
.jsonextension fromcsv_prefixinsidejson2csvbefore theoutput filenames are assembled. Doing it in
json2csvcovers both the automaticworkflow call and any direct call, so the whole bug class is handled in one place
rather than only patching the single reported call site.
Testing
Added a regression test,
test_json2csv_json_prefix, that callsjson2csvwith a.json-suffixed prefix and asserts the output isexports-single-value-traits.csvand not
exports.json-single-value-traits.csv.exports.json-single-value-traits.csv)and passes after it.
pytest tests/utils/— 17 passed.pytest tests/parallel/— 37 passed (this exercises therun-workflow→json2csvpath).flake8 --max-line-length=127(the repo's configured limit from.deepsource.toml) is clean on both changed files.