{"id":37067294,"url":"https://github.com/sgarcez/arseparse","last_synced_at":"2026-01-14T07:53:56.490Z","repository":{"id":57411615,"uuid":"84118867","full_name":"sgarcez/arseparse","owner":"sgarcez","description":"Python utility/micro framework for writing command line interfaces","archived":false,"fork":false,"pushed_at":"2017-09-22T14:25:19.000Z","size":14,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-27T07:45:06.674Z","etag":null,"topics":["argparse","cli","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/sgarcez.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}},"created_at":"2017-03-06T20:43:29.000Z","updated_at":"2017-03-16T08:46:49.000Z","dependencies_parsed_at":"2022-08-27T17:11:10.751Z","dependency_job_id":null,"html_url":"https://github.com/sgarcez/arseparse","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sgarcez/arseparse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarcez%2Farseparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarcez%2Farseparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarcez%2Farseparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarcez%2Farseparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgarcez","download_url":"https://codeload.github.com/sgarcez/arseparse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarcez%2Farseparse/sbom","scorecard":{"id":814256,"data":{"date":"2025-08-11","repo":{"name":"github.com/sgarcez/arseparse","commit":"09100548ec568a93ad3a29948d6207ff524a6553"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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/28 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":"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":"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":"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: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":"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-23T13:51:58.629Z","repository_id":57411615,"created_at":"2025-08-23T13:51:58.629Z","updated_at":"2025-08-23T13:51:58.629Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","cli","python"],"created_at":"2026-01-14T07:53:55.888Z","updated_at":"2026-01-14T07:53:56.477Z","avatar_url":"https://github.com/sgarcez.png","language":"Python","readme":"# arseparse\n[![CircleCI](https://img.shields.io/circleci/project/github/sgarcez/arseparse/master.svg)](https://circleci.com/gh/sgarcez/arseparse) [![codecov](https://img.shields.io/codecov/c/github/sgarcez/arseparse.svg)](https://codecov.io/gh/sgarcez/arseparse/) [![PyPI version](https://badge.fury.io/py/arseparse.svg)](https://pypi.python.org/pypi/arseparse) [![PyPI format](https://img.shields.io/pypi/format/arseparse.svg)](https://pypi.python.org/pypi/arseparse)\n\n\nArseparse is a simple Python utility/micro framework for writing command line interfaces. It provides some functionality around [argparse](https://docs.python.org/3/library/argparse.html) to dispatch a command handler and pre-process its arguments.\n\nThe main pattern that it can help with is the following: \n```\n\u003centrypoint\u003e root_args... command_name command_args...\n```\nFor example:\n```\n\u003centrypoint\u003e config.ini create_user foo@bar.xyz s3cr3t\n```\nWould execute this handler:\n```\n@parser.register_dec([Option('username', type=str), Option('secret', type=str)])\ndef create_user(username, secret, user_svc, **kwargs):\n    user_svc.create_user(username, secret)\n```\nWhere `user_svc` argument depends on the `config` root argument. More on that later.\n\n#### Installation:\n```\npip install arseparse\n```\n\n#### Basic usage (without root args):\n```\nfrom arseparse import Parser, Option\n\n\nparser = Parser()\n\n\n# register handler\n@parser.register_dec([Option('value', type=int)])\ndef cube(value):\n    return value**3\n\n\n# register without a decorator\nparser.register('square', lambda value: value**2, [Option('value', type=int)])\n\n\n# register a command with no args\nparser.register('ping', lambda: 'pong')\n\n\nif __name__ == '__main__':\n    sys.exit(parser.run())\n```\nExecute your `entry_point` or the file directly: `your-entrypoint[.py] square 2`\n\n#### Common Usage\nA more common scenario is to pass a config file as the first argument, parse it, create objects depend on the configuration, and pass those along to the handler.\nThe `root_options` and `bootstrap` constructor args to `Parser` allow us to do this:\n```\nfrom arseparse import Parser, Option\nimport myapp\n\n\nroot_options = [Option('config', type=str, help='path to ini file')]\n\n\n# this lets us process/modify the kwargs before we execute the callable.\ndef bootstrap(**kwargs):\n    config_uri = kwargs.pop('config')\n    settings = myapp.parse_app_config(config_uri)\n    dbsession = myapp.get_sessionmaker(settings)()\n    user_svc = myapp.UserService(dbsession)\n    kwargs.update(dict(settings=settings, dbsession=dbsession, user_svc=user_svc))\n    return kwargs\n\n\nparser = Parser(root_options, bootstrap)\n\n\n@parser.register_dec([Option('username', type=str), Option('secret', type=str)])\ndef create_user(username, secret, user_svc, **kwargs):\n    user_svc.create_user(username, secret)\n    \n \n@parser.register_dec([Option('user_id', type=int)])\ndef ban_user(user_id, user_svc, **kwargs):\n    user_svc.ban_user(user_id)\n\n\n@parser.register_dec()\ndef print_settings(settings, **kwargs):\n    print(settings)\n\n```\nYou can now provide the path to a config file as the first argument: `your-entrypoint[.py] config.ini ban_user 23`\n\n#### Recipes\nAnother common requirement is to be able to jump into a shell where some objects have been preconfigured for us.\nHere's a simple recipe for that.\n\n```\n@parser.register_dec()\ndef shell(**kwargs):\n    import IPython\n    IPython.embed(user_ns=kwargs)\n\n```\n\nCalling `your-entrypoint.py config.ini shell` will drop you in an ipython shell where `dbsession`, `settings` and `user_svc` are available.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgarcez%2Farseparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgarcez%2Farseparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgarcez%2Farseparse/lists"}