From 0f55bb7690fd6b23002b20de20e1b4ddc8cc97c2 Mon Sep 17 00:00:00 2001 From: Mohab Ashraf Date: Sat, 21 Dec 2024 22:08:41 +0200 Subject: [PATCH 1/8] add github actions and readme --- .github/workflows/ci.yml | 41 ++++++++++++++ README.md | 116 ++++++++++++++++++++++++++++++++++++++- requirements.dev.txt | 2 +- 3 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..510f85b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI - Linting and Testing + +on: + pull_request: + branches: + - main + +jobs: + lint-and-test: + runs-on: ubuntu-latest + + steps: + # Checkout the code + - name: Checkout code + uses: actions/checkout@v3 + + # Set up Python environment + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.12 + + # Install dependencies + - name: Install dependencies + run: | + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + pip install -r requirements.dev.txt + + # Run linter + - name: Run flake8 + run: | + source venv/bin/activate + flake8 + + # Run unit tests + - name: Run unit tests + run: | + source venv/bin/activate + python -m unittest discover -s tests diff --git a/README.md b/README.md index 2622c7b..b455e63 100644 --- a/README.md +++ b/README.md @@ -1 +1,115 @@ -# DigitalSignalProcessing \ No newline at end of file +# Digital Signal Processing (DSP) Project + +This repository contains a Digital Signal Processing project developed for the Computer Science department at Ain Shams University by Mohab Ashraf and Moamen Sherif. It is designed to provide tools and functionalities for signal processing using Python. + +## Features + +- Core signal processing operations and utilities. +- A modular and extensible structure for developing custom signal processing workflows. +- Comprehensive testing to ensure functionality and stability. + +## How to Run the Project + +### Requirements + +This project requires Python 3.12. To install the required dependencies, run the following commands: + +```bash +python3.12 -m venv venv +source venv/bin/activate # On Windows use `venv\Scripts\activate` +pip install -r requirements.txt +``` + +### Running the Project + +After setting up the environment and installing dependencies, execute the main script or any specific module you wish to explore. For example: + +```bash +python __init__.py +``` + +## Exploring the Project + +### Project Structure + +The project is organized into the following folders and files: + +- **Bonus/**: Contains additional features or experimental functionalities that extend the main project capabilities. +- **Functions/**: Houses the core functionalities, including: +- **Gui/**: Includes files for the graphical user interface (GUI). While basic, this directory can be a focus area for future improvements. + - `Gui_starter.py`: Script to launch the GUI. +- **Ref/**: Reference materials or resources used in the project. +- **Tests/**: Contains the test suite and `.txt` files used for validating the project's functionality. +- `utilities.py`: Contains helper functions for signal processing tasks. +- `RunAllTests.py`: A script to execute all the tests. +- **tests/**: main testing file . +- **Freestyle.py**: A standalone script for custom or freestyle operations outside the main project flow. +- `Signal.py`: Defines the `Signal` class, the central component of the project. +- `.flake8`: Configuration file for the `flake8` linter. +- `requirements.txt`: Lists the dependencies required for running the project. +- `requirements.dev.txt`: Lists the additional dependencies needed for development. +- `README.md`: This documentation file. + +### Starting Point: The `Signal` Class + +The `Signal` class is the heart of this project. It provides: + +- Methods for reading and writing signal data. +- Utilities for manipulating and analyzing signals. + +To explore the project, begin by examining the `Signal` class in `Functions/Signal.py`. Then, move to the `act` and `check` modules for additional processing and validation functionality. + +## How to Develop + +### Development Environment + +All code must be written and tested in the same Python environment. To set up the development environment, you will need to install additional dependencies from `requirements.dev.txt`: + +```bash +pip install -r requirements.dev.txt +``` + +A linter, `flake8`, is used to ensure code quality. Run the linter before committing changes: + +```bash +flake8 +``` + +### Testing + +The project includes a comprehensive suite of tests located in the `Tests/` folder. The tests are structured as follows: + +- **read tests**: Validate signal reading functionality. +- **act tests**: Ensure actions on signals work as expected. +- **check tests**: Confirm that signals are properly validated. + +Before making changes, ensure that all existing tests pass to avoid regressions. Run the tests using: + +```bash +python -m unittest discover -s tests +``` +## Side Notes + +- The program was written on Ubuntu, so it has not been tested on Windows. +- The core focus of the project was on the functionalities, not the GUI. Improving the GUI could be a potential area for development. + +## Contributing Guidelines + +1. Always use the project’s virtual environment for development. +2. Maintain consistency with the existing code style and structure. +3. Run the linter and tests before submitting any code changes. + +## Credits + +This project was developed for the Computer Science department at Ain Shams University by: + +- **Mohab Ashraf** +- **Moamen Sherif** + +Special thanks to our teaching assistant: + +- **Omar Sherif** + +Special thanks to our supervisor: + +- **Dr. Donia Gamal** \ No newline at end of file diff --git a/requirements.dev.txt b/requirements.dev.txt index 27d00bc..1bcdd92 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1 +1 @@ -flake8>=3.9.2,<3.10 \ No newline at end of file +flake8>=7.1.1,<7.2 \ No newline at end of file From a7c671e4e7ed56a1e141c17f8025031802d1ed5c Mon Sep 17 00:00:00 2001 From: Mohab Ashraf Date: Sat, 21 Dec 2024 22:20:46 +0200 Subject: [PATCH 2/8] fixing dependencies --- .flake8 | 5 +---- requirements.dev.txt | 2 +- requirements.txt | 2 -- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.flake8 b/.flake8 index a67b456..eeb6536 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,2 @@ [flake8] -max-line-length = 85 - -[per-file-ignores] -*_gui.py: E501 +max-line-length = 85 \ No newline at end of file diff --git a/requirements.dev.txt b/requirements.dev.txt index 1bcdd92..91fa128 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1 +1 @@ -flake8>=7.1.1,<7.2 \ No newline at end of file +flake8==7.1.1 diff --git a/requirements.txt b/requirements.txt index 238575e..d14bd6c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,5 @@ contourpy==1.3.0 cycler==0.12.1 -flake8==7.1.1 -flake8-per-file-ignores==0.8.1 fonttools==4.54.1 joblib==1.4.2 kiwisolver==1.4.7 From c57c77ea692af21cd66ad84cc7adf2967b00c6fb Mon Sep 17 00:00:00 2001 From: Mohab Ashraf Date: Sat, 21 Dec 2024 22:24:51 +0200 Subject: [PATCH 3/8] fixing ci /cd script --- .github/workflows/ci.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 510f85b..cea41ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,18 +24,13 @@ jobs: - name: Install dependencies run: | python -m venv venv - source venv/bin/activate - pip install -r requirements.txt - pip install -r requirements.dev.txt + venv/bin/pip install -r requirements.txt + venv/bin/pip install -r requirements.dev.txt # Run linter - name: Run flake8 - run: | - source venv/bin/activate - flake8 + run: flake8 # Run unit tests - name: Run unit tests - run: | - source venv/bin/activate - python -m unittest discover -s tests + run: venv/bin/python -m unittest discover -s tests From 10802ea072ce560836a96439219e7f3f8088d4bd Mon Sep 17 00:00:00 2001 From: Mohab Ashraf Date: Sat, 21 Dec 2024 22:26:12 +0200 Subject: [PATCH 4/8] fixing ci /cd script 2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cea41ed..0dd5e42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: # Run linter - name: Run flake8 - run: flake8 + run: venv/bin/flake8 # Run unit tests - name: Run unit tests From 640b298fb7aff845bb1cebf4157b0ee850e9e5a2 Mon Sep 17 00:00:00 2001 From: Mohab Ashraf Date: Sat, 21 Dec 2024 22:28:35 +0200 Subject: [PATCH 5/8] fixing ci /cd script 2 remove linting --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0dd5e42..ec6dcfc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,10 +27,6 @@ jobs: venv/bin/pip install -r requirements.txt venv/bin/pip install -r requirements.dev.txt - # Run linter - - name: Run flake8 - run: venv/bin/flake8 - # Run unit tests - name: Run unit tests run: venv/bin/python -m unittest discover -s tests From c52583d6f18e498a38ad2ebc5ae45b0c64c5a873 Mon Sep 17 00:00:00 2001 From: Mohab Ashraf Date: Sat, 21 Dec 2024 22:32:53 +0200 Subject: [PATCH 6/8] fixing ci /cd script 2 adding linting --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec6dcfc..bd60c92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,10 @@ jobs: venv/bin/pip install -r requirements.txt venv/bin/pip install -r requirements.dev.txt + # Run linter + - name: Run flake8 + run: venv/bin/flake8 . + # Run unit tests - name: Run unit tests run: venv/bin/python -m unittest discover -s tests From fe2bd2a99d129b9226512fef796dccaf51b620a3 Mon Sep 17 00:00:00 2001 From: Mohab Ashraf Date: Sat, 21 Dec 2024 22:37:26 +0200 Subject: [PATCH 7/8] fixing ci /cd script 2 adding linting 2 --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd60c92..b0d2c1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,11 @@ jobs: with: python-version: 3.12 + # Install global flake8 + - name: Install global flake8 + run: | + pip install flake8 + # Install dependencies - name: Install dependencies run: | @@ -27,9 +32,9 @@ jobs: venv/bin/pip install -r requirements.txt venv/bin/pip install -r requirements.dev.txt - # Run linter + # Run linter globally - name: Run flake8 - run: venv/bin/flake8 . + run: flake8 . # Run unit tests - name: Run unit tests From e1f2f3e4e4e281ee26882acfe6333a17cd2d0c7b Mon Sep 17 00:00:00 2001 From: Mohab Ashraf Date: Sat, 21 Dec 2024 22:43:01 +0200 Subject: [PATCH 8/8] fixing ci /cd script 2 adding linting 3.0 --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0d2c1c..1db5880 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,6 @@ jobs: with: python-version: 3.12 - # Install global flake8 - - name: Install global flake8 - run: | - pip install flake8 - # Install dependencies - name: Install dependencies run: | @@ -32,9 +27,14 @@ jobs: venv/bin/pip install -r requirements.txt venv/bin/pip install -r requirements.dev.txt - # Run linter globally + # Run linter - name: Run flake8 - run: flake8 . + run: | + venv/bin/flake8 Functions/ + venv/bin/flake8 tests/ + venv/bin/flake8 utilities.py + venv/bin/flake8 Signal.py + # Run unit tests - name: Run unit tests