{"id":26781683,"url":"https://github.com/walkr/exns","last_synced_at":"2025-04-19T13:40:57.783Z","repository":{"id":36650221,"uuid":"40956513","full_name":"walkr/exns","owner":"walkr","description":"Interact with Python nanoservices from Elixir.","archived":false,"fork":false,"pushed_at":"2016-07-20T08:59:15.000Z","size":107,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T03:02:38.763Z","etag":null,"topics":["elixir","nanoservice","python"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/walkr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-18T07:07:58.000Z","updated_at":"2018-09-23T06:57:42.000Z","dependencies_parsed_at":"2022-09-08T23:00:13.313Z","dependency_job_id":null,"html_url":"https://github.com/walkr/exns","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walkr%2Fexns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walkr%2Fexns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walkr%2Fexns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walkr%2Fexns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/walkr","download_url":"https://codeload.github.com/walkr/exns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249704723,"owners_count":21313195,"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":["elixir","nanoservice","python"],"created_at":"2025-03-29T08:17:31.666Z","updated_at":"2025-04-19T13:40:57.752Z","avatar_url":"https://github.com/walkr.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"exns (beta)\n===========\n\nThis library allows you to interact with **Python** code from **Elixir** \n\n**Typical flow**\n\n* Expose your desired Python code as a [nanoservice](https://github.com/walkr/nanoservice)\n* Call your code from Elixir language using the exns library\n\n**Features**\n\n* Fast – uses [nanomsg](https://github.com/nanomsg/nanomsg) socket library, and MessagePack (or JSON) for serialization\n* Flexible – your nanoservice can be running on the local machine or remotely on a different computer\n* Simple – your Python code is just one call away\n\n### Installation\n\n* Add `exns` as dependency\n\n\n```elixir\n defp deps do\n    [{:exns, \"~\u003e 0.3.5-beta\"}]\n  end\n```\n\n* Ensure `exns` app is started\n\n```elixir\n  def application do\n    [mod: {\u003c\u003cYOUR-APP-MODULE\u003e\u003e, []},\n     applications: [..., :exns, ...]]\n  end\n```\n\n### Configuration\n\n\n* Define your nanoservices in your app's `config.exs`\n\n```elixir\n### Nanoservices\n\nconfig :exns, nanoservices: [\n\n  [name: :math_service,\n   address: \"ipc:///tmp/math-service.sock\",\n   timeout: 5000,\n   workers: 10],\n\n  [name: :string_service,\n   address: \"ipc:///tmp/string-service.sock\",\n   timeout: 5000,\n   workers: 10,\n   encoder: \"msgpack\"]]  # default encoder is \"json\"\n```\n\n\n### Usage\n\nFirst, ensure your defined Python **nanoservices** are running.\n\nTo learn more about writing a nanoservice in Python please see the [nanoservice](https://github.com/walkr/nanoservice) library\n\n* Making a request from Elixir\n\n```elixir\n# The call format is (serviceName, methodName, arguments)\n\nresponse = Exns.call(:math_service, \"add\", [1, 2])\n\ncase response do\n\t{:ok, result} -\u003e IO.puts \"1 + 2 = #{result}\"\n\t{:error, error} -\u003e IO.puts \"Nano service erred #{inspect error}\"\nend\n```\n\n* Making an optimistic request\n\n```elixir\n3 == Exns.call!(:math_service, \"add\", [1, 2])\n```\n\n\n### Development\n\nRun tests\n```\n$ mix test\n\nStats for simple pings to math service:\n---\nConcurrency:                    2000 clients\nThroughput                      4361 req/sec\nAvg. Request Time:              0.23 ms\n....\n\nFinished in 0.6 seconds (0.1s on load, 0.4s on tests)\n6 tests, 0 failures\n\nRandomized with seed 864352\n```\n\n... and with coverage\n\n```\n$ mix test --cover\n```\n\n\n### MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalkr%2Fexns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwalkr%2Fexns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalkr%2Fexns/lists"}