Skip to content

Commit 949e9d2

Browse files
committed
feat: implement macOS internet speed test application with logging and history features
1 parent 79ccb5d commit 949e9d2

16 files changed

+1125
-374
lines changed

.pylintrc

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,59 @@
1+
[MASTER]
2+
# Python version to use for features
3+
py-version=3.8
4+
5+
# Specify a score threshold to be exceeded before program exits with error.
6+
fail-under=7.0
7+
18
[MESSAGES CONTROL]
2-
disable=C0114, W0718, W0613, E0401, E1101
9+
# Disable the following pylint messages
10+
disable=
11+
C0114, # missing-module-docstring
12+
C0115, # missing-class-docstring
13+
C0116, # missing-function-docstring
14+
W0718, # broad-exception-caught
15+
W0613, # unused-argument
16+
E0401, # import-error
17+
E1101, # no-member
18+
R0903, # too-few-public-methods
19+
R0914, # too-many-locals
20+
R0913, # too-many-arguments
21+
R0915, # too-many-statements
22+
W0703, # broad-except
23+
24+
[FORMAT]
25+
# Maximum number of characters on a single line.
26+
max-line-length=100
27+
28+
[DESIGN]
29+
# Maximum number of arguments for function / method
30+
max-args=8
31+
32+
# Minimum number of public methods for a class
33+
min-public-methods=1
34+
35+
# Maximum number of public methods for a class
36+
max-public-methods=20
37+
38+
[SIMILARITIES]
39+
# Minimum lines number of a similarity.
40+
min-similarity-lines=6
41+
42+
# Ignore imports when computing similarities.
43+
ignore-imports=yes
44+
45+
[TYPECHECK]
46+
# List of module names for which member attributes should not be checked
47+
ignored-modules=
48+
matplotlib,
49+
tkinter
50+
51+
[REPORTS]
52+
# Set the output format.
53+
output-format=text
54+
55+
# Tells whether to display a full report or only the messages
56+
reports=yes
57+
58+
# Python expression which should return a note less than 10
59+
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)

README.md

