{"id":13532905,"url":"https://github.com/ialbert/plac","last_synced_at":"2026-02-21T11:31:42.715Z","repository":{"id":28742186,"uuid":"32263709","full_name":"ialbert/plac","owner":"ialbert","description":"Plac: Parsing the Command Line the Easy Way","archived":false,"fork":false,"pushed_at":"2025-04-04T14:04:30.000Z","size":3985,"stargazers_count":298,"open_issues_count":3,"forks_count":29,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-02-01T14:44:30.331Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ialbert.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-03-15T14:10:23.000Z","updated_at":"2025-08-17T20:16:55.000Z","dependencies_parsed_at":"2025-12-12T02:05:21.301Z","dependency_job_id":null,"html_url":"https://github.com/ialbert/plac","commit_stats":{"total_commits":159,"total_committers":12,"mean_commits":13.25,"dds":0.3836477987421384,"last_synced_commit":"28384ddfa72192b8f9c58482312f8abb31140a35"},"previous_names":["micheles/plac"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/ialbert/plac","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialbert%2Fplac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialbert%2Fplac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialbert%2Fplac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialbert%2Fplac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ialbert","download_url":"https://codeload.github.com/ialbert/plac/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialbert%2Fplac/sbom","scorecard":{"id":477228,"data":{"date":"2025-08-11","repo":{"name":"github.com/ialbert/plac","commit":"0da08718131023893894e484d1a8133647e55e1d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 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":"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 2/24 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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-package.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":"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":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/ialbert/plac/python-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/ialbert/plac/python-package.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:28","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:29","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:30","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 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":"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":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: 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":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.4.0 not signed: https://api.github.com/repos/ialbert/plac/releases/121729114","Warn: release artifact v1.4.0 does not have provenance: https://api.github.com/repos/ialbert/plac/releases/121729114"],"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 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-19T15:39:19.830Z","repository_id":28742186,"created_at":"2025-08-19T15:39:19.830Z","updated_at":"2025-08-19T15:39:19.830Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29679808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T11:29:27.227Z","status":"ssl_error","status_checked_at":"2026-02-21T11:29:20.292Z","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":[],"created_at":"2024-08-01T07:01:14.773Z","updated_at":"2026-02-21T11:31:42.696Z","avatar_url":"https://github.com/ialbert.png","language":"Python","funding_links":[],"categories":["Python","[Python](https://www.python.org/)"],"sub_categories":["Useful awesome list for Go cli"],"readme":"# Plac: parsing the command line the easy way\n\n`plac` is a Python package that can generate command line parameters\nfrom function signatures.\n\n`plac` works on Python 2.6 through all versions of Python 3.\n\n`plac` has no dependencies beyond modules already present in the Python\nstandard library.\n\n`plac` implements most of its functionality in a single file that may be\nincluded in your source code.\n\n## Quickstart\n\n`plac` can automatically generate command line parameters from a function signature. \n       \n```python\nimport plac\n\ndef main(model, iter=100, debug=False):\n    \"\"\"\n    A script for machine learning\n    \"\"\"\n    print (model, iter, debug)\n\nif __name__ == '__main__':\n    # Execute function via plac.call()\n    plac.call(main)\n```\n\nThe program above can now take parameters from the command line like so:\n\n    python example.py A 1000 \n\nRunning the script with no parameters as `python example.py` would print:\n\n```\nusage: example.py [-h] model [iter] [debug]\nexample.py: error: the following arguments are required: model\n```\n\nIn addition, the program can also generate a help message:\n\n```python\npython example.py -h\n```\n\nProduces the following output:\n\n```\nusage: example.py [-h] model [iter] [debug]\n\nA script for machine learning\n\npositional arguments:\n  model\n  iter        [100]\n  debug       [False]\n\noptions:\n  -h, --help  show this help message and exit\n```\n\n## Additional customization\n\nWhen you need more control `plac` offers three decorators to describe positional, option and flag type parameters:\n\n```python\nimport plac\n\n# Add decorators to the function\n@plac.pos('model', help=\"model name\", choices=['A', 'B', 'C'])\n@plac.opt('iter', help=\"iterations\", type=int)\n@plac.flg('debug', help=\"debug mode\")\ndef main(model, iter=100, debug=False):\n    \"\"\"\n    A script for machine learning\n    \"\"\"\n    print (model, iter, debug)\n\nif __name__ == '__main__':\n    # Execute function via plac.call().\n    plac.call(main)\n```\n\nThat will produce the following help:\n\n```\nusage: example.py [-h] [-i 100] [-d] {A,B,C}\n\nA script for machine learning\n\npositional arguments:\n  {A,B,C}             model name\n\noptions:\n  -h, --help          show this help message and exit\n  -i 100, --iter 100  iterations\n  -d, --debug         debug mode\n```\n\n## Decorator reference\n\nTo use `plac` all you need to know are the following three decorators:\n\n* `@plac.pos` - for positional parameters `model`\n* `@plac.opt` - for key value options `--iter 100`\n* `@plac.flg` - for flags `--debug`\n\nthat have the following signatures:\n\n```python\n# Positional parameters.\npos(arg, help=None, type=None, choices=None, metavar=None):\n\n# Option parameters.\nopt(arg, help=None, type=None, abbrev=None, choices=None, metavar=None):\n\n# Flag parameters.\nflg(arg, help=None, abbrev=None):\n```\n\n## Zero dependencies ... not even plac :-)\n\nNotably, the main functionality of `plac` is implemented in a single\nPython module called `plac_core.py` that, if necessary, may be included and\ndistributed with your source code thus reducing external dependencies in\nyour code.\n\nCopy `plac_core.py` to your package then use it like so:\n\n```python\nfrom mypackage import plac_core as plac\n```\n\n## Avoiding name clashes\n\nPython syntax, or your variable naming may impose constraints on what\nwords may be used as parameters. To circumvent that limitation append a\ntrailing underscore to the name. `plac` will strip that underscore from\nthe command line parameter name:\n\n```python\nimport plac\n\n@plac.flg('list_')   # avoid clash with builtin\n@plac.flg('yield_')  # avoid clash with keyword\n@plac.opt('sys_')    # avoid clash with a very common name\ndef main(list_, yield_=False, sys_=100):\n    print(list_)\n    print(yield_)\n    print(sys_)\n\nif __name__ == '__main__':\n    plac.call(main)\n```\n\nproduces the usage:\n\n```\nusage: example13.py [-h] [-l] [-y] [-s 100]\n\noptional arguments:\n  -h, --help         show this help message and exit\n  -l, --list\n  -y, --yield        [False]\n  -s 100, --sys 100  [100]\n```\n\n## Variable arguments\n\n`plac` may accept multiple positional arguments and even additional key=value pairs:\n\n```python\nimport plac\n\n@plac.pos('args', help=\"words\")\n@plac.opt('kwds', help=\"key=value\", )\ndef main(*args, **kwds):\n    print(args)\n    print(kwds)\n\nif __name__ == '__main__':\n    plac.call(main)\n```\n\nthe usage will be:\n\n```\nusage: example15.py [-h] [args ...] [kwds ...]\n\npositional arguments:\n  args        words\n  kwds        key=value\n\noptional arguments:\n  -h, --help  show this help message and exit\n```\n\nwhen running it as:\n\n    python example15.py A B x=10 y=20\n\nthe program prints:\n\n    ('A', 'B')\n    {'x': '10', 'y': '20'}\n\n## Installation\n\n    pip install plac\n\n## Testing\n\nRun\n\n    python doc/test_plac.py\n\nYou will see several apparent errors, but this is right, since the tests\nare checking for several error conditions. The important thing is that\nyou get a line like\n\n`Executed XX tests OK`\n\n## Code\n\n-   \u003chttps://github.com/ialbert/plac\u003e\n\nAuthor: Michele Simionato, \u003cmichele.simionato@gmail.com\u003e\n\nMaintainer: Istvan Albert, \u003cistvan.albert@gmail.com\u003e\n\n## Issues\n\n-   \u003chttps://github.com/ialbert/plac/issues\u003e\n\n## License\n\nBSD License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fialbert%2Fplac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fialbert%2Fplac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fialbert%2Fplac/lists"}