{"id":13529275,"url":"https://github.com/oaubert/python-vlc","last_synced_at":"2025-09-07T14:55:13.714Z","repository":{"id":21012936,"uuid":"24303649","full_name":"oaubert/python-vlc","owner":"oaubert","description":"Python vlc bindings","archived":false,"fork":false,"pushed_at":"2025-06-09T15:37:09.000Z","size":5043,"stargazers_count":415,"open_issues_count":86,"forks_count":110,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-06-09T16:37:04.694Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oaubert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-09-21T20:58:01.000Z","updated_at":"2025-06-09T15:37:12.000Z","dependencies_parsed_at":"2025-04-01T15:47:29.756Z","dependency_job_id":null,"html_url":"https://github.com/oaubert/python-vlc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/oaubert/python-vlc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oaubert%2Fpython-vlc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oaubert%2Fpython-vlc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oaubert%2Fpython-vlc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oaubert%2Fpython-vlc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oaubert","download_url":"https://codeload.github.com/oaubert/python-vlc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oaubert%2Fpython-vlc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274051961,"owners_count":25214030,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-01T07:00:34.986Z","updated_at":"2025-09-07T14:55:13.704Z","avatar_url":"https://github.com/oaubert.png","language":"Python","funding_links":[],"categories":["Bindings"],"sub_categories":[],"readme":"# Python ctypes-based bindings generator for libvlc\n\n![](https://img.shields.io/github/actions/workflow/status/oaubert/python-vlc/tests.yml?event=push\u0026label=tests)\n[![](https://readthedocs.org/projects/python-vlc/badge/)](https://python-vlc.readthedocs.org/)\n[![Join the chat at https://discord.gg/3h3K3JF](https://img.shields.io/discord/716939396464508958?label=discord)](https://discord.gg/3h3K3JF)\n\nThis file documents the bindings generator, not the bindings\nthemselves. For the bindings documentation, see the\n[README.module](README.module) file.\n\nThe bindings generator generates ctypes-bindings from the include\nfiles defining the public API. The same generated module should be\ncompatible with various versions of libvlc 2.\\* and 3.\\*. However, there\nmay be incompatible changes between major versions. Versioned bindings\nfor 2.2 and 3.0 are provided in the repository.\n\n## License\n\nThe module generator is licensed under the GNU General Public License\nversion 2 or later. The generated module is licensed, like libvlc,\nunder the GNU Lesser General Public License 2.1 or later.\n\n## Development\n\nYou can get the latest version of the code generator from\n\u003chttps://github.com/oaubert/python-vlc/\u003e or\n\u003chttps://git.videolan.org/?p=vlc/bindings/python.git\u003e.\n\nThe code expects to be placed inside a VLC source tree, in\nvlc/bindings/python, so that it finds the development include files,\nor to find the installed include files in /usr/include (on Debian,\ninstall libvlc-dev).\n\nOnce you have cloned the project, you can run\n\n```\npython3 dev_setup.sh\n```\n\nfrom the root directory (or the python version if on a platform without shell)\n\nThis script will install everything that is needed (submodules,\nvirtual environment, treesitter, packages, etc.) for you to generate\nthe bindings.  Then, activate the virtual environment:\n\n- On Linux with Bash:\n  ```\n  . .venv/bin/activate\n  ```\n- On Windows with Powershell:\n  ```\n  .\\.venv\\Scripts\\Activate.ps1\n  ```\n\nSee https://docs.python.org/3/library/venv.html#how-venvs-work for other os-shell combinations.\n\nTo generate the vlc.py module and its documentation, for both the\ndevelopment version and the installed VLC version, use `make`.\n\nThe Makefile tries to convert files from either `../../include/vlc`\n(i.e. if the code is placed as a `bindings/pyton` in the VLC source\ntree) or `/usr/include/vlc`.\n\nFor running tests, use `make test`.\nNote that you need vlc installed because some tests require the\nlibvlc's dynamic library to be present on the system.\n\nIf you want to generate the bindings from an installed version of the\nVLC includes (which are expected to be in /usr/include/vlc), use the\n'installed' target: `make installed`.\n\nSee more recipes in the Makefile.\n\nTo install python-vlc for development purposes (add a symlink to your Python\nlibrary) simply do\n\n```\npython setup.py develop\n```\n\npreferably inside a virtualenv. You can uninstall it later with\n\n```\npython setup.py develop --uninstall\n```\n\nDocumentation building needs sphinx. An online build is available at\n\u003chttps://python-vlc.readthedocs.io/en/latest/\u003e\n\n## Packaging\n\nThe generated module version number is built from the VLC version\nnumber and the generator version number:\n\nvlc_major.vlc_minor.(1000 * vlc_micro + 100 * generator_major + generator_minor)\n\nso that it shared it major.minor with the corresponding VLC.\n\nTo generate the reference PyPI module (including setup.py, examples\nand metadata files), use\n\n```\nmake dist\n```\n\n## Architecture\n\nFirst of all, the bindings generator is in generator/generate.py.\n\nIt really is the conjunction of two things:\n\n1. A **parser** of C header files (those of libvlc): that is the class `Parser`.\n1. A **generator** of Python bindings: that is the class `PythonGenerator`.\n\n`Parser` parses libvlc's headers and produces a kind of AST where nodes are\ninstances of either `Struct`, `Union`, `Func`, `Par`, `Enum` or `Val`.\nThe information kept is what is necessary for `PythonGenerator` to then produce\nthe bindings.\n\nUntil version 2 of the bindings generator, parsing was regex-based.\nIt worked pretty well thanks to the consistent coding style of libvlc.\nHowever, it remained rather fragile.\n\nSince version 2, parsing is done using [Tree-sitter](https://tree-sitter.github.io/tree-sitter/).\nMore specifically, we use the [C Tree-sitter grammar](https://github.com/tree-sitter/tree-sitter-c)\nand [Tree-sitter's Python bindings](https://github.com/tree-sitter/py-tree-sitter).\nIt offers a more complete and robust parsing of C code.\nThe job of `Parser` is thus to transform the AST[^1] produced by Tree-sitter into an \"AST\"\nunderstandable by the generator.\n\n## LibVLC Discord\n\n[![Join the chat at https://discord.gg/3h3K3JF](https://img.shields.io/discord/716939396464508958?label=discord)](https://discord.gg/3h3K3JF)\n\npython-vlc is part of the LibVLC Discord Community server. Feel free to come say hi!\n\n## How to contribute\n\nContributions such as:\n\n- reporting and fixing bugs,\n- contributing unit tests\n- contributing examples\n\nare welcome!\n\n[^1]: To be exact, it produces a CST: Concrete Syntax Tree.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foaubert%2Fpython-vlc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foaubert%2Fpython-vlc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foaubert%2Fpython-vlc/lists"}