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/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1db5880 --- /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 + venv/bin/pip install -r requirements.txt + venv/bin/pip install -r requirements.dev.txt + + # Run linter + - name: 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 + run: venv/bin/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..91fa128 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 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