Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
feat(#7): python venv
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed Jun 6, 2024
1 parent dce3839 commit 2cb099e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
renovate.json
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@ RUN apt-get update -y --fix-missing
RUN apt-get install -y --no-install-recommends make=4.3-4.1build2
RUN apt-get install -y --no-install-recommends git
RUN apt-get install -y --no-install-recommends npm
RUN apt-get install -y --no-install-recommends python3
RUN apt-get install -y --no-install-recommends python3-pip
RUN apt-get install -y --no-install-recommends python3-venv

# Setup Python venv.
WORKDIR /srdataset
RUN python3 -m venv .venv && /srdataset/.venv/bin/python -m pip install pandas
ENV PYTHON=/srdataset/.venv/bin/python

COPY Makefile /srdataset/
ENV LOCAL /srdataset
COPY steps/install.sh /srdataset/steps/
COPY steps/requirements.txt /srdataset/steps/
RUN sh steps/install.sh
COPY . /srdataset
ENTRYPOINT make install collect metrics
ENTRYPOINT make collect metrics
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ test:

# Install.
install:
echo "Installing..."
chmod +x steps/install.sh &&./steps/install.sh

# Collect repositories from GitHub API.
collect:
echo "Collecting..."

# Measure repositories with SR metrics.
metrics:
echo "Measuring SRs..."
chmod +x steps/metrics.sh &&./steps/metrics.sh
13 changes: 13 additions & 0 deletions steps/collect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
set -e
set -o pipefail

# create pats.txt > $PATS
# stars:2..100000 size:>=20 mirror:false template:false topic:(c | python | java | javascript | ruby)

# java=32,258
# c=10,434
# python=86,627
# javascript=72,496
# ruby=4,997
declare -a args=( \
"--query=${SEARCH_QUERY}" \
"--start=${START_DATE}" \
Expand All @@ -32,3 +40,8 @@ declare -a args=( \
"--tokens=${PATS}"
)
ghminer "${args[@]}"
if [ ! -f result.csv ]; then
echo "File result.csv was not created!"
echo "Failing..."
exit 0
fi
2 changes: 1 addition & 1 deletion steps/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@

set -e

# Install ghminer.
npm install -g ghminer@0.0.3
pip3 install -r requirements.txt
echo "All dependencies are installed and up to date! Now you can run 'make' and build the dataset."
4 changes: 3 additions & 1 deletion steps/metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ set -e
set -o pipefail

# Compute CPD, RC, IC metrics.
python3 metrics.py
cd steps
echo "Measuring SRs..."
$PYTHON metrics.py

0 comments on commit 2cb099e

Please sign in to comment.