Mega Diff is an open source Python tool for deeply comparing two websites, ideal for identifying differences between development and production environments. It generates an HTML report highlighting discrepancies in content, structure, and other aspects of the web pages.
- Compares two given URLs (e.g., a development site and a production site)
- Generates a detailed HTML report of the differences
- Useful for quality assurance and deployment verification
- Helps debug why a page is broken in development but working in production (or vice versa)
-
Clone the repository:
git clone https://github.com/rlorenzo/mega-diff.git cd mega-diff -
Create a virtual environment (recommended):
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
Troubleshooting on macOS:
If you see warnings about LibreSSL or urllib3 (e.g., NotOpenSSLWarning), it's recommended to use a Python installed via Homebrew or pyenv, as these use OpenSSL and are compatible with modern libraries:
-
Homebrew Python:
brew install python /opt/homebrew/bin/python3 -m venv venv source venv/bin/activate pip install -r requirements.txt -
pyenv:
brew install pyenv pyenv install 3.11.9 pyenv local 3.11.9 python -m venv venv source venv/bin/activate pip install -r requirements.txt
To run the script, execute mega_diff.py with the two URLs you want to compare as arguments:
python mega_diff.py <working_url> <broken_url><working_url>: The URL of the page that is working (e.g., production)<broken_url>: The URL of the page that is broken or under development
Example:
python3 mega_diff.py https://prod.example.com https://dev.example.comAfter execution, an HTML report named mega_diff_report.html will be generated in the mega_diff_output/ directory, detailing the differences found.
To run the test suite, use:
python -m unittest discover testsThis will automatically find and run all tests in the tests/ directory. Make sure to run this command from the project root directory.
If you want to contribute to this project, please set up the development environment:
-
Follow the installation steps above to set up the basic environment.
-
Install pre-commit hooks for code quality:
pre-commit install
This will automatically run code formatting (Black) and linting (flake8) before each commit to ensure code quality standards.
-
Run pre-commit manually (optional):
pre-commit run --all-files
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
This project is licensed under the MIT License. See the LICENSE file for details.