Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
update specifications for pylint, pyment and black
  • Loading branch information
Shuyib authored Nov 18, 2024
1 parent 52cb31d commit 5c837b9
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Here is the updated Makefile with `$PIP` and `$PYTHON` variables used in the appropriate sections, including for `black`, `pyment`, and `pylint`:

```makefile
# .ONESHELL tells make to run each recipe line in a single shell
.ONESHELL:

Expand All @@ -22,49 +25,55 @@ activate:
. .venv/bin/activate

install: requirements.txt # prerequisite
# install commands
# in local use
# $(PIP) install --no-cache-dir --upgrade pip &&\
# $(PIP) install --no-cache-dir -r requirements.txt
pip --no-cache-dir install --upgrade pip &&\
pip --no-cache-dir install -r requirements.txt
# install commands using pip from the virtual environment
$(PIP) install --no-cache-dir --upgrade pip &&\
$(PIP) install --no-cache-dir -r requirements.txt

format: install
#format code
black *.py utils/*.py testing/*.py
# format code using black
$(PYTHON) -m black *.py utils/*.py testing/*.py

clean:
# clean directory of cache files, virtual environment, and data
rm -rf __pycache__ &&\
rm -rf utils/__pycache__ &&\
rm -rf testing/__pycache__ &&\
rm -rf .pytest_cache &&\
rm -rf .venv &&\
rm updated_data/sequences.fasta
rm updated_data/sequences.fasta &&\
rm updated_data/sequence_metrics.csv

docstring: activate install
# format docstring
pyment -w -o numpydoc *.py
# format docstring using pyment
$(PYTHON) -m pyment -w -o numpydoc *.py

lint: activate install format
#flake8 or #pylint
pylint --disable=R,C --errors-only *.py utils/*.py testing/*.py
# lint code using pylint
$(PYTHON) -m pylint --disable=R,C --errors-only *.py utils/*.py testing/*.py

test: activate install format lint
#test
python -m pytest testing/*.py
# run tests using pytest
$(PYTHON) -m pytest testing/*.py

run_script:
# run script: load fasta, create sequence_metrics
# calculate cosine similiarity averages
python multifastaloader.py
python load_multifasta_metrics.py
python tokenize_compare_sequences.py
# calculate cosine similarity averages
$(PYTHON) multifastaloader.py
$(PYTHON) load_multifasta_metrics.py
$(PYTHON) tokenize_compare_sequences.py

docker_build: Dockerfile requirements.txt
# build the container: More important for the CI/CD
sudo docker build -t phylo-exp .

docker_run_test: Dockerfile
# linting Dockerfile
# lint Dockerfile
sudo docker run --rm -i hadolint/hadolint < Dockerfile

docker_run: docker_build
# run the container
sudo docker run -it -p 8888:8888 --rm phylo-exp:latest

deploy:
# add step to deploy to cloud provider if any
echo "todo"
Expand All @@ -74,3 +83,6 @@ deploy:

# what all steps to run
all: install docstring format lint test docker_build docker_run
```

This ensures that `black`, `pyment`, and `pylint` use the appropriate Python and pip from the virtual environment.

0 comments on commit 5c837b9

Please sign in to comment.