{"id":18756063,"url":"https://github.com/varlink/python","last_synced_at":"2025-04-05T05:02:32.305Z","repository":{"id":41902421,"uuid":"100720644","full_name":"varlink/python","owner":"varlink","description":"Python implementation of the Varlink protocol","archived":false,"fork":false,"pushed_at":"2025-03-17T12:43:19.000Z","size":1542,"stargazers_count":53,"open_issues_count":12,"forks_count":11,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-28T13:56:20.589Z","etag":null,"topics":["ipc","json","python","varlink"],"latest_commit_sha":null,"homepage":"https://varlink.org/python/","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/varlink.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":"2017-08-18T14:34:58.000Z","updated_at":"2025-03-24T14:58:21.000Z","dependencies_parsed_at":"2024-06-19T01:46:15.631Z","dependency_job_id":"cb939f8f-d523-4b9a-8b0a-e633c5daf267","html_url":"https://github.com/varlink/python","commit_stats":{"total_commits":373,"total_committers":11,"mean_commits":33.90909090909091,"dds":0.3512064343163539,"last_synced_commit":"ea5de247d8d86767095d50a13d0ce3dbc80c877f"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varlink%2Fpython","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varlink%2Fpython/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varlink%2Fpython/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varlink%2Fpython/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varlink","download_url":"https://codeload.github.com/varlink/python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289409,"owners_count":20914464,"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":["ipc","json","python","varlink"],"created_at":"2024-11-07T17:35:01.683Z","updated_at":"2025-04-05T05:02:32.285Z","avatar_url":"https://github.com/varlink.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Varlink Certified](https://img.shields.io/badge/varlink-certified-green.svg)](https://www.varlink.org/Language-Bindings)\n[![Build Status](https://travis-ci.org/varlink/python.svg?branch=master)](https://travis-ci.org/varlink/python)\n[![Coverage Status](https://coveralls.io/repos/github/varlink/python/badge.svg?branch=master)](https://coveralls.io/github/varlink/python?branch=master)\n[![PyPI](https://img.shields.io/pypi/v/varlink.svg)](https://pypi.org/project/varlink/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/varlink.svg)](https://pypi.org/project/varlink/)\n[![PyPI - Status](https://img.shields.io/pypi/status/varlink.svg)](https://pypi.org/project/varlink/)\n\n# python-varlink\n\nA [varlink](http://varlink.org) implementation for Python.\n\n* [GIT Repository](https://github.com/varlink/python)\n* [API documentation](https://varlink.github.io/python/)\n\n## python varlink installation\n\nFrom pypi:\n```bash\n$ pip3 install --user varlink\n```\n\nWith Fedora 28/rawhide:\n```bash\n$ sudo dnf install python3-varlink\n```\n\n## Examples\n\nSee the [tests](https://github.com/varlink/python-varlink/tree/master/varlink/tests) directory.\n\n```bash\n$ python3 -m varlink.tests.test_orgexamplemore --varlink=\"unix:/tmp/test\" \u0026\n[1] 6434\n$ python3 -m varlink.cli help unix:/tmp/test/org.example.more\n# Example Varlink service\ninterface org.example.more\n\n# Enum, returning either start, progress or end\n# progress: [0-100]\ntype State (\n  start: ?bool,\n  progress: ?int,\n  end: ?bool\n)\n\n# Returns the same string\nmethod Ping(ping: string) -\u003e (pong: string)\n\n# Dummy progress method\n# n: number of progress steps\nmethod TestMore(n: int) -\u003e (state: State)\n\n# Stop serving\nmethod StopServing() -\u003e ()\n\n# Something failed in TestMore\nerror TestMoreError (reason: string)\n\n$ python3 -m varlink.cli call unix:/tmp/test/org.example.more.Ping '{ \"ping\": \"Ping\"}'\n{\n  \"pong\": \"Ping\"\n}\n \n\n$ fg\npython3 -m varlink.tests.test_orgexamplemore --varlink=\"unix:/tmp/test\"\n^C\n```\n\n```bash\n$ python3 -m varlink.tests.test_orgexamplemore --client -A 'python3 -m varlink.tests.test_orgexamplemore --varlink=$VARLINK_ADDRESS'\nConnecting to unix:/tmp/tmppxrbqk9p/4927\n\nListening on /tmp/tmppxrbqk9p/4927\n--- Start ---\nProgress: 0\nProgress: 10\nProgress: 20\nProgress: 30\nProgress: 40\nProgress: 50\nProgress: 60\nPing:  Test\nProgress: 70\nPing:  Test\nProgress: 80\nPing:  Test\nProgress: 90\nPing:  Test\nProgress: 100\nPing:  Test\n--- End ---\n```\n\n```bash\n$ PYTHONPATH=$(pwd) python3 ./varlink/tests/test_orgexamplemore.py\nConnecting to unix:/tmp/tmp7n6zc67d/5257\n\nListening on /tmp/tmp7n6zc67d/5257\n--- Start ---\nProgress: 0\nProgress: 10\nProgress: 20\nProgress: 30\nProgress: 40\nProgress: 50\nProgress: 60\nPing:  Test\nProgress: 70\nPing:  Test\nProgress: 80\nPing:  Test\nProgress: 90\nPing:  Test\nProgress: 100\nPing:  Test\n--- End ---\n```\n\n```bash\n$ python3 -m varlink.tests.test_orgexamplemore --varlink=\"unix:/tmp/test\" \u0026\nListening on /tmp/test\n[1] 6434\npython3 -m varlink.tests.test_orgexamplemore --client --varlink=\"unix:/tmp/test\"\nConnecting to unix:/tmp/test\n\nPing:  Test\n--- Start ---\nProgress: 0\nProgress: 10\nProgress: 20\nProgress: 30\nProgress: 40\nProgress: 50\nProgress: 60\nPing:  Test\nProgress: 70\nPing:  Test\nProgress: 80\nPing:  Test\nProgress: 90\nPing:  Test\nProgress: 100\nPing:  Test\n--- End ---\n\n$ python3 -m varlink.cli call --more unix:/tmp/test/org.example.more.TestMore '{ \"n\": 10 }'\n{'state': {'start': True}}\n{'state': {'progress': 0}}\n{'state': {'progress': 10}}\n{'state': {'progress': 20}}\n{'state': {'progress': 30}}\n{'state': {'progress': 40}}\n{'state': {'progress': 50}}\n{'state': {'progress': 60}}\n{'state': {'progress': 70}}\n{'state': {'progress': 80}}\n{'state': {'progress': 90}}\n{'state': {'progress': 100}}\n{'state': {'end': True}}\n\n$ fg\npython3 -m varlink.tests.test_orgexamplemore --varlink=\"unix:/tmp/test\"\n^C\n```\n\nYou can also start the clients and server with URLs following the [varlink URL standard](https://varlink.org/#address) with `unix:` and `tcp:`.\nE.g.\n- unix:@anonuds\n- unix:/run/myserver/socketfile\n- tcp:127.0.0.1:12345\n- tcp:[::1]:12345\n\n\n### Activation Mode\n\nActivation mode starts the service to connect to and passes the socket via socket activation.\nThe ```VARLINK_ADDRESS``` environment variable contains the varlink address URI.\n\n```bash\n$ python3 -m varlink.cli --activate 'python3 -m varlink.tests.test_orgexamplemore --varlink=$VARLINK_ADDRESS' call org.example.more.Ping '{ \"ping\": \"Ping\"}'\nListening on @00352\n{'pong': 'Ping'}\n```\n\n\n### Bridge Mode\n\nBridge mode allows to tunnel to a remote point via stdin/stdout and call a method.\nRunning ```varlink bridge``` allows to connect stdio to the host services via ```org.varlink.resolver``` interface resolving.\n\n```bash\n# python3 -m varlink.cli -b \"ssh host.example.org varlink bridge\" call com.redhat.machine.GetInfo '{}'\n{\n  \"hostname\": \"host.example.org\",\n  \"system\": {\n    \"id\": \"fedora\",\n    \"kernel_version\": \"4.18.0-0.rc5.git1.2.fc29.x86_64\",\n    \"name\": \"Fedora\",\n    \"version\": \"29\"\n  },\n  \"virtualization\": {\n    \"name\": \"none\"\n  }\n}\n```\n\n### Varlink Certification Server\n\n```\n$ python3 -m varlink.tests.test_certification --varlink=tcp:127.0.0.1:12345\n```\n\n### Varlink Certification Client\n\n```\n$ python3 -m varlink.tests.test_certification --varlink=tcp:127.0.0.1:12345 --client\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarlink%2Fpython","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarlink%2Fpython","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarlink%2Fpython/lists"}