This repository contains the replication package for our paper title: "Energy Patterns in Python Web Applications: Taxonomy, Impact, and Automated Identification. The project structure is organized by Research Questions (RQs), with each folder containing the necessary data, scripts, and instructions to replicate our results.
.
├── RQ1/ # Project selection and keyword search
│ ├── data/ # Raw matches and curated data
│ └── energypattern-keyword-search/ # Keyword search and project selection scripts
├── RQ2/ # Energy experiments
│ ├── data/ # Raw energy results
│ ├── energy_experiments/ # Measurement scripts for Mealie and Frappe
│ ├── results_analysis/ # Analysis and plotting scripts
│ └── scaphandre/ # Custom Scaphandre version
└── RQ3/ # Antipattern detector tool and validation
├── energypattern-LLM-tool/ # Source code and test inputs
└── tool_validation/ # Validation results
The following sections detail the steps to replicate the results for each research question.
- Prerequisites & Setup: Ensure you have Python 3.10+ and Docker installed. Install dependencies (
pip install -r requirements.txt), configure your environment variables (GitHub token and MongoDB credentials in.env), and start MongoDB withdocker compose up -d. - Repository Selection: Run
python -m processing_pipeline.select_repos.extract_repos_from_gitwith the desired filtering thresholds (e.g., minimum stars, python percentage) to discover candidate repositories and output a list. - PR Keyword Matching: Pre-fetch PR metadata into MongoDB (
fetch_github_prs.pyandfetch_github_data.py), then executepython -m processing_pipeline.keyword_matching.extract_from_prto extract energy keyword matches. - Source Code/Doc Keyword Matching: Locally clone the chosen repositories into
.tmp/source/, then runpython -m processing_pipeline.keyword_matching.extract_from_source_codeto search for keywords in comments and documentation.
For more details, consult the RQ1 README in the energypattern keyword search folder.
Note: Full replication of the experiment execution is only possible with a deployed application and a ready setup.
- Application Deployment: Deploy the target applications, Mealie and Frappe (without Docker) on your server, and set up a database for them.
- Frappe/ERPNext Experiments: Run the orchestrator script:
python run_frappe_measurements.py
- Mealie Experiments: Run the orchestrator script:
python run_all_mealie_measurements.py
- Analysis: Run the analysis scripts in
results_analysisto reproduce the plots and tables.
For more details on the experimental setup, file swapping, and Scaphandre measurement library, consult the RQ2 README.
- Setup: Activate your Python virtual environment and install the required dependencies (
pip install -r requirements.txt). - Run the Tool: Get the antipattern detector tool running as described in the [RQ3 README](./RQ3/energypattern-LLM-tool/README. md).
- Validate: Input the provided test inputs in RQ3/energypattern-LLM-tool/test_inputs into the tool to analyze the source code and validate the detection and classification of energy antipatterns.
For more details on the tool's architecture, configuration and implementation details consult the RQ3 README in the tool folder.