{"id":16444916,"url":"https://github.com/jaymon/morp","last_synced_at":"2025-03-23T08:32:12.794Z","repository":{"id":10278630,"uuid":"12394046","full_name":"Jaymon/morp","owner":"Jaymon","description":"Python message passing wrapper around Amazon SQS","archived":false,"fork":false,"pushed_at":"2024-02-04T00:23:29.000Z","size":193,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-18T19:29:07.447Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jaymon.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2013-08-27T01:35:25.000Z","updated_at":"2023-03-03T09:36:27.000Z","dependencies_parsed_at":"2024-10-28T15:34:26.776Z","dependency_job_id":"636167d3-1ee4-46ca-b36e-b18d7e9aaf51","html_url":"https://github.com/Jaymon/morp","commit_stats":{"total_commits":51,"total_committers":2,"mean_commits":25.5,"dds":"0.039215686274509776","last_synced_commit":"e0be22cc180622ee2b724b786fed371a7c863464"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fmorp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fmorp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fmorp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fmorp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaymon","download_url":"https://codeload.github.com/Jaymon/morp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078067,"owners_count":20557274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-10-11T09:42:36.821Z","updated_at":"2025-03-23T08:32:12.408Z","avatar_url":"https://github.com/Jaymon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Morp\n\nSimple message processing without really thinking about it. Morp can use dropfiles (simple text files), Postgres, and [Amazon SQS](http://aws.amazon.com/sqs/).\n\n\n## Installation\n\nUse pip to install the latest stable version:\n\n    pip install morp\n    \nMorp only supports the dropfiles interface out of the box, you'll need to install certain dependencies depending on what interface you want to use:\n\n    pip install morp[sqs]\n    pip install morp[postgres]\n    \nTo install the development version:\n\n    pip install -U \"git+https://github.com/Jaymon/morp#egg=morp\"\n\n\n## 1 Minute Getting Started\n\nSend and receive a `Foo` message.\n\nFirst, let's set our environment variable to use dropfiles (local files suitable for development and prototyping) interface:\n\n    export MORP_DSN=dropfile:${TMPDIR}\n\nThen, let's create three files in our working directory:\n\n* `tasks.py` - We'll define our `Message` classes here.\n* `send.py` - We'll send messages from this script.\n* `recv.py` - We'll receive messages from this script.\n\n\nLet's create our `Message` class in `tasks.py`:\n\n```python\n# tasks.py\nfrom morp import Message\n\nclass Foo(Message):\n    def target(self):\n        # this will be run when a Foo message is consumed\n        print(self.fields)\n```\n\nNow, let's flesh out our `recv.py` file:\n\n```python\n# recv.py\n\n# import our Foo message class from our tasks.py file\nfrom tasks import Foo\n\n# Foo's handle method will call Foo.target\nFoo.handle()\n```\n\nAnd start it up:\n\n```\n$ python recv.py\n```\n\n\nFinally, let's send some messages by fleshing out `send.py`:\n\n```python\n# send.py\n\nfrom tasks import Foo\n\n# create a message and send it manually\nf = Foo()\nf.some_field = 1\nf.some_other_field = \"one\"\nf.send()\n\n# quickly send a message\nFoo.create(\n    some_field=2,\n    some_other_field = \"two\"\n)\n```\n\nAnd running it (it should send two messages):\n\n```\n$ python send.py\n```\n\nThat's it! Our running `recv.py` script should've received the messages we sent when we ran our `send.py` script.\n\n\n## DSN\n\nYou configure your connection using a dsn in the form:\n\n    InterfaceName://username:password@host:port/path?param1=value1\u0026param2=value2\n\nSo, to connect to [Amazon SQS](http://aws.amazon.com/sqs/), you would do:\n\n    sqs://${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}@\n\nYou can also override some default values like `region` and `read_lock`:\n\n    sqs://${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}@?region=${AWS_DEFAULT_REGION}\u0026read_lock=120\n\n\n### Serializers\n\n* `pickle` (default)\n* `json`\n\n```\nMORP_DSN=\"sqs://x:x@?serializer=json\"\n```\n\n\n## Encryption\n\nYou might need to install some dependencies:\n\n```\npip install morp[encryption]\n```\n\nIf you would like to encrypt all your messages, you can pass in a `key` argument to your DSN and Morp will take care of encrypting and decrypting the messages for you transparently.\n\nLet's just modify our DSN to pass in our key:\n\n    sqs://${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}@?key=jy4XWRuEsrH98RD2VeLG62uVLCPWpdUh\n\nThat's it, every message will now be encrypted on send and decrypted on receive. If you're using SQS you can also use [Amazon's key management service](https://github.com/Jaymon/morp/blob/master/docs/KMS.md) to handle the encryption for you.\n\n\n## Environment configuration\n\n### MORP_DISABLED\n\nBy default every message will be sent, if you just want to test functionality without actually sending the message you can set this environment variable to turn off all the queues.\n\n    MORP_DISABLED = 1 # queue is off\n    MORP_DISABLED = 0 # queue is on\n\n\n### MORP_PREFIX\n\nIf you would like to have your queue names prefixed with something (eg, `prod` or `dev`) then you can set this environment variable and it will be prefixed to the queue name.\n\n\n### MORP_DSN\n\nSet this environment variable with your connection DSN so Morp can automatically configure itself when the interface is first requested.\n\n\n## FAQ\n\n### I would like to have multiple queues\n\nBy default, Morp will send any message from any `morp.Message` derived class to `Message.get_name()`, you can override this behavior by giving your child class a `.name` attribute:\n\n```python\nfrom morp import Message\n\nclass childMsg(Message):\n    name = \"custom-queue-name\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaymon%2Fmorp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaymon%2Fmorp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaymon%2Fmorp/lists"}