{"id":18442815,"url":"https://github.com/lebrice/simpleparsing","last_synced_at":"2025-10-04T16:43:46.444Z","repository":{"id":37759275,"uuid":"213200949","full_name":"lebrice/SimpleParsing","owner":"lebrice","description":"Simple, Elegant, Typed Argument Parsing with argparse","archived":false,"fork":false,"pushed_at":"2025-06-03T00:23:57.000Z","size":1493,"stargazers_count":499,"open_issues_count":65,"forks_count":58,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-20T12:55:01.260Z","etag":null,"topics":["argparse","argparse-alternative","argument-parsing","dataclasses","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lebrice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"docs/Roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-06T16:15:54.000Z","updated_at":"2025-09-18T01:15:13.000Z","dependencies_parsed_at":"2023-02-19T13:31:19.037Z","dependency_job_id":"32168e65-7e4c-411d-9d99-8c12eda1242f","html_url":"https://github.com/lebrice/SimpleParsing","commit_stats":{"total_commits":336,"total_committers":29,"mean_commits":"11.586206896551724","dds":"0.13690476190476186","last_synced_commit":"4388893b768495090dcd8dc7e399372d8e5829be"},"previous_names":[],"tags_count":76,"template":false,"template_full_name":null,"purl":"pkg:github/lebrice/SimpleParsing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebrice%2FSimpleParsing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebrice%2FSimpleParsing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebrice%2FSimpleParsing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebrice%2FSimpleParsing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lebrice","download_url":"https://codeload.github.com/lebrice/SimpleParsing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebrice%2FSimpleParsing/sbom","scorecard":{"id":582256,"data":{"date":"2025-08-11","repo":{"name":"github.com/lebrice/SimpleParsing","commit":"2a69cebb38172b9317c0175aadde6d3b432371ce"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4,"checks":[{"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":"Code-Review","score":4,"reason":"Found 13/30 approved changesets -- score normalized to 4","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":"Maintained","score":5,"reason":"1 commit(s) and 6 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: topLevel 'contents' permission set to 'write': .github/workflows/benchmark.yml:12","Warn: topLevel 'deployments' permission set to 'write': .github/workflows/benchmark.yml:14","Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/python-publish.yml:1","Warn: no topLevel permission defined: .github/workflows/upload.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/benchmark.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/benchmark.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/benchmark.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/benchmark.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/benchmark.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/benchmark.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/benchmark.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/python-publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/python-publish.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/python-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/upload.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/upload.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/upload.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/upload.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/upload.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/lebrice/SimpleParsing/upload.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/benchmark.yml:24","Warn: pipCommand not pinned by hash: .github/workflows/benchmark.yml:25","Warn: pipCommand not pinned by hash: .github/workflows/upload.yml:17","Warn: pipCommand not pinned by hash: .github/workflows/upload.yml:18","Info:   0 out of   9 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 third-party GitHubAction dependencies pinned","Info:   0 out of   4 pipCommand dependencies pinned"],"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h","Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf","Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T19:28:56.396Z","repository_id":37759275,"created_at":"2025-08-20T19:28:56.397Z","updated_at":"2025-08-20T19:28:56.397Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278343071,"owners_count":25971399,"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-04T02:00:05.491Z","response_time":63,"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":["argparse","argparse-alternative","argument-parsing","dataclasses","python"],"created_at":"2024-11-06T06:45:00.894Z","updated_at":"2025-10-04T16:43:46.396Z","avatar_url":"https://github.com/lebrice.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build Status](https://github.com/lebrice/SimpleParsing/actions/workflows/build.yml/badge.svg) [![PyPI version](https://badge.fury.io/py/simple-parsing.svg)](https://badge.fury.io/py/simple-parsing)\n\n# Simple, Elegant, Typed Argument Parsing \u003c!-- omit in toc --\u003e\n\n`simple-parsing` allows you to transform your ugly `argparse` scripts into beautifully structured, strongly typed little works of art. This isn't a fancy, complicated new command-line tool either, ***this simply adds new features to plain-old argparse!***\nUsing [dataclasses](https://docs.python.org/3.7/library/dataclasses.html), `simple-parsing` makes it easier to share and reuse command-line arguments - ***no more copy pasting!***\n\nSupports inheritance, **nesting**, easy serialization to json/yaml, automatic help strings from comments, and much more!\n\n```python\n# examples/demo.py\nfrom dataclasses import dataclass\nfrom simple_parsing import ArgumentParser\n\nparser = ArgumentParser()\nparser.add_argument(\"--foo\", type=int, default=123, help=\"foo help\")\n\n@dataclass\nclass Options:\n    \"\"\" Help string for this group of command-line arguments \"\"\"\n    log_dir: str                # Help string for a required str argument\n    learning_rate: float = 1e-4 # Help string for a float argument\n\nparser.add_arguments(Options, dest=\"options\")\n\nargs = parser.parse_args()\nprint(\"foo:\", args.foo)\nprint(\"options:\", args.options)\n```\n\n```console\n$ python examples/demo.py --log_dir logs --foo 123\nfoo: 123\noptions: Options(log_dir='logs', learning_rate=0.0001)\n```\n\n```console\n$ python examples/demo.py --help\nusage: demo.py [-h] [--foo int] --log_dir str [--learning_rate float]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --foo int             foo help (default: 123)\n\nOptions ['options']:\n   Help string for this group of command-line arguments\n\n  --log_dir str         Help string for a required str argument (default:\n                        None)\n  --learning_rate float\n                        Help string for a float argument (default: 0.0001)\n```\n\n### (*new*) Simplified API:\n\nFor a simple use-case, where you only want to parse a single dataclass, you can use the `simple_parsing.parse` or `simple_parsing.parse_known_args` functions:\n\n```python\noptions: Options = simple_parsing.parse(Options)\n# or:\noptions, leftover_args = simple_parsing.parse_known_args(Options)\n```\n\n## installation\n\n`pip install simple-parsing`\n\n## [Examples](https://github.com/lebrice/SimpleParsing/tree/master/examples/README.md)\n\n## [API Documentation](https://github.com/lebrice/SimpleParsing/tree/master/docs/README.md) (Under construction)\n\n## Features\n\n- ### [Automatic \"--help\" strings](https://github.com/lebrice/SimpleParsing/tree/master/examples/docstrings/README.md)\n\n  As developers, we want to make it easy for people coming into our projects to understand how to run them. However, a user-friendly `--help` message is often hard to write and to maintain, especially as the number of arguments increases.\n\n  With `simple-parsing`, your arguments and their descriptions are defined in the same place, making your code easier to read, write, and maintain.\n\n- ### Modular, Reusable, Cleanly Grouped Arguments\n\n  *(no more copy-pasting)*\n\n  When you need to add a new group of command-line arguments similar to an existing one, instead of copy-pasting a block of `argparse` code and renaming variables, you can reuse your argument class, and let the `ArgumentParser` take care of adding relevant prefixes to the arguments for you:\n\n  ```python\n  parser.add_arguments(Options, dest=\"train\")\n  parser.add_arguments(Options, dest=\"valid\")\n  args = parser.parse_args()\n  train_options: Options = args.train\n  valid_options: Options = args.valid\n  print(train_options)\n  print(valid_options)\n  ```\n\n  ```console\n  $ python examples/demo.py \\\n      --train.log_dir \"training\" \\\n      --valid.log_dir \"validation\"\n  Options(log_dir='training', learning_rate=0.0001)\n  Options(log_dir='validation', learning_rate=0.0001)\n  ```\n\n  These prefixes can also be set explicitly, or not be used at all. For more info, take a look at the [Prefixing Guide](https://github.com/lebrice/SimpleParsing/tree/master/examples/prefixing/README.md)\n\n- ### [Argument subgroups](https://github.com/lebrice/SimpleParsing/tree/master/examples/subgroups/README.md)\n\n  It's easy to choose between different argument groups of arguments, with the `subgroups`\n  function!\n\n- ### [Setting defaults from Configuration files](https://github.com/lebrice/SimpleParsing/tree/master/examples/config_files/README.md)\n\n  Default values for command-line arguments can easily be read from many different formats, including json/yaml!\n\n- ### [**Easy serialization**](https://github.com/lebrice/SimpleParsing/tree/master/examples/serialization/README.md):\n\n  Easily save/load configs to `json` or `yaml`!.\n\n- ### [**Inheritance**!](https://github.com/lebrice/SimpleParsing/tree/master/examples/inheritance/README.md)\n\n  You can easily customize an existing argument class by extending it and adding your own attributes, which helps promote code reuse across projects. For more info, take a look at the [inheritance example](https://github.com/lebrice/SimpleParsing/tree/master/examples/inheritance/inheritance_example.py)\n\n- ### [**Nesting**!](https://github.com/lebrice/SimpleParsing/tree/master/examples/nesting/README.md):\n\n  Dataclasses can be nested within dataclasses, as deep as you need!\n\n- ### [Easier parsing of lists and tuples](https://github.com/lebrice/SimpleParsing/tree/master/examples/container_types/README.md) :\n\n  This is sometimes tricky to do with regular `argparse`, but `simple-parsing` makes it a lot easier by using the python's builtin type annotations to automatically convert the values to the right type for you.\n  As an added feature, by using these type annotations, `simple-parsing` allows you to parse nested lists or tuples, as can be seen in [this example](https://github.com/lebrice/SimpleParsing/tree/master/examples/merging/README.md)\n\n- ### [Enums support](https://github.com/lebrice/SimpleParsing/tree/master/examples/enums/README.md)\n\n- (More to come!)\n\n## Examples:\n\nAdditional examples for all the features mentioned above can be found in the [examples folder](https://github.com/lebrice/SimpleParsing/tree/master/examples/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebrice%2Fsimpleparsing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flebrice%2Fsimpleparsing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebrice%2Fsimpleparsing/lists"}