Skip to content
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

lib: Add a standard parser option for JSON formatting #3704

Merged
merged 2 commits into from May 24, 2024

Conversation

kritibirda26
Copy link
Contributor

As a part of #3019, JSON format support will be added to multiple modules. By default, modules output in existing plain format. If the format=json option is provided, modules will output in JSON format instead. To avoid duplication of code across several modules, define a standard parser option.

@github-actions github-actions bot added raster Related to raster data processing C Related code is in C libraries module general imagery labels May 13, 2024
include/grass/gis.h Outdated Show resolved Hide resolved
include/grass/gis.h Outdated Show resolved Hide resolved
lib/gis/parser_standard_options.c Outdated Show resolved Hide resolved
@kritibirda26 kritibirda26 force-pushed the json-standard-parser-option branch 2 times, most recently from 49e78b7 to 9bdcd76 Compare May 13, 2024 07:32
Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also replace it in v.db.select, the options are different there, so you keep the current v.db.select options and descriptions.

I would think the format should be by default required, although since it has default answer, it probably doesn't matter that much.

@wenzeslaus
Copy link
Member

This is great improvement @kritibirda26. To fix the OSGeo4W CI, please update your branch from main (e.g. Update branch on GitHub or merge main locally into this branch).

@github-actions github-actions bot added the vector Related to vector data processing label May 17, 2024
@kritibirda26
Copy link
Contributor Author

@petrasovaa Hi! I have updated v.db.select and also changed the option to be required by default.

@kritibirda26
Copy link
Contributor Author

The tests are failing with this weird error but the build passes locally. Also, the string that is said to be invalid is actually a valid isoformat string. Any suggestions on how to debug?

gnu/docs/html/g.gui.timeline.html
Traceback (most recent call last):
  File "/home/runner/work/grass/grass/dist.x86_64-pc-linux-gnu/utils/mkhtml.py", line 921, in <module>
    git_commit = get_last_git_commit(
  File "/home/runner/work/grass/grass/dist.x86_64-pc-linux-gnu/utils/mkhtml.py", line 397, in get_last_git_commit
    return parse_git_commit(
  File "/home/runner/work/grass/grass/dist.x86_64-pc-linux-gnu/utils/mkhtml.py", line 242, in parse_git_commit
    git_log["date"] = format_git_commit_date_from_local_git(
  File "/home/runner/work/grass/grass/dist.x86_64-pc-linux-gnu/utils/mkhtml.py", line 345, in format_git_commit_date_from_local_git
    return datetime.fromisoformat(
ValueError: Invalid isoformat string: '2024-05-17T16:09:45Z'

https://github.com/OSGeo/grass/actions/runs/9131120968/job/25109628154?pr=3704#step:8:6469

@neteler
Copy link
Member

neteler commented May 17, 2024

A guess: it probably expects a string without the 'Z' character?

@kritibirda26
Copy link
Contributor Author

@neteler I see, do you know if there is a local git setting I can configure to fix the datetime format for the commit timestamp?

@wenzeslaus
Copy link
Member

This is failing across several PRs with repeated runs. I'm opening a separate issue to discuss this.

@echoix
Copy link
Member

echoix commented May 19, 2024

What prefix for the title of the PR should be used before merging, once it is rebased? (the build issue is most probably fixed now on main).

As a part of OSGeo#3019, JSON format support will be added
to multiple modules. By default, modules output in existing plain format. If the format=json option
is provided, modules will output in JSON format instead. To avoid duplication of code across several
modules, define a standard parser option.
@echoix echoix force-pushed the json-standard-parser-option branch from e6811c2 to c20b39c Compare May 19, 2024 17:23
raster/r.horizon/main.c Outdated Show resolved Hide resolved
raster/r.kappa/main.c Outdated Show resolved Hide resolved
include/grass/gis.h Outdated Show resolved Hide resolved
Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
@kritibirda26
Copy link
Contributor Author

Thanks all for reviewing the PR and helping fix the CI issues. Please let me know me if any other changes are needed in this PR.

@echoix
Copy link
Member

echoix commented May 24, 2024

@petrasovaa previously requested changes, she might want to place an approval to overrule her review.

And a prefix for the PR, so it can be classified in the release notes. I'm not sure which one to apply.

@petrasovaa petrasovaa changed the title Add a standard parser option for JSON formatting lib: Add a standard parser option for JSON formatting May 24, 2024
@petrasovaa petrasovaa merged commit 55b2a2b into OSGeo:main May 24, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C general imagery libraries module raster Related to raster data processing vector Related to vector data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants