{"id":24901177,"url":"https://github.com/WoodyXP/Pyjulia","last_synced_at":"2025-10-16T12:32:36.237Z","repository":{"id":153900008,"uuid":"631050852","full_name":"WoodyXP/Pyjulia","owner":"WoodyXP","description":"Pyjulia is a python module for calling julia functions inside your python code.","archived":false,"fork":false,"pushed_at":"2023-06-02T14:14:40.000Z","size":114,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-19T05:18:51.495Z","etag":null,"topics":["binding","julia","julia-language","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WoodyXP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-04-21T19:53:34.000Z","updated_at":"2023-05-12T06:18:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"f1db646d-728d-4bfe-85e8-525c047ee3fb","html_url":"https://github.com/WoodyXP/Pyjulia","commit_stats":{"total_commits":77,"total_committers":4,"mean_commits":19.25,"dds":0.2727272727272727,"last_synced_commit":"7246a2fa4444075a9fe3ff01075c22df5eb56b8c"},"previous_names":["woodyxp/pylia"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WoodyXP%2FPyjulia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WoodyXP%2FPyjulia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WoodyXP%2FPyjulia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WoodyXP%2FPyjulia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WoodyXP","download_url":"https://codeload.github.com/WoodyXP/Pyjulia/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236719473,"owners_count":19194048,"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":["binding","julia","julia-language","python"],"created_at":"2025-02-01T21:15:06.930Z","updated_at":"2025-10-16T12:32:30.965Z","avatar_url":"https://github.com/WoodyXP.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pyjulia\nPyjulia is a python module for calling julia functions inside your python code.\n\n## Usage\nThe julia interpreter is inside the PATH for the following examples. If you do not have julia inside your PATH you can also define the path to the julia interpreter like that:\n```python\nimport pyjulia\n\njulia_module = pyjulia.Pyjulia(\"./example.jl\")\njulia_module.julia_interpreter = \"your path to julia interpreter\"\n\n# execute code...\n```\n\nYou will have to use the [Fire](https://github.com/ylxdzsw/Fire.jl) package inside of your Julia code in order to use it like a cli application. An example would look like this:\n```julia\nusing Fire\n\n@main function add(num::Integer...)\n    println(sum(num))\nend\n\n@main function multiply(num::Integer...)\n    println(prod(num))\nend\n\n@main function greet(name, age, num::Integer...)\n    println(name, age)\n    println(num)\nend\n```\n### call_func method\nLet's say the content of this julia code belongs to a file called ```example.jl```. You can now call the add and multiply functions inside your python code:\n```python\nimport pyjulia\n\njulia_module = pyjulia.Pyjulia(\"./example.jl\")\n\nmy_args = [2, 3, 5]\n\njulia_sum = julia_module.call_func(\"add\", my_args)\njulia_prod = julia_module.call_func(\"multiply\", my_args)\n\nprint(julia_sum, julia_prod)\n```\nYour output should now look like this:\n```\n10 30\n```\n### using dynamic function declaration\nLet's use the same ```example.jl``` from before. This means the content will look like this:\n```julia\nusing Fire\n\n@main function add(num::Integer...)\n    println(sum(num))\nend\n\n@main function multiply(num::Integer...)\n    println(prod(num))\nend\n\n@main function greet(name, age, num::Integer...)\n    println(name, age)\n    println(num)\nend\n```\nNow in order to call these function within your python code you need to do this:\n\u003e ⚠️ **_NOTE:_**  Your IDE/text editor may tell you \"Unresolved attribute reference add/multiply for class Julia\". There's no need to worry. It should still work just as fine.\n```python\nimport pyjulia\n\njulia_module = pyjulia.Pyjulia(\"./example.jl\")\n\noutput = julia_module.add(my_args)\noutput2 = julia_module.multiply(my_args)\nprint(output, output2)\n```\nYour output should still look like this:\n```\n10 30\n```\n\nThe ```greet``` function inside the julia file has multiple arguments. But this doesn't prevent us from calling it from python. It works just as fine as the other examples above:\n```python\nimport pyjulia\n\njulia_module = pyjulia.Pyjulia(\"./example.jl\")\ngreet_args = [\"Pyjulia\", 19, 2, 3, 4, 5]\ngreeting = julia_module.greet(greet_args)\nprint(greeting)\n```\nThe following output should be printed to the terminal:\n```\npyjulia 19\n(2, 3, 4, 5)\n```\nYou can just treat them as normal positional variables and the [Fire](https://github.com/ylxdzsw/Fire.jl) package from julia will parse the arguments automatically.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWoodyXP%2FPyjulia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWoodyXP%2FPyjulia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWoodyXP%2FPyjulia/lists"}