| Goal | What It Means for You | |------|-----------------------| | | A clean, well‑documented API that can be learned in a few hours. | | Modularity | Plug‑and‑play components (tracker client, DHT, piece picker, storage backend). | | Performance | Asynchronous I/O via asyncio and optional Cython‑accelerated hashing. | | Safety | Built‑in support for encrypted connections (MSE/PE) and sandboxed file handling. | | Extensibility | Hooks for custom piece selection, bandwidth throttling, and analytics. | Why “Lick”? The name is a playful nod to “licking” the data off the network—quick, clean, and a little bit tasty. It’s also short enough to be a memorable import: import lick . 2️⃣ When Should You Use Lick? | Use‑Case | How Lick Helps | |----------|----------------| | File Sync Across Devices | Leverage BitTorrent’s “swarm” model to distribute changes without a central server. | | Large‑Scale Data Sharing for Research | Publish a .torrent file for a dataset; collaborators download from each other, reducing bandwidth spikes on the host. | | Offline Content Delivery | Pre‑seed a torrent on a local network (e.g., in a conference or classroom) and let participants pull files without internet access. | | Hybrid Cloud‑Edge Architecture | Use Lick on edge nodes to pull updates from a central seed, then serve downstream devices via the same swarm. | | Building a Custom Torrent Client | Use Lick as the engine while you design a UI, a CLI, or an embedded device firmware. | Not a Silver Bullet – If your use‑case requires guaranteed delivery, low latency, or strict ACLs, consider HTTP/HTTPS or dedicated file‑transfer services instead. Torrents excel at bandwidth‑efficient distribution where redundancy and scalability matter more than instant start‑up. 3️⃣ Quick‑Start Guide (Python 3.9+) Below is a minimal, legal example that shows how to seed and download a public‑domain file. Replace the URLs with your own .torrent files when you’re ready to experiment. ⚠️ Legal Reminder: Only share or download content you have the right to distribute. Use Lick for open‑source software, public‑domain media, your own backups, or any other legally permissible material. 3.1 Install the Library pip install lick-torrent 3.2 Create a Simple Seeder # seeder.py import asyncio from lick import TorrentSeeder
print(f"Seeding on seeder.infohash – Press Ctrl‑C to stop.") try: await asyncio.Event().wait() # run forever finally: await seeder.stop() lick library torrent
print("\n✅ Download complete!") await downloader.stop() | Goal | What It Means for You
from lick.piece import SequentialPicker downloader = TorrentDownloader(torrent_path, piece_picker=SequentialPicker()) from lick.throttle import TokenBucket downloader.throttle = TokenBucket(rate=500_000) # 500 KB/s 4.3 Encrypted Peer Connections Lick enables MSE by default, but you can enforce it: | | Safety | Built‑in support for encrypted
print("Downloading…") async for progress in downloader.progress(): pct = progress.percent_complete * 100 print(f"\rpct:.2f% (progress.downloaded / 1e6:.2f MiB)", end="")
async def main(): # Path to the folder you want to share shared_dir = "/path/to/your/public-domain-collection"
async def main(): # Either load a .torrent file or provide a magnet URI torrent_path = "public-domain-collection.torrent"