Lines changed: 89 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@
44
`macOS_application_speedtest_for_python` is a macOS application designed to test your internet connection
55
speed using Python. The program provides a convenient interface for measuring download, upload, and ping speeds,
66
and also supports retesting and viewing test history.
7-
The project is built based on another one of my applications, which you can check out on GitHub:
7+
8+
This project is built based on another one of my applications, which you can check out on GitHub:
89
[Internet Speed Test](https://github.com/AlexTkDev/different_mini-apps/tree/main/check_internrt_speed)
910

11+
### What's New in Version 2.0.1
12+
- Added comprehensive logging system for better debugging
13+
- Improved error handling throughout the application
14+
- Enhanced visualization of test history with interactive graphs
15+
- Added export functionality for test history data
16+
- Better network adapter information collection
17+
- Improved progress reporting during tests
18+
- Added unit tests for core functionality
19+
- Reorganized project structure for better maintainability
20+
1021
### Installation
1122

1223
#### System Requirements
@@ -20,38 +31,79 @@ To install the dependencies, execute the following commands:
2031
```bash
2132
# Clone repository
2233
git clone https://github.com/AlexTkDev/macOS_application_speedtest_for_python.git
34+
cd macOS_application_speedtest_for_python
35+
36+
# Method 1: Using requirements.txt
2337
# Create a virtual environment (recommended)
2438
python -m venv .venv
2539
source .venv/bin/activate
2640
# Install dependencies
2741
pip install -r requirements.txt
42+
43+
# Method 2: Installing as a package (development mode)
44+
pip install -e .
2845
```
2946

3047
### Usage
3148
After installation, you can run the application by executing:
3249
```bash
50+
# If installed using requirements.txt
3351
python alexs_speedtest.py
52+
53+
# If installed as a package
54+
python -m speedtest_app
3455
```
3556

3657
#### Features
3758
- **Internet Speed Measurement**: The app allows you to test download and upload speeds, as well as ping (latency) of your internet connection.
3859
- **Graphical Display**: After completing a test, users can view the test results and optionally plot the test history.
60+
- **Interactive Graphs**: View your speed test history as interactive graphs with the ability to zoom and navigate.
61+
- **Export Data**: Export your test history to CSV format for further analysis.
62+
- **Detailed Network Information**: View comprehensive information about your network adapters.
3963
- **Repeat Test**: After a test is completed, users can repeat the test without needing to restart the application.
40-
- **Test History**: The app saves the results of previous tests, allowing users to view the test history and visualize changes in speed.
64+
- **Logging System**: The application now logs all activities to help with troubleshooting.
4165

4266
#### Key Components
4367
- **Tkinter**: Used for creating the graphical user interface (GUI), which includes buttons for starting tests, viewing results, and plotting graphs.
4468
- **Speedtest-cli**: A library for performing internet speed tests, which powers the app's functionality.
45-
- **Matplotlib**: A library for visualizing the test history by plotting graphs.
69+
- **Matplotlib**: A library for visualizing the test history by plotting interactive graphs.
4670
- **JSON**: A library for reading and writing test results stored in JSON format.
71+
- **Logging**: Python's built-in logging module for tracking application behavior.
72+
- **Psutil**: For retrieving system and network adapter information.
73+
74+
#### Project Structure
75+
```
76+
macOS_application_speedtest_for_python/
77+
├── speedtest_app/ # Main package
78+
│ ├── __init__.py # Package initialization
79+
│ ├── alexs_speedtest.py # Main application module
80+
│ ├── network_adapter_information.py # Network info module
81+
│ ├── test_history.py # History management module
82+
│ ├── gui/ # GUI components
83+
│ │ └── __init__.py
84+
│ ├── utils/ # Utility functions
85+
│ │ └── __init__.py
86+
│ └── tests/ # Unit tests
87+
│ ├── __init__.py
88+
│ ├── test_network_adapter.py
89+
│ └── test_test_history.py
90+
├── main.py # Entry point script
91+
├── setup.py # Installation script
92+
├── requirements.txt # Dependencies
93+
├── .pylintrc # Pylint configuration
94+
├── .github/workflows/ # GitHub Actions configuration
95+
│ └── pylint.yml
96+
├── LICENSE # MIT License
97+
└── README.md # This documentation
98+
```
4799

48100
#### How It Works
49101
1. When the app is launched, users can click the **"Start Speed Test"** button to initiate the test.
50-
2. The app runs a speed test using the **speedtest-cli** library, measuring download speed, upload speed, and ping.
102+
2. The app first finds the best server, then runs a speed test using the **speedtest-cli** library, measuring download speed, upload speed, and ping.
51103
3. Once the test is completed, the results are displayed in the app's interface.
52-
4. Users can save the test results to the **history.json** file and visualize the data using **matplotlib**.
104+
4. Users can save the test results to the **history.json** file and visualize the data using **matplotlib**'s interactive graphs.
53105
5. For a repeat test, users can simply click the **"Repeat Speed Test"** button, which hides the history buttons until the new test is finished.
54-
106+
6. All application activities are logged to a file in the user's Documents folder for troubleshooting.
55107

56108
#### Building the Application
57109
To build the application in `.app` format, run the following command:
@@ -61,8 +113,19 @@ pyinstaller main.spec
61113
After building, the application will be located in the `dist` directory, and you can launch it by double-clicking the icon.
62114

63115
### Configuration
64-
The project include a `alexs_speedtest.py` file, where you can find settings such as
65-
parameters for speed testing. Feel free to modify these parameters according to your needs.
116+
The project includes several configuration files:
117+
- `.pylintrc`: Contains settings for the Pylint code analysis tool
118+
- `main.spec`: Configuration for PyInstaller to build the macOS application
119+
120+
### Running Tests
121+
The project includes unit tests to ensure functionality. To run the tests:
122+
```bash
123+
# Run all tests
124+
python -m unittest discover
125+
126+
# Run specific test module
127+
python -m unittest speedtest_app.tests.test_network_adapter
128+
```
66129

67130
### License
68131
This project is licensed under the MIT License. Please refer to the `LICENSE` file for more detailed information.
@@ -72,26 +135,39 @@ This project uses **Pylint** for static code analysis to ensure that code adhere
72135
best practices and follows PEP 8 style guidelines. Pylint checks for errors, potential issues,
73136
and enforces consistent coding style, making it a valuable tool for maintaining code quality.
74137

75-
### How to Install Pylint
138+
#### How to Install Pylint
76139
To install Pylint, use the following command in your terminal:
77140
```bash
78141
pip install pylint
79142
```
80-
### Running Pylint
143+
144+
#### Running Pylint
81145
Once installed, you can run Pylint on a specific Python file with:
82146
```bash
83147
pylint your_file.py
84148
```
85149
Or, to analyze all Python files in the project, run:
86150
```bash
87-
pylint *.py
151+
pylint speedtest_app/*.py
88152
```
89153
This setup is also configured to run automatically within GitHub Actions on every code push,
90154
checking the code with multiple Python versions for compatibility.
91155

92156
### Contribution
93157
If you would like to contribute to the project, please create a fork of the repository and submit a Pull Request with your changes.
94158

95-
### Contact
96-
For questions or suggestions, you can reach out to me via [GitHub](https://github.com/AlexTkDev).
159+
#### Contribution Guidelines
160+
1. Fork the repository
161+
2. Create a feature branch (`git checkout -b feature/your-feature-name`)
162+
3. Commit your changes (`git commit -am 'Add some feature'`)
163+
4. Push to the branch (`git push origin feature/your-feature-name`)
164+
5. Create a new Pull Request
97165

166+
### Troubleshooting
167+
If you encounter issues with the application, check the log file located in:
168+
```
169+
~/Documents/SpeedTest_Logs/speedtest_log.log
170+
```
171+
172+
### Contact
173+
For questions or suggestions, you can reach out to me via [GitHub](https://github.com/AlexTkDev).

0 commit comments

Comments
 (0)