{"id":37690645,"url":"https://github.com/guludo/python-argparse-subdec","last_synced_at":"2026-01-16T12:41:46.968Z","repository":{"id":57411448,"uuid":"431216813","full_name":"guludo/python-argparse-subdec","owner":"guludo","description":"Create argparse subcommands with decorators.","archived":false,"fork":false,"pushed_at":"2022-09-15T16:24:17.000Z","size":15,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-27T05:31:20.298Z","etag":null,"topics":["argparse","decorator","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guludo.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-23T18:47:22.000Z","updated_at":"2022-10-21T22:38:38.000Z","dependencies_parsed_at":"2022-09-09T22:23:16.023Z","dependency_job_id":null,"html_url":"https://github.com/guludo/python-argparse-subdec","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/guludo/python-argparse-subdec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guludo%2Fpython-argparse-subdec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guludo%2Fpython-argparse-subdec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guludo%2Fpython-argparse-subdec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guludo%2Fpython-argparse-subdec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guludo","download_url":"https://codeload.github.com/guludo/python-argparse-subdec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guludo%2Fpython-argparse-subdec/sbom","scorecard":{"id":449217,"data":{"date":"2025-08-11","repo":{"name":"github.com/guludo/python-argparse-subdec","commit":"b7ad023c2fc5b61170ce1ffb3ed18aed04af8c14"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"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":"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":"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":0,"reason":"Found 0/13 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":"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":"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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: Mozilla Public License 2.0: LICENSE.txt:0"],"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 'main'"],"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-19T07:43:41.032Z","repository_id":57411448,"created_at":"2025-08-19T07:43:41.033Z","updated_at":"2025-08-19T07:43:41.033Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","decorator","python","python3"],"created_at":"2026-01-16T12:41:46.370Z","updated_at":"2026-01-16T12:41:46.962Z","avatar_url":"https://github.com/guludo.png","language":"Python","readme":"python-argparse-subdec\n######################\n\nThis is a very simple Python package that allows one to create argparse_'s\nsubcommands via function decorators.\n\nUsage\n=====\n\nCreate a ``SubDec`` object:\n\n.. code:: python\n\n  import argparse_subdec\n\n  # Create the object to collect subcommands via decorators\n  sd = argparse_subdec.SubDec()\n\nNow, we can define our subcommands. We define a subcommand by decorating a\nfunction with method calls to ``sd``, like below:\n\n.. code:: python\n\n  @sd.add_argument('--option', default='123')\n  @sd.add_argument('--another')\n  def foo(args):\n      print(f'foo subcommand: --option={args.option!r} and --another={args.another!r}')\n\nYou can use any method name that you would use in a subparser. In our example\nabove, we used ``add_argument``, probably most commonly used. When creating\nthe subparsers, ``sd`` will replay those calls to the created subparser for\nthe ``foo`` subcommand.\n\nSince using ``sd.add_argument()`` is so common, there is an alias to save some\nkeystrokes. The example below is the equivalent of the above using the alias:\n\n.. code:: python\n\n  @sd.arg('--option', default='123')\n  @sd.arg('--another')\n  def foo(args):\n      print(f'foo subcommand: --option={args.option!r} and --another={args.another!r}')\n\nIn the example below we define a second subcommand, which will be named\n``foo-bar``:\n\n.. code:: python\n\n  @sd.cmd(prefix_chars=':')\n  @sd.add_argument('positional_arg', type=int)\n  def foo_bar(args):\n      print(f'foo-bar subcommand: {args.positional_arg!r}')\n\nNote that we use a special decorator, ``sd.cmd``, which makes ``sd`` pass all\nof its arguments down to ``add_parser()`` when creating the subparser for\n``foo-bar``.\n\nOnce our subcommands are defined, we must call ``sd.create_parsers()`` in\norder to effectively create the subparsers:\n\n.. code:: python\n\n  parser = argparse.ArgumentParser()\n  subparsers = parser.add_subparsers()\n  sd.create_parsers(subparsers)\n\n\nThe following is example of how we would call the subcommands:\n\n.. code:: python\n\n    args = parser.parse_args(['foo', '--another', 'hello'])\n    args.fn(args) # The subcommand function is assigned to ``args.fn`` by default\n    # Outputs: foo subcommand: --option='123' and --another='hello'\n\n\nFor more details about the API, check out the subdec_ module.\n\n\nInstall\n=======\n\nVia ``pip``:\n\n.. code:: bash\n\n   pip install argparse-subdec\n\n\n.. _argparse: https://docs.python.org/3/library/argparse.html\n.. _subdec: argparse_subdec/subdec.py\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguludo%2Fpython-argparse-subdec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguludo%2Fpython-argparse-subdec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguludo%2Fpython-argparse-subdec/lists"}