{"id":28633697,"url":"https://github.com/nallwhy/doumi_port","last_synced_at":"2025-10-25T15:05:18.354Z","repository":{"id":167886652,"uuid":"643407073","full_name":"nallwhy/doumi_port","owner":"nallwhy","description":"A helper library that makes it easier to use Python, Ruby in Elixir","archived":false,"fork":false,"pushed_at":"2023-11-04T15:12:41.000Z","size":47,"stargazers_count":24,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-11T03:41:13.988Z","etag":null,"topics":["elixir","python","ruby"],"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/nallwhy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-05-21T04:00:04.000Z","updated_at":"2025-04-13T18:36:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"ebac0312-7b8e-4dbd-bc5b-a09f7110649f","html_url":"https://github.com/nallwhy/doumi_port","commit_stats":null,"previous_names":["nallwhy/doumi_port"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/nallwhy/doumi_port","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nallwhy%2Fdoumi_port","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nallwhy%2Fdoumi_port/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nallwhy%2Fdoumi_port/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nallwhy%2Fdoumi_port/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nallwhy","download_url":"https://codeload.github.com/nallwhy/doumi_port/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nallwhy%2Fdoumi_port/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259490550,"owners_count":22865769,"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","python","ruby"],"created_at":"2025-06-12T15:09:33.942Z","updated_at":"2025-10-25T15:05:13.293Z","avatar_url":"https://github.com/nallwhy.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Doumi.Port\n\n[![Hex Version](https://img.shields.io/hexpm/v/doumi_port.svg)](https://hex.pm/packages/doumi_port)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/doumi_port/)\n[![License](https://img.shields.io/hexpm/l/doumi_port.svg)](https://github.com/nallwhy/doumi_port/blob/master/LICENSE.md)\n[![Last Updated](https://img.shields.io/github/last-commit/nallwhy/doumi_port.svg)](https://github.com/nallwhy/doumi_port/commits/main)\n\n\u003c!-- MDOC !--\u003e\n\n`Doumi.Port` is a helper library that makes it easier to use Python, Ruby in Elixir powered by [Erlport](https://github.com/erlport/erlport), [NimblePool](https://github.com/dashbitco/nimble_pool).\n\n**도우미(Doumi)** means \"helper\" in Korean.\n\n## Why pool?\n\nhttps://medium.com/stuart-engineering/how-we-use-python-within-elixir-486eb4d266f9\n\n\u003e Every time we run Python code through ErlPort, ErlPort starts an OS process, this is rather inefficient and expensive. To avoid this trap, we went looking for some pooling mechanism ...\n\n## Why [NimblePool](https://github.com/dashbitco/nimble_pool)?\n\nhttps://github.com/dashbitco/nimble_pool#nimblepool\n\n\u003e You should consider using NimblePool whenever you have to manage sockets, **ports**, or NIF resources and you want the client to perform one-off operations on them. For example, NimblePool is a good solution to manage HTTP/1 connections, ports that need to communicate with long-running programs, etc.\n\n## Usage\n\n### Call Python function via Pool\n\n```elixir\ndefmodule MyApp.PythonPool do\n  use Doumi.Port,\n    adapter: Doumi.Port.Adapter.Python,\n    pool_size: 4\nend\n\ndefmodule MyApp.Application do\n  ...\n\n  @impl true\n  def start(_type, _args) do\n    children = [\n      ...\n      MyApp.PythonPool\n    ]\n\n    Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)\n  end\nend\n\ndefmodule MyApp.Native do\n  def add(a, b) do\n    {:ok, result} = MyApp.PythonPool.command(:operator, :add, [a, b])\n\n    result\n  end\nend\n```\n\n### Init and Setup Python in Elixir application\n\n```shell\n# Create requirements.txt, .gitignores to ./priv/python\nmix doumi.port.init --port python\n\n# Add Python dependency\necho \"pypdf2==3.0.1\" \u003e\u003e ./priv/python/requirements.txt\n\n# Install Python dependecies\nmix doumi.port.setup --port python\n```\n\nYou can install Python dependencies to your release with `mix doumi.port.setup`.\n\n```elixir\ndefmodule MyApp.MixProject do\n  defp aliases do\n    [\n      ...,\n      \"release.setup\": [\"doumi.port.setup --port python\", ...]\n    ]\n  end\nend\n```\n\n```dockerfile\n...\n\n# release setup (ex. install Python dependencies, compile assets)\nRUN mix release.setup\n\n...\n```\n\n## Installation\n\nThe package can be installed by adding `doumi_port` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:doumi_port, \"~\u003e 0.6.0\"},\n    # To support Python \u003e= 3.11, erlport should be overridden\n    # https://github.com/erlport/erlport/pull/13\n    {:erlport, github: \"nallwhy/erlport\", ref: \"6f5cb45\", override: true}\n  ]\nend\n```\n\n## TODO\n\n- [x] Support use macro\n- [x] Support Ruby\n- [x] Support mix tasks that help setup Python in applications\n- [x] Support mix tasks that help setup Ruby in applications\n- [ ] Pool 이 위치를 알게하고, compile 시에 빌드를 하도록\n- [ ] Documentation\n- [ ] Write blog posts\n\n\u003c!-- MDOC !--\u003e\n\n## Doumi\\*\n\nAll **Doumi** libraries:\n\n- [Doumi.Phoenix.SVG](https://github.com/nallwhy/doumi_phoenix_svg): A helper library that generates Phoenix function components from SVG files.\n- [Doumi.Phoenix.Params](https://github.com/nallwhy/doumi_phoenix_params): A helper library that supports converting form to params and params to form\n- [Doumi.URI.Query](https://github.com/nallwhy/doumi_uri_query): A helper library that encode complicated query of URI.\n\n## Copyright and License\n\nCopyright (c) 2023 Jinkyou Son (Json)\n\nThis work is free. You can redistribute it and/or modify it under the\nterms of the MIT License. See the [LICENSE.md](./LICENSE.md) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnallwhy%2Fdoumi_port","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnallwhy%2Fdoumi_port","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnallwhy%2Fdoumi_port/lists"}