66
77LanCalc is a desktop application built with PyQt5, designed to calculate network configurations for Windows, macOS, and Linux systems.
88
9- ![ image] ( https://github.com/user-attachments/assets/be7655cc-9348-4d7c-bb25-a650e00cc422 )
9+ ![ image] ( https://github.com/user-attachments/assets/a7d1779f-d138-4819-84c6-4df876efc292 )
1010
1111[ Download] ( https://github.com/lancalc/lancalc/releases )
1212
@@ -18,19 +18,44 @@ Support IPv4 address formats, subnet masks and prefixes. This tool is particular
1818
1919### Installation
2020
21- ** Install LanCalc Stable version:**
21+ Python 3.9+ is required.
22+
23+ - Default (with GUI):
2224
2325``` bash
2426pip3 install lancalc
2527```
2628
27- ** Or install LanCalc from GitHub: **
29+ - CLI-only / headless (avoid installing PyQt5):
2830
2931``` bash
30- pip3 install git+https://github.com/lancalc/lancalc.git
32+ # Install package without dependencies, then only required CLI deps
33+ pip3 install --no-deps lancalc
34+ pip3 install -r requirements.txt
3135```
3236
33- Install PIP
37+ - Install without GUI dependencies:
38+
39+ ``` bash
40+ # Install with nogui extras (excludes PyQt5)
41+ pip3 install ' lancalc[nogui]'
42+ ```
43+
44+ - Install from GitHub:
45+
46+ ``` bash
47+ # With GUI (default)
48+ pip3 install ' git+https://github.com/lancalc/lancalc.git'
49+
50+ # CLI-only / headless
51+ pip3 install --no-deps ' git+https://github.com/lancalc/lancalc.git'
52+ pip3 install -r requirements.txt
53+
54+ # Without GUI dependencies
55+ pip3 install ' git+https://github.com/lancalc/lancalc.git#egg=lancalc[nogui]'
56+ ```
57+
58+ If pip is missing:
3459
3560``` bash
3661curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
@@ -50,16 +75,22 @@ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
5075source ~ /.bashrc
5176```
5277
78+ Notes:
79+ - On Linux, PyQt5 may require system Qt libraries (xcb plugin). If GUI fails to start, ensure a desktop environment is available and try installing system packages (e.g. Debian/Ubuntu: ` sudo apt install python3-pyqt5 ` ), or use the CLI-only steps above.
80+ - In CI/headless environments, prefer the CLI-only steps above to skip GUI dependencies.
81+
5382## Running the Application
5483
5584### GUI Mode
5685
57- After installation, launch the application with the command:
86+ After installation (default with GUI) , launch the application with the command:
5887
5988``` bash
6089lancalc
6190```
6291
92+ LanCalc auto-detects the environment. If GUI dependencies are unavailable or you are in a headless session, the launcher falls back to CLI help. In such cases, use the CLI examples below.
93+
6394### CLI Mode
6495
6596LanCalc also supports command-line interface for automation and scripting:
@@ -78,6 +109,12 @@ lancalc 192.168.1.100/31 # Point-to-point network
78109lancalc 192.168.1.1/32 # Single host
79110```
80111
112+ You can also run via module:
113+
114+ ``` bash
115+ python3 -m lancalc 192.168.1.1/24 --json
116+ ```
117+
81118### Output Format
82119
83120** Text mode** (default):
@@ -117,21 +154,34 @@ That's it! The application will start and automatically detect your current netw
117154
118155### Prerequisites
119156
120- Python 3.9+ is required.
157+ Python 3.9+ is required. GUI development requires PyQt5 (installed by default).
121158
122- For production use (CLI only):
159+ - Production (CLI only):
123160``` bash
124161pip3 install -r requirements.txt
125162```
126163
127- For GUI support :
164+ - Editable install with GUI (default) :
128165``` bash
129- pip3 install -e .[gui]
166+ pip3 install -e .
167+ ```
168+
169+ - Editable install without GUI:
170+ ``` bash
171+ pip3 install --no-deps -e .
172+ pip3 install -r requirements.txt
130173```
131174
132- For development :
175+ - Full dev setup (with GUI) :
133176``` bash
134- pip3 install -e .[dev,gui]
177+ pip3 install -e ' .[dev]'
178+ ```
179+
180+ - Dev without GUI:
181+ ``` bash
182+ pip3 install --no-deps -e .
183+ pip3 install -r requirements.txt
184+ pip3 install pytest pytest-qt pre-commit flake8
135185```
136186
137187### Installation for Development
@@ -145,7 +195,11 @@ git clone https://github.com/lancalc/lancalc.git
145195### Running from Source
146196
147197``` bash
198+ # GUI (requires PyQt5)
148199python3 lancalc/main.py
200+
201+ # CLI
202+ python3 -m lancalc 192.168.1.1/24
149203```
150204
151205### Development Tools
@@ -272,8 +326,95 @@ lancalc 224.0.0.1/4 --json
272326
273327The JSON output includes the following fields:
274328
275- - ** ` comment ` ** : Description and RFC reference for special ranges (empty for normal unicast addresses)
276329- ** ` comment ` ** : Description and RFC reference for special ranges (empty for normal unicast addresses)
277330- ** ` hosts ` ** : Number of available host addresses in the specified subnet
278331
279332These fields are always present, making the JSON output format consistent regardless of address type.
333+
334+ ## Usage
335+
336+ ### Command Line Interface
337+
338+ ``` bash
339+ # Basic subnet calculation
340+ lancalc 192.168.1.1/24
341+
342+ # JSON output
343+ lancalc 192.168.1.1/24 --json
344+
345+ # Show internal/private IP address
346+ lancalc --internal
347+ lancalc -i
348+
349+ # Show external/public IP address
350+ lancalc --external
351+ lancalc -e
352+
353+ # Use multiple info flags simultaneously
354+ lancalc -i -e
355+ lancalc -i -e --json
356+
357+ # Show version
358+ lancalc --version
359+ ```
360+
361+ ### Examples
362+
363+ ** Basic calculation:**
364+ ``` bash
365+ $ lancalc 192.168.1.1/24
366+ Network: 192.168.1.0
367+ Prefix: /24
368+ Netmask: 255.255.255.0
369+ Broadcast: 192.168.1.255
370+ Hostmin: 192.168.1.1
371+ Hostmax: 192.168.1.254
372+ Hosts: 254
373+ ```
374+
375+ ** JSON output:**
376+ ``` bash
377+ $ lancalc 192.168.1.1/24 --json
378+ {
379+ " network" : " 192.168.1.0" ,
380+ " prefix" : " /24" ,
381+ " netmask" : " 255.255.255.0" ,
382+ " broadcast" : " 192.168.1.255" ,
383+ " hostmin" : " 192.168.1.1" ,
384+ " hostmax" : " 192.168.1.254" ,
385+ " hosts" : " 254"
386+ }
387+ ```
388+
389+ ** Interface information:**
390+ ``` bash
391+ $ lancalc -i
392+ Address: 10.16.69.146
393+ Prefix: /24
394+
395+ $ lancalc -i --json
396+ {" address" : " 10.16.69.146" , " prefix" : " /24" }
397+ ```
398+
399+ ** External IP detection:**
400+ ``` bash
401+ $ lancalc -e
402+ External IP: 216.66.18.3
403+
404+ $ lancalc -e --json
405+ {" external_ip" : " 216.66.18.3" }
406+ ```
407+
408+ ** Multiple info flags:**
409+ ``` bash
410+ $ lancalc -i -e
411+ Address: 10.16.69.146
412+ Prefix: /24
413+
414+ External IP: 216.66.18.3
415+
416+ $ lancalc -i -e --json
417+ {" address" : " 10.16.69.146" , " prefix" : " /24" }
418+
419+ {" external_ip" : " 216.66.18.3" }
420+ ```
0 commit comments