.. image:: https://circleci.com/gh/AndreaCensi/quickapp.svg?style=svg
:target: https://circleci.com/gh/AndreaCensi/quickapp
QuickApp
========
QuickApp is a library that composes the functionality of Compmake, Reprep
in high-level constructs for extremely rapid development of scientific applications.
Simplest QuickApp application
-----------------------------
This is an example of the simplest QuickApp application.
It does not use Compmake functionality. ::
from quickapp import QuickAppBase
class VideoMaker(QuickAppBase):
""" Basic example of a QuickApp (no Compmake support) """
def define_program_options(self, params):
params.add_int('param_name', default=1)
def go(self):
self.info('you passed: %s' % self.get_options().param_name)
main = VideoMaker.get_sys_main()
Here's an example that uses Compmake to define jobs: ::
#!/usr/bin/env python
from quickapp import QuickApp
class AppExample(QuickApp):
""" Simplest app example """
def define_options(self, params):
params.add_int('x', default=1)
def define_jobs_context(self, context):
options = self.get_options()
# create a job
context.comp(f, options.x)
def f(x):
print('x = %s' % x)
app_example_main = AppExample.get_sys_main()
if __name__ == '__main__':
app_example_main()
QuickApp with subcommands
-----------------------------
Define the parent app by deriving from ``QuickMultiCmdApp``: ::
class DemoApp(QuickMultiCmdApp):
cmd = 'dp'
def define_multicmd_options(self, params):
params.add_string('config', help='Config Joint')
params.add_int('param2', help='Second parameter')
def initial_setup(self):
options = self.get_options()
self.info('Loading configuration from %r.' % options.config)
self.info('My param2 is %r.' % options.param2)
main_func = DemoApp.
Define the subapps by deriving from ``DemoApp.get_sub()``: ::
class DemoAppCmd1(QuickApp, DemoApp.get_sub()):
cmd = 'cmd1'
short = 'First command'
def define_options(self, params):
params.add_int('param1', help='First parameter', default=1)
params.add_int('param2', help='Second parameter')
def define_jobs(self, context):
options = self.get_options()
self.info('My param2 is %r.' % options.param2)
Raw data
{
"_id": null,
"home_page": "http://github.com/AndreaCensi/quickapp",
"name": "QuickApp",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Andrea Censi",
"author_email": "censi@mit.edu",
"download_url": "https://files.pythonhosted.org/packages/4f/01/0b678724ebc8e8a748b73dde1e154702b098c1c4befdc87ed94571487e24/QuickApp-1.3.19.tar.gz",
"platform": "",
"description": ".. image:: https://circleci.com/gh/AndreaCensi/quickapp.svg?style=svg\n :target: https://circleci.com/gh/AndreaCensi/quickapp\n\nQuickApp\n========\n\nQuickApp is a library that composes the functionality of Compmake, Reprep \nin high-level constructs for extremely rapid development of scientific applications.\n\nSimplest QuickApp application\n-----------------------------\n\nThis is an example of the simplest QuickApp application.\nIt does not use Compmake functionality. ::\n\n from quickapp import QuickAppBase\n\n class VideoMaker(QuickAppBase):\n \"\"\" Basic example of a QuickApp (no Compmake support) \"\"\"\n def define_program_options(self, params):\n params.add_int('param_name', default=1)\n \n def go(self):\n self.info('you passed: %s' % self.get_options().param_name)\n\n main = VideoMaker.get_sys_main()\n \n \nHere's an example that uses Compmake to define jobs: ::\n\n\n #!/usr/bin/env python \n from quickapp import QuickApp\n\n class AppExample(QuickApp):\n \"\"\" Simplest app example \"\"\"\n \n def define_options(self, params):\n params.add_int('x', default=1)\n \n def define_jobs_context(self, context):\n options = self.get_options()\n # create a job\n context.comp(f, options.x)\n \n def f(x):\n print('x = %s' % x) \n \n app_example_main = AppExample.get_sys_main()\n \n if __name__ == '__main__':\n app_example_main()\n\nQuickApp with subcommands\n-----------------------------\n\nDefine the parent app by deriving from ``QuickMultiCmdApp``: ::\n\n class DemoApp(QuickMultiCmdApp):\n cmd = 'dp'\n \n def define_multicmd_options(self, params):\n params.add_string('config', help='Config Joint')\n params.add_int('param2', help='Second parameter')\n\n def initial_setup(self):\n options = self.get_options()\n self.info('Loading configuration from %r.' % options.config)\n self.info('My param2 is %r.' % options.param2)\n\n main_func = DemoApp.\n \nDefine the subapps by deriving from ``DemoApp.get_sub()``: ::\n\n class DemoAppCmd1(QuickApp, DemoApp.get_sub()):\n cmd = 'cmd1'\n short = 'First command'\n \n def define_options(self, params):\n params.add_int('param1', help='First parameter', default=1)\n params.add_int('param2', help='Second parameter')\n \n def define_jobs(self, context):\n options = self.get_options()\n self.info('My param2 is %r.' % options.param2)",
"bugtrack_url": null,
"license": "",
"summary": "",
"version": "1.3.19",
"project_urls": {
"Download": "http://github.com/AndreaCensi/quickapp/tarball/1.3.19",
"Homepage": "http://github.com/AndreaCensi/quickapp"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4f010b678724ebc8e8a748b73dde1e154702b098c1c4befdc87ed94571487e24",
"md5": "3bff1bdaf0c39297dc47209fc15fa95f",
"sha256": "02fce7faa46778e9e0d16d829d539060d42cffdd9dd13a29168b07f33da98183"
},
"downloads": -1,
"filename": "QuickApp-1.3.19.tar.gz",
"has_sig": false,
"md5_digest": "3bff1bdaf0c39297dc47209fc15fa95f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 47049,
"upload_time": "2019-02-10T15:04:41",
"upload_time_iso_8601": "2019-02-10T15:04:41.242896Z",
"url": "https://files.pythonhosted.org/packages/4f/01/0b678724ebc8e8a748b73dde1e154702b098c1c4befdc87ed94571487e24/QuickApp-1.3.19.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-02-10 15:04:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AndreaCensi",
"github_project": "quickapp",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"circle": true,
"requirements": [
{
"name": "PyContracts",
"specs": [
[
"==",
"1.8.12"
]
]
},
{
"name": "RepRep",
"specs": [
[
"==",
"2.11.0"
]
]
},
{
"name": "DecentLogs",
"specs": [
[
"==",
"1.4.0"
]
]
},
{
"name": "compmake",
"specs": [
[
"==",
"3.6.8"
]
]
},
{
"name": "ConfTools",
"specs": [
[
"==",
"1.9.7"
]
]
}
],
"lcname": "quickapp"
}