{"id":16190672,"url":"https://github.com/tiagocoutinho/linuxpy","last_synced_at":"2025-10-17T13:21:59.482Z","repository":{"id":200115560,"uuid":"685004487","full_name":"tiagocoutinho/linuxpy","owner":"tiagocoutinho","description":"Human friendly interface to linux subsystems using python","archived":false,"fork":false,"pushed_at":"2025-02-05T10:09:33.000Z","size":3628,"stargazers_count":39,"open_issues_count":8,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T06:01:44.739Z","etag":null,"topics":["alsa","asyncio","gevent","input","linux","midi","python","usb","v4l2"],"latest_commit_sha":null,"homepage":"https://tiagocoutinho.github.io/linuxpy/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiagocoutinho.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-08-30T10:00:08.000Z","updated_at":"2025-03-12T15:59:45.000Z","dependencies_parsed_at":"2023-10-31T22:26:48.749Z","dependency_job_id":"7f99b799-4214-494c-b620-a39c152cc1b3","html_url":"https://github.com/tiagocoutinho/linuxpy","commit_stats":null,"previous_names":["tiagocoutinho/linuxpy","tiagocoutinho/python-linux"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Flinuxpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Flinuxpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Flinuxpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Flinuxpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiagocoutinho","download_url":"https://codeload.github.com/tiagocoutinho/linuxpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299831,"owners_count":20916190,"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":["alsa","asyncio","gevent","input","linux","midi","python","usb","v4l2"],"created_at":"2024-10-10T07:43:52.987Z","updated_at":"2025-10-17T13:21:59.477Z","avatar_url":"https://github.com/tiagocoutinho.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# linuxpy\n\n[![linuxpy][pypi-version]](https://pypi.python.org/pypi/linuxpy)\n[![Python Versions][pypi-python-versions]](https://pypi.python.org/pypi/linuxpy)\n![License][license]\n[![CI][CI]](https://github.com/tiagocoutinho/linuxpy/actions/workflows/ci.yml)\n\n[![Source][source]](https://github.com/tiagocoutinho/linuxpy/)\n[![Documentation][documentation]](https://tiagocoutinho.github.io/linuxpy/)\n\nHuman friendly interface to linux subsystems using python.\n\nProvides python access to several linux subsystems like V4L2, GPIO, Led, thermal,\ninput and MIDI.\n\nThere is experimental, undocumented, incomplete and unstable access to USB.\n\nRequirements:\n* python \u003e= 3.11\n* Fairly recent linux kernel\n* Installed kernel modules you want to access\n\nAnd yes, it is true: there are no python libraries required! Also there are no\nC libraries required. Everything is done here through direct ioctl, read and\nwrite calls. Ain't linux wonderful?\n\n## Installation\n\nFrom within your favorite python environment:\n\n```console\n$ pip install linuxpy\n```\n\nTo run the examples you'll need:\n\n```console\n$ pip install linuxpy[examples]\n```\n\nTo develop, run tests, build package, lint, etc you'll need:\n\n```console\n$ pip install linuxpy[dev]\n```\n\n## Subsystems\n\n### GPIO\n\n```python\nfrom linuxpy.gpio import Device\n\nwith Device.from_id(0) as gpio:\n    info = gpio.get_info()\n    print(info.name, info.label, len(info.lines))\n    l0 = info.lines[0]\n    print(f\"L0: {l0.name!r} {l0.flags.name}\")\n\n# output should look somethig like:\n# gpiochip0 INT3450:00 32\n# L0: '' INPUT\n```\n\nCheck the [GPIO user guide](https://tiagocoutinho.github.io/linuxpy/user_guide/gpio/) and\n[GPIO reference](https://tiagocoutinho.github.io/linuxpy/api/gpio/) for more information.\n\n### Input\n\n```python\nimport time\nfrom linuxpy.input.device import find_gamepads\n\npad = next(find_gamepads())\nabs = pad.absolute\n\nwith pad:\n    while True:\n\t    print(f\"X:{abs.x:\u003e3} | Y:{abs.y:\u003e3} | RX:{abs.rx:\u003e3} | RY:{abs.ry:\u003e3}\", end=\"\\r\", flush=True)\n\t    time.sleep(0.1)\n```\n\nCheck the [Input user guide](https://tiagocoutinho.github.io/linuxpy/user_guide/input/) and\n[Input reference](https://tiagocoutinho.github.io/linuxpy/api/input/) for more information.\n\n### Led\n\n```python\nfrom linuxpy.led import find\n\ncaps_lock = find(function=\"capslock\")\nprint(caps_lock.brightness)\nprint(caps_lock.max_brightness)\n```\n\nCheck the [LED user guide](https://tiagocoutinho.github.io/linuxpy/user_guide/led/) and\n[LED reference](https://tiagocoutinho.github.io/linuxpy/api/led/) for more information.\n\n### MIDI Sequencer\n\n```console\n$ python\n\n\u003e\u003e\u003e from linuxpy.midi.device import Sequencer, event_stream\n\n\u003e\u003e\u003e seq = Sequencer()\n\u003e\u003e\u003e with seq:\n        port = seq.create_port()\n        port.connect_from(14, 0)\n        for event in seq:\n            print(event)\n 14:0   Note on              channel=0, note=100, velocity=3, off_velocity=0, duration=0\n 14:0   Clock                queue=0, pad=b''\n 14:0   System exclusive     F0 61 62 63 F7\n 14:0   Note off             channel=0, note=55, velocity=3, off_velocity=0, duration=0\n```\nCheck the [MIDI user guide](https://tiagocoutinho.github.io/linuxpy/user_guide/midi/) and\n[MIDI reference](https://tiagocoutinho.github.io/linuxpy/api/midi/) for more information.\n\n### Thermal and cooling\n\n```python\nfrom linuxpy.thermal import find\nwith find(type=\"x86_pkg_temp\") as tz:\n    print(f\"X86 temperature: {tz.temperature/1000:6.2f} C\")\n```\n\nCheck the [Thermal and cooling user guide](https://tiagocoutinho.github.io/linuxpy/user_guide/thermal/) and\n[Thermal and cooling reference](https://tiagocoutinho.github.io/linuxpy/api/thermal/) for more information.\n\n### Video\n\nVideo for Linux 2 (V4L2) python library\n\nWithout further ado:\n\n```python\n\u003e\u003e\u003e from linuxpy.video.device import Device\n\u003e\u003e\u003e with Device.from_id(0) as cam:\n\u003e\u003e\u003e     for i, frame in enumerate(cam):\n...         print(f\"frame #{i}: {len(frame)} bytes\")\n...         if i \u003e 9:\n...             break\n...\nframe #0: 54630 bytes\nframe #1: 50184 bytes\nframe #2: 44054 bytes\nframe #3: 42822 bytes\nframe #4: 42116 bytes\nframe #5: 41868 bytes\nframe #6: 41322 bytes\nframe #7: 40896 bytes\nframe #8: 40844 bytes\nframe #9: 40714 bytes\nframe #10: 40662 bytes\n```\n\nCheck the [V4L2 user guide](https://tiagocoutinho.github.io/linuxpy/user_guide/video/) and\n[V4L2 reference](https://tiagocoutinho.github.io/linuxpy/api/video/) for more information.\n\n[pypi-python-versions]: https://img.shields.io/pypi/pyversions/linuxpy.svg\n[pypi-version]: https://img.shields.io/pypi/v/linuxpy.svg\n[pypi-status]: https://img.shields.io/pypi/status/linuxpy.svg\n[license]: https://img.shields.io/pypi/l/linuxpy.svg\n[CI]: https://github.com/tiagocoutinho/linuxpy/actions/workflows/ci.yml/badge.svg\n[documentation]: https://img.shields.io/badge/Documentation-blue?color=grey\u0026logo=mdBook\n[source]: https://img.shields.io/badge/Source-grey?logo=git\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocoutinho%2Flinuxpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiagocoutinho%2Flinuxpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocoutinho%2Flinuxpy/lists"}