Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.74k stars 445 forks source link

Create setup.py and fix building wheel #7935

Closed xoriole closed 3 months ago

xoriole commented 3 months ago

This PR is part of an effort to streamline binary creation for Tribler. It adds a setup.py script to build a Python wheel package. Here is how the wheel can be built and installed.

#!/bin/bash

# Install dependencies to build wheel
python3 -m pip install --upgrade setuptools wheel
python3 -m pip install build

# Run from tribler root directory where setup.py resides
# Clear out any existing wheels located on dist directory
rm -rf dist  

# Build the wheel package
python3 -m build

# Uninstall previously install tribler package if any
python3 -m pip uninstall -y tribler

# Install the newly built tribler package
python3 -m pip install dist/*.whl

# Run Tribler
python3 -m tribler.run

Note: setup.py has duplicated dependencies comparing with requirements.txt. It is left as it is. Initial thought to parse requirements.txt to retrieve the dependencies and set in setup.py but it seems it is not a recommended approach. Therefore, it is left unchanged.