|
| 1 | +### On development stage. |
1 | 2 | ## Documentation for macOS_application_speedtest_for_python
|
2 | 3 |
|
3 | 4 | ### Project Description
|
4 |
| -`macOS_application_speedtest_for_python` is a macOS application designed to test your internet connection |
5 |
| -speed using Python. The program provides a convenient interface for measuring download, upload, and ping speeds, |
6 |
| -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: |
8 |
| -[Internet Speed Test](https://github.com/AlexTkDev/different_mini-apps/tree/main/check_internrt_speed) |
| 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. |
9 | 16 |
|
10 | 17 | ### Installation
|
11 | 18 |
|
12 | 19 | #### System Requirements
|
13 | 20 | - macOS (version 10.14 or later)
|
14 |
| -- Python 3.6 or higher |
15 |
| -- Installed dependencies listed in `requirements.txt` |
| 21 | +- Python 3.8 or higher (with Tkinter support) |
| 22 | +- All dependencies from `requirements.txt` |
16 | 23 |
|
17 | 24 | #### Installing Dependencies
|
18 |
| -To install the dependencies, execute the following commands: |
19 |
| - |
20 | 25 | ```bash
|
21 | 26 | # Clone repository
|
22 | 27 | git clone https://github.com/AlexTkDev/macOS_application_speedtest_for_python.git
|
23 |
| -# Create a virtual environment (recommended) |
24 |
| -python -m venv .venv |
| 28 | +cd macOS_application_speedtest_for_python |
| 29 | +python3 -m venv .venv |
25 | 30 | source .venv/bin/activate
|
26 |
| -# Install dependencies |
27 | 31 | pip install -r requirements.txt
|
28 | 32 | ```
|
29 | 33 |
|
30 | 34 | ### Usage
|
31 |
| -After installation, you can run the application by executing: |
| 35 | +Run the application: |
32 | 36 | ```bash
|
33 |
| -python alexs_speedtest.py |
| 37 | +python main.py |
34 | 38 | ```
|
35 |
| - |
36 |
| -#### Features |
37 |
| -- **Internet Speed Measurement**: The app allows you to test download and upload speeds, as well as ping (latency) of your internet connection. |
38 |
| -- **Graphical Display**: After completing a test, users can view the test results and optionally plot the test history. |
39 |
| -- **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. |
41 |
| - |
42 |
| -#### Key Components |
43 |
| -- **Tkinter**: Used for creating the graphical user interface (GUI), which includes buttons for starting tests, viewing results, and plotting graphs. |
44 |
| -- **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. |
46 |
| -- **JSON**: A library for reading and writing test results stored in JSON format. |
47 |
| - |
48 |
| -#### How It Works |
49 |
| -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. |
51 |
| -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**. |
53 |
| -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 |
| - |
55 |
| - |
56 |
| -#### Building the Application |
57 |
| -To build the application in `.app` format, run the following command: |
| 39 | +Or build the .app: |
58 | 40 | ```bash
|
59 | 41 | pyinstaller main.spec
|
| 42 | +open dist/Alex_SpeedTest.app |
60 | 43 | ```
|
61 |
| -After building, the application will be located in the `dist` directory, and you can launch it by double-clicking the icon. |
62 |
| - |
63 |
| -### 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. |
66 | 44 |
|
67 |
| -### License |
68 |
| -This project is licensed under the MIT License. Please refer to the `LICENSE` file for more detailed information. |
| 45 | +#### Features |
| 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. |
| 53 | + |
| 54 | +#### Project Structure |
| 55 | +``` |
| 56 | +macOS_application_speedtest_for_python/ |
| 57 | +├── speedtest_app/ # Main package |
| 58 | +│ ├── __init__.py # Package initialization |
| 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) |
| 63 | +│ │ └── __init__.py |
| 64 | +│ ├── utils/ # Utility functions |
| 65 | +│ │ └── __init__.py |
| 66 | +│ └── tests/ # Unit tests |
| 67 | +│ ├── __init__.py |
| 68 | +│ ├── test_network_adapter.py |
| 69 | +│ └── test_test_history.py |
| 70 | +├── main.py # Entry point |
| 71 | +├── main.spec # PyInstaller config |
| 72 | +├── requirements.txt # Dependencies |
| 73 | +├── setup.py # Installation script |
| 74 | +├── README.md # This documentation |
| 75 | +``` |
69 | 76 |
|
70 |
| -### Code Analysis with Pylint |
71 |
| -This project uses **Pylint** for static code analysis to ensure that code adheres to Python's |
72 |
| -best practices and follows PEP 8 style guidelines. Pylint checks for errors, potential issues, |
73 |
| -and enforces consistent coding style, making it a valuable tool for maintaining code quality. |
| 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. |
74 | 83 |
|
75 |
| -### How to Install Pylint |
76 |
| -To install Pylint, use the following command in your terminal: |
| 84 | +### Building the Application |
| 85 | +To build the application in `.app` format: |
77 | 86 | ```bash
|
78 |
| -pip install pylint |
79 |
| -``` |
80 |
| -### Running Pylint |
81 |
| -Once installed, you can run Pylint on a specific Python file with: |
82 |
| -```bash |
83 |
| -pylint your_file.py |
| 87 | +pyinstaller main.spec |
84 | 88 | ```
|
85 |
| -Or, to analyze all Python files in the project, run: |
| 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`. |
| 102 | + |
| 103 | +### Running Tests |
86 | 104 | ```bash
|
87 |
| - pylint *.py |
| 105 | +python -m unittest discover |
88 | 106 | ```
|
89 |
| -This setup is also configured to run automatically within GitHub Actions on every code push, |
90 |
| -checking the code with multiple Python versions for compatibility. |
91 |
| - |
| 107 | + |
| 108 | +### License |
| 109 | +MIT License. See `LICENSE` for details. |
| 110 | + |
92 | 111 | ### Contribution
|
93 |
| -If you would like to contribute to the project, please create a fork of the repository and submit a Pull Request with your changes. |
| 112 | +Pull requests are welcome! See CONTRIBUTING section in the old README for workflow. |
94 | 113 |
|
95 | 114 | ### Contact
|
96 |
| -For questions or suggestions, you can reach out to me via [GitHub](https://github.com/AlexTkDev). |
97 |
| - |
| 115 | +For questions or suggestions, reach out via [GitHub](https://github.com/AlexTkDev). |
0 commit comments