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

Option to run CLI with a recipe file instead of command line args #22

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

stuartlynn
Copy link
Contributor

Adds a new sub command to the CLI

popgetter_cli recipe --recipe-file recipe.json --output-file result.geojson --output-format geojson

Which loads in the DataRequestSpec from json and runs the request

a sample request file: https://github.com/Urban-Analytics-Technology-Platform/popgetter-cli/blob/run_with_config/test_recipe.json

Some thoughts / questions

  • It might be worth the CLI having a top level struct that pairs a DataRequestSpec with an OutputOptions so that both can be read from the config file. We still want DataRequestSpec to be it's own thing as this is how python and JS will interact with the library without any need to specify output
  • We are starting with json as the config language but it should be possible to use toml or yaml or anything else that serde supports. Not sure if we have opinions on the best formats to use here.
  • We can add some serde directives to make the json format a little easier to write, for example using different enum representations if they make sense

@stuartlynn stuartlynn requested a review from yongrenjie May 16, 2024 13:09
src/cli.rs Show resolved Hide resolved
src/cli.rs Show resolved Hide resolved
src/cli.rs Show resolved Hide resolved
src/cli.rs Show resolved Hide resolved
src/cli.rs Show resolved Hide resolved
src/cli.rs Show resolved Hide resolved
src/cli.rs Show resolved Hide resolved
@sgreenbury
Copy link
Contributor

Looks great! As discussed I'll open an issue that replaces prints with env logging.

@sgreenbury sgreenbury mentioned this pull request May 29, 2024
@sgreenbury sgreenbury changed the title Option to run CLI with a config file instead of command line args Option to run CLI with a recipe file instead of command line args Jun 5, 2024
@sgreenbury sgreenbury merged commit ce2652a into main Jun 5, 2024
1 check passed
@sgreenbury sgreenbury deleted the run_with_config branch June 5, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done:
Development

Successfully merging this pull request may close these issues.

3 participants