|
2 | 2 | ## Documentation for macOS_application_speedtest_for_python |
3 | 3 |
|
4 | 4 | ### Project Description |
5 | | -`macOS_application_speedtest_for_python` is a macOS application designed to test your internet connection |
6 | | -speed using Python. The program provides a convenient interface for measuring download, upload, and ping speeds, |
7 | | -and also supports retesting and viewing test history. |
8 | | - |
9 | | -This project is built based on another one of my applications, which you can check out on GitHub: |
10 | | -[Internet Speed Test](https://github.com/AlexTkDev/different_mini-apps/tree/main/check_internrt_speed) |
11 | | - |
12 | | -### What's New in Version 3.0.0 |
13 | | -- Added comprehensive logging system for better debugging |
14 | | -- Improved error handling throughout the application |
15 | | -- Enhanced visualization of test history with interactive graphs |
16 | | -- Added export functionality for test history data |
17 | | -- Better network adapter information collection |
18 | | -- Improved progress reporting during tests |
19 | | -- Added unit tests for core functionality |
20 | | -- Reorganized project structure for better maintainability |
| 5 | +`macOS_application_speedtest_for_python` is a modern macOS application for testing your internet connection speed using Python. The app features a beautiful dark UI (ttkbootstrap), asynchronous and thread-based architecture for maximum responsiveness, and advanced UX with toast notifications and smooth progress animations. |
| 6 | + |
| 7 | +### What's New in Version 4.0.0 |
| 8 | +- Fully asynchronous and thread-based architecture: all heavy operations (speedtest, network info, plotting) run in background threads. |
| 9 | +- Modern, dark, and airy UI using ttkbootstrap. |
| 10 | +- Toast notifications for test completion and errors. |
| 11 | +- Smooth progress bar animations and non-blocking interface. |
| 12 | +- Improved error handling and logging. |
| 13 | +- Refactored codebase: all comments and docstrings in English, modular structure. |
| 14 | +- Enhanced test history and export features. |
| 15 | +- More robust PyInstaller build and troubleshooting section. |
21 | 16 |
|
22 | 17 | ### Installation |
23 | 18 |
|
24 | 19 | #### System Requirements |
25 | 20 | - macOS (version 10.14 or later) |
26 | | -- Python 3.6 or higher |
27 | | -- Installed dependencies listed in `requirements.txt` |
| 21 | +- Python 3.8 or higher (with Tkinter support) |
| 22 | +- All dependencies from `requirements.txt` |
28 | 23 |
|
29 | 24 | #### Installing Dependencies |
30 | | -To install the dependencies, execute the following commands: |
31 | | - |
32 | 25 | ```bash |
33 | 26 | # Clone repository |
34 | 27 | git clone https://github.com/AlexTkDev/macOS_application_speedtest_for_python.git |
35 | 28 | cd macOS_application_speedtest_for_python |
36 | | - |
37 | | -# Method 1: Using requirements.txt |
38 | | -# Create a virtual environment (recommended) |
39 | | -python -m venv .venv |
| 29 | +python3 -m venv .venv |
40 | 30 | source .venv/bin/activate |
41 | | -# Install dependencies |
42 | 31 | pip install -r requirements.txt |
43 | | - |
44 | | -# Method 2: Installing as a package (development mode) |
45 | | -pip install -e . |
46 | 32 | ``` |
47 | 33 |
|
48 | 34 | ### Usage |
49 | | -After installation, you can run the application by executing: |
| 35 | +Run the application: |
50 | 36 | ```bash |
51 | | -# If installed using requirements.txt |
52 | | -python alexs_speedtest.py |
53 | | - |
54 | | -# If installed as a package |
55 | | -python -m speedtest_app |
| 37 | +python main.py |
| 38 | +``` |
| 39 | +Or build the .app: |
| 40 | +```bash |
| 41 | +pyinstaller main.spec |
| 42 | +open dist/Alex_SpeedTest.app |
56 | 43 | ``` |
57 | 44 |
|
58 | 45 | #### Features |
59 | | -- **Internet Speed Measurement**: The app allows you to test download and upload speeds, as well as ping (latency) of your internet connection. |
60 | | -- **Graphical Display**: After completing a test, users can view the test results and optionally plot the test history. |
61 | | -- **Interactive Graphs**: View your speed test history as interactive graphs with the ability to zoom and navigate. |
62 | | -- **Export Data**: Export your test history to CSV format for further analysis. |
63 | | -- **Detailed Network Information**: View comprehensive information about your network adapters. |
64 | | -- **Repeat Test**: After a test is completed, users can repeat the test without needing to restart the application. |
65 | | -- **Logging System**: The application now logs all activities to help with troubleshooting. |
66 | | - |
67 | | -#### Key Components |
68 | | -- **Tkinter**: Used for creating the graphical user interface (GUI), which includes buttons for starting tests, viewing results, and plotting graphs. |
69 | | -- **Speedtest-cli**: A library for performing internet speed tests, which powers the app's functionality. |
70 | | -- **Matplotlib**: A library for visualizing the test history by plotting interactive graphs. |
71 | | -- **JSON**: A library for reading and writing test results stored in JSON format. |
72 | | -- **Logging**: Python's built-in logging module for tracking application behavior. |
73 | | -- **Psutil**: For retrieving system and network adapter information. |
| 46 | +- **Asynchronous Speed Test**: Download, upload, and ping tests run in a background thread. |
| 47 | +- **Modern Dark UI**: Built with ttkbootstrap for a beautiful, modern look. |
| 48 | +- **Toast Notifications**: Non-blocking popups for test completion and errors. |
| 49 | +- **Network Adapter Info**: Asynchronously fetches and displays active network adapter details. |
| 50 | +- **Interactive History & Graphs**: View and export your test history, plot interactive graphs. |
| 51 | +- **Export to CSV**: Export your test history for further analysis. |
| 52 | +- **Logging**: All actions are logged for troubleshooting. |
74 | 53 |
|
75 | 54 | #### Project Structure |
76 | 55 | ``` |
77 | 56 | macOS_application_speedtest_for_python/ |
78 | 57 | ├── speedtest_app/ # Main package |
79 | 58 | │ ├── __init__.py # Package initialization |
80 | | -│ ├── alexs_speedtest.py # Main application module |
81 | | -│ ├── network_adapter_information.py # Network info module |
82 | | -│ ├── test_history.py # History management module |
83 | | -│ ├── gui/ # GUI components |
| 59 | +│ ├── alexs_speedtest.py # Main application module (async, threads) |
| 60 | +│ ├── network_adapter_information.py # Async network info |
| 61 | +│ ├── test_history.py # Async history and plotting |
| 62 | +│ ├── gui/ # GUI components (ttkbootstrap) |
84 | 63 | │ │ └── __init__.py |
85 | 64 | │ ├── utils/ # Utility functions |
86 | 65 | │ │ └── __init__.py |
87 | 66 | │ └── tests/ # Unit tests |
88 | 67 | │ ├── __init__.py |
89 | 68 | │ ├── test_network_adapter.py |
90 | 69 | │ └── test_test_history.py |
91 | | -├── main.py # Entry point script |
92 | | -├── setup.py # Installation script |
| 70 | +├── main.py # Entry point |
| 71 | +├── main.spec # PyInstaller config |
93 | 72 | ├── requirements.txt # Dependencies |
94 | | -├── .pylintrc # Pylint configuration |
95 | | -├── .github/workflows/ # GitHub Actions configuration |
96 | | -│ └── pylint.yml |
97 | | -├── LICENSE # MIT License |
98 | | -├── README.md # This documentation |
99 | | -└── test_history.py # Test history file |
| 73 | +├── setup.py # Installation script |
| 74 | +├── README.md # This documentation |
100 | 75 | ``` |
101 | 76 |
|
102 | | -#### How It Works |
103 | | -1. When the app is launched, users can click the **"Start Speed Test"** button to initiate the test. |
104 | | -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. |
105 | | -3. Once the test is completed, the results are displayed in the app's interface. |
106 | | -4. Users can save the test results to the **history.json** file and visualize the data using **matplotlib**'s interactive graphs. |
107 | | -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. |
108 | | -6. All application activities are logged to a file in the user's Documents folder for troubleshooting. |
| 77 | +### How It Works |
| 78 | +1. Click **Start Speed Test** to run a speed test in a background thread. |
| 79 | +2. The app finds the best server, runs the test, and updates the UI with smooth progress. |
| 80 | +3. Results are shown instantly; you can repeat the test, view/export history, or plot interactive graphs. |
| 81 | +4. All network info and history operations are also asynchronous. |
| 82 | +5. Toast notifications inform you of completion or errors. |
109 | 83 |
|
110 | | -#### Building the Application |
111 | | -To build the application in `.app` format, run the following command: |
| 84 | +### Building the Application |
| 85 | +To build the application in `.app` format: |
112 | 86 | ```bash |
113 | 87 | pyinstaller main.spec |
114 | 88 | ``` |
115 | | -After building, the application will be located in the `dist` directory, and you can launch it by double-clicking the icon. |
116 | | - |
117 | | -### Configuration |
118 | | -The project includes several configuration files: |
119 | | -- `.pylintrc`: Contains settings for the Pylint code analysis tool |
120 | | -- `main.spec`: Configuration for PyInstaller to build the macOS application |
| 89 | +The `.app` will appear in the `dist` directory. |
| 90 | + |
| 91 | +#### Troubleshooting PyInstaller/macOS |
| 92 | +- If the app does not open, run the binary from terminal to see errors: |
| 93 | + ```bash |
| 94 | + dist/Alex_SpeedTest.app/Contents/MacOS/alexs_speedtest |
| 95 | + ``` |
| 96 | +- If you see `ModuleNotFoundError: No module named '_tkinter'`, ensure your Python has Tkinter support and rebuild the venv. |
| 97 | +- If macOS blocks the app, run: |
| 98 | + ```bash |
| 99 | + xattr -dr com.apple.quarantine dist/Alex_SpeedTest.app |
| 100 | + ``` |
| 101 | +- For other issues, check the log file in `~/Documents/SpeedTest_Logs/speedtest_log.log`. |
121 | 102 |
|
122 | 103 | ### Running Tests |
123 | | -The project includes unit tests to ensure functionality. To run the tests: |
124 | 104 | ```bash |
125 | | -# Run all tests |
126 | 105 | python -m unittest discover |
127 | | - |
128 | | -# Run specific test module |
129 | | -python -m unittest speedtest_app.tests.test_network_adapter |
130 | 106 | ``` |
131 | 107 |
|
132 | 108 | ### License |
133 | | -This project is licensed under the MIT License. Please refer to the `LICENSE` file for more detailed information. |
134 | | - |
135 | | -### Code Analysis with Pylint |
136 | | -This project uses **Pylint** for static code analysis to ensure that code adheres to Python's |
137 | | -best practices and follows PEP 8 style guidelines. Pylint checks for errors, potential issues, |
138 | | -and enforces consistent coding style, making it a valuable tool for maintaining code quality. |
| 109 | +MIT License. See `LICENSE` for details. |
139 | 110 |
|
140 | | -#### How to Install Pylint |
141 | | -To install Pylint, use the following command in your terminal: |
142 | | -```bash |
143 | | -pip install pylint |
144 | | -``` |
145 | | - |
146 | | -#### Running Pylint |
147 | | -Once installed, you can run Pylint on a specific Python file with: |
148 | | -```bash |
149 | | -pylint your_file.py |
150 | | -``` |
151 | | -Or, to analyze all Python files in the project, run: |
152 | | -```bash |
153 | | -pylint speedtest_app/*.py |
154 | | -``` |
155 | | -This setup is also configured to run automatically within GitHub Actions on every code push, |
156 | | -checking the code with multiple Python versions for compatibility. |
157 | | - |
158 | 111 | ### Contribution |
159 | | -If you would like to contribute to the project, please create a fork of the repository and submit a Pull Request with your changes. |
160 | | - |
161 | | -#### Contribution Guidelines |
162 | | -1. Fork the repository |
163 | | -2. Create a feature branch (`git checkout -b feature/your-feature-name`) |
164 | | -3. Commit your changes (`git commit -am 'Add some feature'`) |
165 | | -4. Push to the branch (`git push origin feature/your-feature-name`) |
166 | | -5. Create a new Pull Request |
167 | | - |
168 | | -### Troubleshooting |
169 | | -If you encounter issues with the application, check the log file located in: |
170 | | -``` |
171 | | -~/Documents/SpeedTest_Logs/speedtest_log.log |
172 | | -``` |
| 112 | +Pull requests are welcome! See CONTRIBUTING section in the old README for workflow. |
173 | 113 |
|
174 | 114 | ### Contact |
175 | | -For questions or suggestions, you can reach out to me via [GitHub](https://github.com/AlexTkDev). |
| 115 | +For questions or suggestions, reach out via [GitHub](https://github.com/AlexTkDev). |
0 commit comments