{ "info": { "author": "AppointmentGuru", "author_email": "tech@appointmentguru.co", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# DJ Actions\n\nA framework for doing things slightly more complicated than CRUD.\n\n1. [ ] Define complex workflows with datastructures\n1. [ ] Self documenting\n1. [ ] High level modular construction of compound actions\n1. [ ] Monitor actions and progress\n1. [ ] Replay\n1. [ ] Reverse\n1. [ ] Time travel\n\n## Getting started\n\n### Installation:\n\n`pip install dj-actions`\n\nAdd the app to 'INSTALLED_APPS`:\n\n```\nINSTALLED_APPS = [\n ..\n 'actions',\n]\n```\n\n### Your first action\n\n`dj-actions` uses an `ACTION_MAP` setting to define how tasks are mapped to code.\n\nThere are a few strategies for generating your action map, but yaml isn't a bad option. In `settings.py`\n\n```python\nimport yaml\naction_yml = \"\"\"\nhello_world:\n name: \"HelloWorld\"\n example_payload:\n msg: \"hello!\",\n tasks:\n sync:\n - name: say_hi\n execute: actions.tasks.debug.hello\n\"\"\"\nACTIONS_MAP = yaml.load(action_yml)\n```\n\n.. or use the `get_action_map` helper:\n\n```\nfrom actions.helpers import get_action_map\nACTION_MAP = get_action_map([\n 'example_project/actions.yml',\n 'path/to/some/other/actions.yml'\n])\n```\n\nNow you can cause this to execute with:\n\n```python\nfrom action.models import ActionInstance\nactor = get_user_model().objects.first()\npayload = {\"msg\": \"hi!\"}\naction = ActionInstance.from_config(actor, 'hello_world', payload = payload)\naction.run()\n```\n\n### API\n\nYou can add an API:\n\n**urls.py**\n```python\nfrom actions.api import router as actions_router\n\nurlpatterns = [\n ...\n path('actions/', include(actions_router.urls)),\n]\n```\n\n### Documentation\n\nYour `ACTION_MAP` can generate docs for you:\n\n\n\n**Dependencies:**\n\nWe build on the work of much smarter people.\n\n* Django\n* Django Rest Framework\n\n### Add-ons/plugins:\n\n* sentry\n* dj-nosql -> push into firestore etc\n* streamio -> push into stream\n* ...\n\n## Concepts\n\n### Triggers\n\n..\n\n### Actions\n\n..\n\n### ActionInstance\n\n..\n\n## Creating an action\n\n```\nPOST /actions/:resourceName/:verb/:id/\n\n{\n payload: { .. }\n}\n```\n\ne.g.: `/actions/invoice/send/123/`\n\n## Models:\n\n```python\n\nclass Action:\n '''\n Stores an incoming request so that it can be tracked and replayed if necessary\n '''\n slug # used to look up action in Catalog\n payload(json)\n files\n actor(user)\n # models are stored as: `myapp.models.MyModel:id`\n # tasks can add models as they go\n models\n context(json) # tasks can add to context as they go\n status\n\nclass TaskExecutionStatus:\n '''\n Tasks must record their execution status for the action\n '''\n incomingaction(fk)\n task\n status\n input\n ouput\n notes\n\n\nclass RegisteredAction:\n \"\"\"\n A calalog of available actions and their definitions\n \"\"\"\n title\n description\n documentation # markdown docs for this action\n slug\n payload_map # optional, map a payload to arguments for the task\n permission_tasks: [],\n validation_tasks: [],\n sync_tasks: [],\n async_tasks: [],\n scheduled_tasks: []\n\nclass RegisteredTask:\n \"\"\"\n Library of available tasks\n \"\"\"\n title\n description\n documentation\n invokation # e.g.: path.to.my_task\n\n\nclass ActionEvent:\n actor(user)\n context\n template\n parsed\n object_ids # object ids which control who can see this event\n```\n\n\n## Tasks provided by the library:\n\n* `add_to_feed` -> Adds `ActionEvents` when actions happen\n* `trigger_action` -> Creates a new `Action`\n\n### Adding a custom task pack:\n\n* provide a python app\n* app should have a management script named `register_tasks` .. you can guess what that does", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/SchoolOrchestration/libs/dj-actions", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "dj-actions", "package_url": "https://pypi.org/project/dj-actions/", "platform": "", "project_url": "https://pypi.org/project/dj-actions/", "project_urls": { "Homepage": "https://gitlab.com/SchoolOrchestration/libs/dj-actions" }, "release_url": "https://pypi.org/project/dj-actions/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "A framework for performating complex actions on objects", "version": "0.0.1" }, "last_serial": 4922504, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "b27635507f0306b7f58033998c938c07", "sha256": "a9ce0efb6c312ce4fcf2d9a24f0131cb949e92d9ae52904d165cc2832a2af038" }, "downloads": -1, "filename": "dj_actions-0.0.1.tar.gz", "has_sig": false, "md5_digest": "b27635507f0306b7f58033998c938c07", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6584, "upload_time": "2019-03-10T19:59:26", "url": "https://files.pythonhosted.org/packages/4b/b8/2834f5d838495478dba3599fd1d994317d981644544617d89595023f00bb/dj_actions-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b27635507f0306b7f58033998c938c07", "sha256": "a9ce0efb6c312ce4fcf2d9a24f0131cb949e92d9ae52904d165cc2832a2af038" }, "downloads": -1, "filename": "dj_actions-0.0.1.tar.gz", "has_sig": false, "md5_digest": "b27635507f0306b7f58033998c938c07", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6584, "upload_time": "2019-03-10T19:59:26", "url": "https://files.pythonhosted.org/packages/4b/b8/2834f5d838495478dba3599fd1d994317d981644544617d89595023f00bb/dj_actions-0.0.1.tar.gz" } ] }