{"id":17348132,"url":"https://github.com/userdocs/python-libtorrent-binding","last_synced_at":"2025-04-14T21:11:24.178Z","repository":{"id":56248117,"uuid":"246139940","full_name":"userdocs/python-libtorrent-binding","owner":"userdocs","description":"A build script for python-libtorrent bindings using current dependencies with minimal system footprint ","archived":false,"fork":false,"pushed_at":"2025-01-27T01:12:48.000Z","size":150,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T09:21:17.216Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/userdocs.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}},"created_at":"2020-03-09T20:53:50.000Z","updated_at":"2025-01-27T01:12:51.000Z","dependencies_parsed_at":"2023-01-23T15:45:58.212Z","dependency_job_id":null,"html_url":"https://github.com/userdocs/python-libtorrent-binding","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/userdocs%2Fpython-libtorrent-binding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/userdocs%2Fpython-libtorrent-binding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/userdocs%2Fpython-libtorrent-binding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/userdocs%2Fpython-libtorrent-binding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/userdocs","download_url":"https://codeload.github.com/userdocs/python-libtorrent-binding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961236,"owners_count":21189993,"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":[],"created_at":"2024-10-15T16:51:11.740Z","updated_at":"2025-04-14T21:11:24.157Z","avatar_url":"https://github.com/userdocs.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1525607f572c4b0384cd66cc366e041b)](https://app.codacy.com/gh/userdocs/python-libtorrent-binding?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=userdocs/python-libtorrent-binding\u0026utm_campaign=Badge_Grade)\n[![CodeFactor](https://www.codefactor.io/repository/github/userdocs/python-libtorrent-binding/badge)](https://www.codefactor.io/repository/github/userdocs/python-libtorrent-binding)\n\nThis is a build script to create, and optionally install, `libtorrent.so` statically linked against `openssl`, libtorrent `1.1`, `1.2` or `2.0` and `boost-python`. `wolfssl` is available as an alternative to `openssl` when using libtorrent v2 onwards.\n\nThis makes setting up `Deluge` + `libtorrent` + `ltconfig 2` an automated and reasonably quick installation by copy and pasting a few commands.\n\nBased on these docs:\n\n\u003chttp://www.libtorrent.org/building.html\u003e\n\n\u003chttp://www.libtorrent.org/python_binding.html\u003e\n\n## Build script usage\n\n-   The script will install the required dependencies when run as a root or using a docker image.\n-   You can setup the build environment as root and then use the build function as a local user.\n-   The script is designed to work with a docker image/container and works with [docker rootless](https://docs.docker.com/engine/security/rootless/)\n\nThere are three stages to the script depending on what requirements it detects.\n\n-   It will update the system and require a reboot to proceed, if required.\n-   If no reboot is required it will continue to install the build environment dependencies and exit unless a module was passed as an argument.\n-   If the run using a module argument like `all` it will start building `libtorrent-python-binding` or the specified module using `python3`.\n\n## Help options\n\nThe script tries to be automated and helpful but here are the help options to guide you.\n\n```none\nHere are a list of available options\n\n Use: -b  or --build-directory   Help: -h-b  or --help-build-directory\n Use: -c  or --crypto            Help: -h-c  or --help-crypto\n Use: -n  or --no-delete         Help: -h-n  or --help-no-delete\n Use: -lm or --libtorrent-master Help: -h-lm or --help-libtorrent-master\n Use: -lt or --libtorrent-tag    Help: -h-lt or --help-libtorrent-tag\n Use: -p  or --proxy             Help: -h-p  or --help-proxy\n Use: -tb or --test-build        Help: -h-tb or --help-test-build\n Use: -s  or --scope             Help: -h-s  or --help-scope\n\nModule specific help - flags are used with the modules listed here.\n\nUse: all or module-name         Usage: ~/libtorrent-python.bash all\n\nHere are a list of dependency specific modules\n\n update --------- update host - apt/apk update\n install -------- Install dependencies\n bootstrap ------ update and install combined\n install_deluge - pip install deluge\n\nHere are a list of build specific modules\n\n all ---------- Install all modules - openssl boost libtorrent\n openssl ------ Install the openssl module (default)\n wolfssl ------ Install the wolf module (Libtorrent v2 only)\n boost -------- Download, extract and bootstrap the boost build files\n libtorrent --- Build the libtorrent python binding\n```\n\n## Installation unified\n\n`libtorrent-python.bash` us works on modern Alpine or Debian based hosts.\n\n```bash\ncurl -sLO https://raw.githubusercontent.com/userdocs/python-libtorrent-binding/refs/heads/master/libtorrent-python.bash\nchmod +x libtorrent-python.bash\n./libtorrent-python.bash\n```\n\nThere are two ways to use the script\n\n-   With a docker image for the relevant platform.\n-   Run directly on the system where you want to build the binding.\n\n### Debian or Ubuntu\n\nUsing Docker\n\n-   Port `8112` for deluge installation.\n-   Built to `$HOME/bindings`\n\n#### All in one Ubuntu/Debian docker command\n\n**Note:** This command can be configured using flags top provide a specific outcome. Change `ubuntu:20.04` to `debian:stable` to use Debian.\n\n```bash\ndocker run -it -p 8112:8112 -v $HOME/bindings:/root ubuntu:latest /bin/bash -c 'cd \u0026\u0026 apt-get update \u0026\u0026 apt-get install -y curl git \u0026\u0026 curl -sL git.io/gplibtorrent | bash -s all \u0026\u0026 bash'\n```\n\n#### Optional - Setup Ubuntu/Debian Docker fist\n\nOptionally you could create and configure the docker first and then use the script from within the container.\n\n```bash\ndocker run -it -p 8112:8112 -v $HOME/bindings:/root ubuntu:latest /bin/bash -c 'cd \u0026\u0026 apt-get update \u0026\u0026 apt-get install -y curl git \u0026\u0026 bash'\n```\n\n#### Optional - Download and run inside Ubuntu/Debian docker\n\nNow you can call commands from within the docker container.\n\n```bash\ncurl -sL git.io/gplibtorrent | bash -s all\n```\n\n**Note:** You can modify this part `bash -s all` in either method to customise the behaviour of the command. Refer to the help section above.\n\n#### Using glibc script\n\n**Note:** You can do this from within a docker container as well.\n\n```bash\nwget -qO ~/libtorrent-python-binding.sh https://git.io/gplibtorrent\nchmod 700 ~/libtorrent-python-binding.sh\n~/libtorrent-python-binding.sh\n```\n\n### Alpine\n\nUsing Docker\n\n-   Port `8112` for deluge installation.\n-   Built to `$HOME/bindings`\n\n#### All in one Alpine docker command\n\n**Note:** This command can be configured using flags top provide a specific outcome.\n\n```bash\ndocker run -it -p 8112:8112 -v $HOME/bindings:/root alpine:latest /bin/ash -c 'cd \u0026\u0026 apk update \u0026\u0026 apk add bash curl git \u0026\u0026 curl -sL git.io/mplibtorrent | bash -s all \u0026\u0026 ash'\n```\n\n#### Optional - Setup Alpine Docker fist\n\nOptionally you could create and configure the docker first and then use the script from within the container.\n\n```bash\ndocker run -it -p 8112:8112 -v $HOME/bindings:/root alpine:latest /bin/ash -c 'cd \u0026\u0026 apk update \u0026\u0026 apk add bash curl git \u0026\u0026 ash'\n```\n\n#### Optional - Download and run inside Alpine docker\n\nNow you can call commands from within the docker container.\n\n```bash\ncurl -sL git.io/mplibtorrent | bash -s all\n```\n\n**Note:** You can modify this part `bash -s all` in either method to customise the behaviour of the command. Refer to the help section above.\n\n#### Using musl script\n\n**Note:** You can do this from within a docker container as well.\n\n```bash\nwget -qO ~/libtorrent-python-binding.sh https://git.io/mplibtorrent\nchmod 700 ~/libtorrent-python-binding.sh\n~/libtorrent-python-binding.sh\n```\n\n### Some configuration examples\n\n`all` - Install defaults `openssl` \u003e `boost` \u003e `libtorrent` using `v1.2.*` latest version\n\n`all pv 2 -lt libtorrent-1_1_14` - Install `openssl` \u003e `boost` \u003e `libtorrent` using the release `1.1.14` built with `python2`\n\n`all -lm` - Install defaults `openssl` \u003e `boost` \u003e `libtorrent` `RC_1_2` main branch\n\n`all -lt RC_2_0` - Install defaults `openssl` \u003e `boost` \u003e `libtorrent` using the `RC_2_0` main branch\n\n`all pv 2 -lt RC_2_0` - Install defaults `openssl` \u003e `boost` \u003e `libtorrent` using the `RC_2_0` main branch built `python2`\n\n`all -c wolfssl -lt v2.0.1` - Install `wolfssl` \u003e `boost` \u003e `libtorrent` using the release `v2.0.1` built with `python3`\n\n`all pv 2 -c wolfssl -lt v2.0.1` - Install `wolfssl` \u003e `boost` \u003e `libtorrent` using the release `v2.0.1` built with `python2`\n\n## Post build\n\nOnce the script is finished the required files will be built\n\n`~/libtorrent-python/completed`\n\nYou can install deluge by using the command:\n\n```bash\n~/libtorrent-python-binding.sh install\n```\n\nIt will install to the `~/.local` directory of the user running the script.\n\n**Note:** This script does not attempt to configure deluge.\n\n### Tuning\n\nhttps://forum.deluge-torrent.org/viewtopic.php?t=56921\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuserdocs%2Fpython-libtorrent-binding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuserdocs%2Fpython-libtorrent-binding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuserdocs%2Fpython-libtorrent-binding/lists"}