Skip to main content

A lightweight CLI tool for sharing files over a local network, inspired by LocalSend

Project description

PyLocalSend CLI

A lightweight Python command-line tool for sharing files over a local network, inspired by LocalSend.

Features

  • Interactive Shell — Persistent (pylocalsend) prompt for managing transfers without restarting
  • Auto Discovery — Automatically find other devices on the LAN via mDNS (Zeroconf)
  • File Transfer — Push files to or pull files from remote devices
  • Text Messaging — Send instant text messages to LAN devices
  • Transfer Progress — Real-time progress bar with speed display for large file transfers
  • Smart Networking — Automatically filters out VPN/Docker/TUN virtual interfaces and selects the real LAN IP; bypasses system proxy
  • Cross-Platform — Works on macOS, Ubuntu, and other Linux distributions

Project Structure

pylocalsend/
  __init__.py          # Package version
  cli.py               # Main program
pyproject.toml         # Package metadata and build config
requirements.txt       # Dependencies (for development)
LICENSE                # MIT License
README.md              # This file

Installation

Requires Python 3.7+.

From PyPI

pip install pylocalsend

With all optional dependencies:

pip install pylocalsend[all]

From Source

git clone https://github.com/guolei/pylocalsend.git
cd pylocalsend
pip install .

Or install in development mode:

pip install -e .

Dependencies

Package Required Purpose
requests Yes HTTP client for file transfer and messaging
zeroconf Optional mDNS device discovery (scan command); without it, you can still use IP addresses directly
netifaces Optional Accurate network interface enumeration and virtual adapter filtering; falls back to socket-based detection if not installed

Optional dependency groups:

pip install pylocalsend[discovery]    # + zeroconf
pip install pylocalsend[network]      # + netifaces
pip install pylocalsend[all]          # + zeroconf + netifaces

Usage

Starting

After installation, run on two machines within the same local network:

pylocalsend

Or run directly without installation:

python3 -m pylocalsend.cli

Optional arguments:

pylocalsend --dir ./shared_files --port 53317
Argument Default Description
--dir . (current directory) Directory for sharing and receiving files
--port 53317 Port to listen on

Commands

Once inside the (pylocalsend) prompt:

Command Description Example
scan Discover devices on the local network scan
list List shared files on a remote device list 1 or list 192.168.1.10
pull Download a file from a remote device pull report.pdf 1
push Push a file to a remote device push ./photo.jpg 1
msg Send a text message to a remote device msg 1 Hello!
ls List files in the local shared directory ls
setdir Change the local shared directory setdir ~/Downloads
status Show current IP, port, and shared directory status
help Show command help and examples help push
exit Exit the application (Ctrl+D also works) exit

The target in commands can be a device ID from scan results (e.g. 1) or a direct IP address.

Example Session

$ pylocalsend --dir ./shared
[*] Initializing PyLocalSend with shared directory: /home/user/shared
Welcome to PyLocalSend. Type help or ? to list commands.

(pylocalsend) scan
[+] Discovered devices:
  [1] MacBook-Pro (192.168.1.10)
  [2] Ubuntu-PC (192.168.1.20)

(pylocalsend) push ./report.pdf 1
[*] Pushing report.pdf (15.2MB) to 192.168.1.10...
  ██████████████████████████████ 100.0%  15.2MB/15.2MB  48.5MB/s
[+] Success!

(pylocalsend) msg 2 File sent, please check
[+] Message sent!

(pylocalsend) list 1
[*] Files on 192.168.1.10:
  - notes.txt
  - photo.jpg

(pylocalsend) pull notes.txt 1
[*] Pulling notes.txt from 192.168.1.10...
  ██████████████████████████████ 100.0%  2.3KB/2.3KB  1.1MB/s
[+] Downloaded to current directory.

Network Requirements

  • Both devices must be on the same local network
  • Firewall must allow TCP port 53317 (UDP 53317 for mDNS discovery)
  • AP isolation (client isolation) must be disabled on the router

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylocalsend-0.2.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylocalsend-0.2.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file pylocalsend-0.2.0.tar.gz.

File metadata

  • Download URL: pylocalsend-0.2.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for pylocalsend-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e10d57badc017f6eab680c6ebb9645793486a29e7f5bcde9f2a2da9987f7af6c
MD5 ca18de9aee29fc4a242f72c74aa54dd1
BLAKE2b-256 1897a2def3d5d50d3e2c2c23ff07e492081e3f1d192f9e29d628bf4cfbf82989

See more details on using hashes here.

File details

Details for the file pylocalsend-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pylocalsend-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for pylocalsend-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ab4c28d0f4f7a39de23945658ba73e83045521b7fbe7398bf7984cf036fe660
MD5 06dea527930053dd70d50920467b6304
BLAKE2b-256 194a66ad4595713813217eca20d9090fb58dd3d218e99351a6c908bad600ef20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page