Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Makefile #73

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading