{"id":13897343,"url":"https://github.com/borzunov/bit-torrent","last_synced_at":"2025-09-02T06:32:38.821Z","repository":{"id":45168126,"uuid":"53327149","full_name":"borzunov/bit-torrent","owner":"borzunov","description":"📁 🌎  BitTorrent client built with Python + asyncio","archived":false,"fork":false,"pushed_at":"2023-07-20T15:09:07.000Z","size":500,"stargazers_count":159,"open_issues_count":2,"forks_count":29,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-07T05:41:59.544Z","etag":null,"topics":["asyncio","bittorrent","python","qt","torrent"],"latest_commit_sha":null,"homepage":"","language":"Python","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/borzunov.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":"2016-03-07T13:20:55.000Z","updated_at":"2025-03-17T09:55:40.000Z","dependencies_parsed_at":"2024-10-23T02:49:10.995Z","dependency_job_id":null,"html_url":"https://github.com/borzunov/bit-torrent","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/borzunov/bit-torrent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borzunov%2Fbit-torrent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borzunov%2Fbit-torrent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borzunov%2Fbit-torrent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borzunov%2Fbit-torrent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borzunov","download_url":"https://codeload.github.com/borzunov/bit-torrent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borzunov%2Fbit-torrent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273244301,"owners_count":25070958,"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-02T02:00:09.530Z","response_time":77,"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":["asyncio","bittorrent","python","qt","torrent"],"created_at":"2024-08-06T18:03:32.009Z","updated_at":"2025-09-02T06:32:38.514Z","avatar_url":"https://github.com/borzunov.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"bit-torrent\n===========\n\nSimple BitTorrent client built with Python's asyncio\n\n![Main window screenshot](screenshot.png)\n\nFeatures\n--------\n\n* Downloading torrents and sharing received data\n* Graphical interface (supports Drag'n'Drop and can be assigned to *.torrent files in system \"Open with...\" dialog)\n* Console interface\n* Pausing torrents, watching progress, download and upload speed, ETA\n* Selecting which files in a torrent you want to download\n* Saving state between program restarts\n\nImplemented specifications:\n\n* The BitTorrent Protocol Specification ([BEP 0003][] with some additions from [the community spec][])\n* Multitracker Metadata Extension ([BEP 0012][])\n* *(partially)* UDP Tracker Protocol ([BEP 0015][])\n* Tracker Returns Compact Peer Lists ([BEP 0023][])\n\n[BEP 0003]: http://www.bittorrent.org/beps/bep_0003.html\n[the community spec]: https://wiki.theory.org/BitTorrentSpecification\n[BEP 0012]: http://www.bittorrent.org/beps/bep_0012.html\n[BEP 0015]: http://www.bittorrent.org/beps/bep_0015.html\n[BEP 0023]: http://www.bittorrent.org/beps/bep_0023.html\n\nArchitecture\n------------\n\nIn this project, I tried to avoid threads and use only asynchronous I/O. As a result, all algorithms and network interaction work in one thread running an asyncio event loop, but there are still a few additional threads:\n\n* Non-blocking disk I/O [isn't supported][asyncio-fs] by asyncio. To prevent freezes for up to a second\nduring disk writing, blocking I/O runs in a [ThreadPoolExecutor][].\n* PyQt GUI runs in the main thread and invokes an asyncio event loop in a separate [QThread][]. Another option is\nto use a Qt event loop in asyncio with [quamash][], but this increases UI reaction time, and the Qt event loop\nmay be less efficient than asyncio's default one.\n\n[asyncio-fs]: https://github.com/python/asyncio/wiki/ThirdParty#filesystem\n[ThreadPoolExecutor]: https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ThreadPoolExecutor\n[QThread]: https://doc.qt.io/qt-5/qthread.html\n[quamash]: https://github.com/harvimt/quamash\n\nProgram sources depend on Python 3.5+ features: they are annotated with type hints ([PEP 0484][]) and\nuse coroutines with `async`/`await` syntax ([PEP 0492][]).\n\n[PEP 0484]: https://www.python.org/dev/peps/pep-0484/\n[PEP 0492]: https://www.python.org/dev/peps/pep-0492/\n\nInstallation\n------------\n\nThe program requires Python 3.5+ and works on Linux, macOS, and Windows. You also need PyQt 5 to run GUI.\n\nOn Ubuntu 16.04 or newer, run:\n\n```bash\nsudo apt-get install python3-pip python3-pyqt5\ngit clone https://github.com/borzunov/bit-torrent.git \u0026\u0026 cd bit-torrent\nsudo python3 -m pip install -r requirements.txt\n```\n\nOn macOS, run:\n\n```bash\npython3 -m pip install PyQt5\ngit clone https://github.com/borzunov/bit-torrent.git \u0026\u0026 cd bit-torrent\npython3 -m pip install -r requirements.txt\n```\n\nUsage\n-----\n\n### Graphical interface\n\nRun:\n\n    python3 torrent_gui.py\n\nIf torrent files are provided as command line arguments, corresponding adding dialogs will be opened.\n\n### Console interface\n\n1. Start a daemon:\n\n        ./torrent_cli.py start \u0026\n\n2. *(optional)* Look at a list of files in a torrent you want to download:\n\n        ./torrent_cli.py show ./examples/debian-11.2.0-amd64-netinst.iso.torrent\n\n3. Specify a download directory and add the torrent to the daemon:\n\n        ./torrent_cli.py add ./examples/debian-11.2.0-amd64-netinst.iso.torrent -d ./downloads\n\n    If the torrent contains more than one file, you can select which files you want to download\n    using `--include` and `--exclude` options. For more information run:\n\n        ./torrent_cli.py add --help\n\n4. Watch torrent status:\n\n        watch ./torrent_cli.py status\n\n    Add `-v` to increase output verbosity.\n\n    You also can add more torrents, pause, resume, and remove them. For more information run:\n\n        ./torrent_cli.py --help\n\n5. To stop the daemon run:\n\n        ./torrent_cli.py stop\n\n    The daemon will restore its state after restart.\n\n### Debug mode\n\nYou can enable a verbose debug mode for GUI and CLI daemons by adding `--debug` flag after the script name.\n\nYou may also want to enable asyncio debug mode. This is done as follows:\n\n    PYTHONASYNCIODEBUG=1 python3 -Wdefault torrent_gui.py --debug\n\nAuthor\n------\n\nCopyright \u0026copy; 2016-2017 Alexander Borzunov\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborzunov%2Fbit-torrent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborzunov%2Fbit-torrent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborzunov%2Fbit-torrent/lists"}