Name | def-main JSON |
Version |
0.11.0
JSON |
| download |
home_page | |
Summary | Define the main function in one step and make it testable |
upload_time | 2022-12-14 18:11:16 |
maintainer | |
docs_url | None |
author | Tom Ritchford |
requires_python | >=3.7,<4.0 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
========================================================
``def_main``: a tiny decorator to define main
========================================================
Define the main function in one step.
For any non-trivial projects, use typer and dtyper instead!
Usage example
==================
Without an return code
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
import def_main
@def_main
def main(*argv):
print('hello,', *argv)
means precisely the same as:
.. code-block:: python
def main(*argv):
print('hello,', *argv)
if __name__ == '__main__':
import sys
main(sys.argv[1:])
With a return code
~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
import def_main
@def_main
def main(*argv):
print('hello,', *argv)
return argv
means precisely the same as:
.. code-block:: python
def main(*argv):
print('hello,', *argv)
return argv
if __name__ == '__main__':
import sys
returncode = main(sys.argv[1:])
sys.exit(returncode)
Raw data
{
"_id": null,
"home_page": "",
"name": "def-main",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Tom Ritchford",
"author_email": "tom@swirly.com",
"download_url": "https://files.pythonhosted.org/packages/1e/44/b60088c4e14f1e4a4e8f69e345a04fab73335374e3b17faee97f1acb69c2/def_main-0.11.0.tar.gz",
"platform": null,
"description": "========================================================\n``def_main``: a tiny decorator to define main\n========================================================\n\nDefine the main function in one step.\n\nFor any non-trivial projects, use typer and dtyper instead!\n\n\nUsage example\n==================\n\nWithout an return code\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: python\n\n import def_main\n\n @def_main\n def main(*argv):\n print('hello,', *argv)\n\n\nmeans precisely the same as:\n\n.. code-block:: python\n\n def main(*argv):\n print('hello,', *argv)\n\n\n if __name__ == '__main__':\n import sys\n\n main(sys.argv[1:])\n\nWith a return code\n~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: python\n\n\n import def_main\n\n @def_main\n def main(*argv):\n print('hello,', *argv)\n return argv\n\n\nmeans precisely the same as:\n\n.. code-block:: python\n\n def main(*argv):\n print('hello,', *argv)\n return argv\n\n\n if __name__ == '__main__':\n import sys\n\n returncode = main(sys.argv[1:])\n sys.exit(returncode)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Define the main function in one step and make it testable",
"version": "0.11.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "70757c8003942fcf2877a8deff75a5fc",
"sha256": "4df73e045dd77cd1191708deda21ad7f34af73e410e83da52e380777bc7582f9"
},
"downloads": -1,
"filename": "def_main-0.11.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "70757c8003942fcf2877a8deff75a5fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 1620,
"upload_time": "2022-12-14T18:11:15",
"upload_time_iso_8601": "2022-12-14T18:11:15.464597Z",
"url": "https://files.pythonhosted.org/packages/7d/33/650de94de1a910b22eca1addf8f4c9e3cb24b5c7d24a9f682237112be221/def_main-0.11.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "ac0ee0623676f0b2e000ccbee75bfe68",
"sha256": "66f652d4cfb549421a2a958f0fcd76d5f76524f0214dbb6eabdd185cf2a276bc"
},
"downloads": -1,
"filename": "def_main-0.11.0.tar.gz",
"has_sig": false,
"md5_digest": "ac0ee0623676f0b2e000ccbee75bfe68",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 1682,
"upload_time": "2022-12-14T18:11:16",
"upload_time_iso_8601": "2022-12-14T18:11:16.679639Z",
"url": "https://files.pythonhosted.org/packages/1e/44/b60088c4e14f1e4a4e8f69e345a04fab73335374e3b17faee97f1acb69c2/def_main-0.11.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-14 18:11:16",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "def-main"
}