{"id":20630628,"url":"https://github.com/brookisme/aiplatgo","last_synced_at":"2025-10-12T14:36:06.458Z","repository":{"id":57409254,"uuid":"272792744","full_name":"brookisme/aiplatgo","owner":"brookisme","description":"CLI wrapper for gcloud ai-platform","archived":false,"fork":false,"pushed_at":"2022-08-27T13:48:17.000Z","size":79,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-12T14:36:06.023Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brookisme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-16T19:17:40.000Z","updated_at":"2022-08-27T13:46:36.000Z","dependencies_parsed_at":"2022-09-26T17:10:34.324Z","dependency_job_id":null,"html_url":"https://github.com/brookisme/aiplatgo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brookisme/aiplatgo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brookisme%2Faiplatgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brookisme%2Faiplatgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brookisme%2Faiplatgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brookisme%2Faiplatgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brookisme","download_url":"https://codeload.github.com/brookisme/aiplatgo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brookisme%2Faiplatgo/sbom","scorecard":{"id":254502,"data":{"date":"2025-08-11","repo":{"name":"github.com/brookisme/aiplatgo","commit":"9d55edd12d57725b3b05704dc304631a8fb5217a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T09:19:02.339Z","repository_id":57409254,"created_at":"2025-08-17T09:19:02.339Z","updated_at":"2025-08-17T09:19:02.339Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011599,"owners_count":26084964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T14:09:03.297Z","updated_at":"2025-10-12T14:36:06.429Z","avatar_url":"https://github.com/brookisme.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### aiplatgo\n\nA [convince wrapper](#examples) for:\n\n- [`gcloud ai-platform jobs submit training`](#train)\n- [`gcloud ai-platform jobs submit prediction`](#pred)\n- [`gcloud ai-platform local`](#local)\n\nBecause ...\n\n[\"For convenience, it's useful to define your configuration values as environment variables.](https://cloud.google.com/ai-platform/training/docs/packaging-trainer#using_gcloud_to_package_and_upload_your_application_recommended) ... [Even if you use a YAML file, certain details must be supplied as command-line flags.\"](https://cloud.google.com/ai-platform/training/docs/training-jobs#formatting-your-configuration-parameters)\n\nis silly.\n\n--- \n\n`aiplatgo`'s config file to replaces the combination of CLI-flags and config file natively offered by [`gcloud ai platform`](https://cloud.google.com/sdk/gcloud/reference/ai-platform/). Moreover:\n\n- The config file can contain all possible flags for training or prediction local or platform. Only relevant flags will be submitted .\n- A [parser](#parser) for parsing user arguments passed through the CLI.\n- There are configurations to automatically handle naming conventions\n- platform job directories can automatically be prefixed with `gs://bucket/folder`\n- Underscores are accepted: ie `arg_name` for `arg-name`\n- There are additional aliases for some args\n\n---\n\n\u003ca name=\"examples\"\u003e\n\n### MINIMAL EXAMPLES\n\n```yaml\n# aiplatgo config for auto-naming conventions, gs-bucket-info, etc...\nconfig:\n    version: 1\n    bucket: dev-ai-platform\n    folder: gcs/folder/dev\n\n\n# google ai platform flags with values (ie --module-name MODULE_NAME )\nargs:\n  package: trainer\n  module: trainer.task\n  region: us-central1\n\n\n# google ai platform flags without values (ie --stream-logs )\nflags:\n  - distributed\n  - stream-logs\n\n\n# user-args\nuser:\n    user_arg_1: 1\n    user_arg_2: 2\n\n\n# local-user-args (only added with `aiplatgo local ...`)\nlocal:\n    local_user_arg_1: 1\n    local_user_arg_2: 2\n\n# job-user-args (only added with `aiplatgo \u003ctrain|predict\u003e ...`)\njob:\n    local_user_arg_1: 1\n    local_user_arg_2: 2\n```\n\nThe examples below assume the above config file is named `config.yaml`, and use the `--echo/-e`-flag which prints out the command without executing:\n\n```bash\n# local train\naiplatgo local train config --echo\n```\n\n```bash\n# output\ngcloud ai-platform local train --package-path trainer --module-name trainer.task --job-dir v1/output --distributed --  --user_arg_1 1 --user_arg_2 2\n```\n\n```bash\n# platform training (recommended: see below to specify job-name in config file)\naiplatgo train --name my_job config --echo\n```\n\n```bash\n# output\ngcloud ai-platform jobs submit training my_job --package-path trainer --module-name trainer.task --region us-central1 --job-dir gs://dev-ai-platform/output --staging-bucket gs://dev-ai-platform --stream-logs --  --user_arg_1 1 --user_arg_2 2\n```\n\nWith command-line args/kwargs:\n\n- `key=value` updates the `args` will update the `args` config, while `(config|flags|user).key=value` will update the `config/flags/user` config.  \n- `flag_name`, ie word not followed by `=value`, becomes a cli flag (ex `stream-logs` becomes `--stream-logs`)\n\n```bash\naiplatgo local train config config.version=1234 worker-count=4 --echo\n```\n\n```bash\n# output\ngcloud ai-platform local train --package-path trainer --module-name trainer.task --worker-count 2 --job-dir my_default_job_name/v1234/output --distributed --  --user_arg_1 1 --user_arg_2 2\n```\n\nAdding a default_job_name:\n\n```yaml\n# filename: config.yaml`\nconfig:\n    name: my_default_job_name\n    ...\n```\n\n```bash\naiplatgo train config --echo\n```\n\n```bash\n# output\ngcloud ai-platform jobs submit training my_default_job_name --package-path trainer --module-name trainer.task --region us-central1 --job-dir gs://dev-ai-platform/output --staging-bucket gs://dev-ai-platform --stream-logs --  --user_arg_1 1 --user_arg_2 2\n```\n\nNote: you can use `.` to skip a config file, only using command-line args/kwargs.\n\n---\n\n\u003ca name=\"parser\"\u003e\n\n### PARSER\n\n`gcloud ai-platform` passes user args as a flat list of key-value pairs. For example: \n\n```bash\n['key1','value1','key2','value2',...,'key(2n)','value(2n+1)']\n```\n\n[`aiplatgo.parser.Parser`](https://github.com/brookisme/aiplatgo/blob/master/aiplatgo/parser.py) combines these together into a key-value dictionary.  Moreover, it allows you to provide a config file that groups args into method specific groups and add default values.  \n\nHere is an example config file and python script:\n\n```python\n# args_config.yaml\ndefaults:\n    # these defaults are passed for every method using the argument\n    train_model: 'true'\n    score_model: 'false' \n    something_else: 1234\n\ntraining_objects:\n    - loss_func\n    - optimizer\n    - nb_classes\n    - acc_weights\n    - metric\n    # the : can be used to provide per-method default values\n    - loss_weights: null\n    - label_smoothing: null\n    - from_logits: false\n\nbuild_model:\n    - nb_classes\n    - from_logits\n    - size\n    - cropping\n    - float_cropping\n    - in_ch\n```\n\n\n```python\ndef training_objects(loss_func, optimizer, nb_classes, acc_weights, metric, loss_weights, label_smoothing, from_logits):\n    # get optimizer,loss,metrics\n    pass\n\ndef build_model(\n        optimizer,\n        loss,\n        metrics,\n        nb_classes,\n        from_logits,\n        size,\n        cropping,\n        float_cropping,\n        in_ch):\n    # build model \n    pass\n\n@click.pass_context\ndef run(ctx):\n    parser=Parser('args_config.yaml',config_list=ctx.args)\n    \n    train_model=parser.get('train_model')\n    score_model=parser.get('score_model')\n    \n    ...\n\n    optimizer,loss,metrics=training_objects(**parser.get('training_objects'))\n\n    model=build_model(\n        optimizer,\n        loss,\n        metrics,\n        **parser.args('build_model'))\n```\n\n---\n\n\n### CLI DOCS\n\n\u003ca name='local'\u003e\n\n```bash\naiplatgo local --help\nUsage: aiplatgo local [OPTIONS] VERB [CONFIG]\n\n  run local training or prediction:  \n    * verb: \"train\" or \"predict\"  \n    * config\u003coptional\u003e: yaml config. default or \".\" uses kwargs only\n    * additional args become flags \u003cie\u003e \"arg_name\" =\u003e \"--arg_name\"\n    * additional kwargs become kw-flags \u003cie\u003e \"arg_name=123\" =\u003e \"--arg_name 123\"\n\nOptions:\n  --echo BOOLEAN  if true print command without executing\n  --help          Show this message and exit.\n```\n\n\u003ca name='train'\u003e\n\n```bash\naiplatgo train --help\nUsage: aiplatgo train [OPTIONS] [CONFIG]\n\n  submit training job to platform:  * config\u003coptional\u003e: yaml config. default\n  or \".\" uses kwargs only  * additional args become flags \u003cie\u003e \"arg_name\" =\u003e\n  \"--arg_name\"  * additional kwargs become kw-flags \u003cie\u003e \"arg_name=123\" =\u003e \"\n  --arg_name 123\"\n\nOptions:\n  -n, --name TEXT  by default uses `config.name` for the job name. pass --name\n                   to override\n\n  -e, --echo       if true print command without executing\n  -t, --timestamp  append timestamp (YYYYMMDD_HMS) to job name\n  --help           Show this message and exit.\n```\n\n\u003ca name='predict'\u003e\n\n```bash\naiplatgo predict --help\nUsage: aiplatgo predict [OPTIONS] [CONFIG]\n\n  submit prediction job to platform:  * config\u003coptional\u003e: yaml config.\n  default or \".\" uses kwargs only  * additional args become flags \u003cie\u003e\n  \"arg_name\" =\u003e \"--arg_name\"  * additional kwargs become kw-flags \u003cie\u003e\n  \"arg_name=123\" =\u003e \"--arg_name 123\"\n\nOptions:\n  -n, --name TEXT  by default uses `config.name` for the job name. pass --name\n                   to override\n\n  -e, --echo       if true print command without executing\n  -t, --timestamp  append timestamp (YYYYMMDD_HMS) to job name\n  --help           Show this message and exit.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrookisme%2Faiplatgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrookisme%2Faiplatgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrookisme%2Faiplatgo/lists"}