Skip to content

Commit

Permalink
update makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
brycedrennan committed Oct 31, 2018
1 parent 478b204 commit 53a899b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
42 changes: 24 additions & 18 deletions Makefile
@@ -1,38 +1,41 @@
SHELL := /bin/bash
python_version = 3.6.6
venv_prefix = aresponses
venv_name = $(venv_prefix)-$(python_version)
pyenv_instructions=https://github.com/pyenv/pyenv#installation
pyenv_virt_instructions=https://github.com/pyenv/pyenv-virtualenv#pyenv-virtualenv


init: require_pyenv
init: require_pyenv ## Setup a dev environment for local development.
@pyenv install $(python_version) -s
@echo "\033[0;32m ✔️ 🐍 $(python_version) installed \033[0m"
@echo -e "\033[0;32m ✔️ 🐍 $(python_version) installed \033[0m"
@if ! [ -d "$$(pyenv root)/versions/$(venv_name)" ]; then\
pyenv virtualenv $(python_version) $(venv_name);\
fi;
@pyenv local $(venv_name)
@echo "\033[0;32m ✔️ 🐍 $(venv_name) virtualenv activated \033[0m"
@echo -e "\033[0;32m ✔️ 🐍 $(venv_name) virtualenv activated \033[0m"
pip install --upgrade pip
pip install -r requirements.txt --upgrade
@echo "\nEnvironment setup! ✨ 🍰 ✨ 🐍 \n\nCopy this path to tell PyCharm where your virtualenv is. You may have to click the refresh button in the pycharm file explorer.\n"
@echo "\033[0;32m"
@echo -e "\nEnvironment setup! ✨ 🍰 ✨ 🐍 \n\nCopy this path to tell PyCharm where your virtualenv is. You may have to click the refresh button in the pycharm file explorer.\n"
@echo -e "\033[0;32m"
@pyenv which python
@echo "\n\033[0m"
@echo -e "\n\033[0m"
@echo -e "The following commands are available to run in the Makefile\n"
@make -s help


autoformat:
autoformat: ## Run the autoformatter.
@black .

test:
test: ## Run the tests.
@pytest -n auto
@echo "The tests pass! ✨ 🍰 ✨"
@echo -e "The tests pass! ✨ 🍰 ✨"

lint:
lint: ## Run the code linter.
@pylava
@echo "No linting errors - well done! ✨ 🍰 ✨"
@echo -e "No linting errors - well done! ✨ 🍰 ✨"

deploy:
deploy: ## Deploy the package to pypi.org
pip install twine wheel
git tag $$(python setup.py -V)
git push --tags
Expand All @@ -42,17 +45,20 @@ deploy:
@read username && twine upload dist/* -u $$username;
@echo "Deploy successful! ✨ 🍰 ✨"


require_pyenv:
@if ! [ -x "$$(command -v pyenv)" ]; then\
echo '\n\033[0;31m ❌ pyenv is not installed. Follow instructions here: $(pyenv_instructions)\n\033[0m';\
echo -e '\n\033[0;31m ❌ pyenv is not installed. Follow instructions here: $(pyenv_instructions)\n\033[0m';\
exit 1;\
else\
echo "\033[0;32m ✔️ pyenv installed\033[0m";\
echo -e "\033[0;32m ✔️ pyenv installed\033[0m";\
fi
@if ! [ -d "$$(pyenv root)/plugins/pyenv-virtualenv" ]; then\
echo '\n\033[0;31m ❌ pyenv virtualenv is not installed. Follow instructions here: $(pyenv_virt_instructions) \n\033[0m';\
echo -e '\n\033[0;31m ❌ pyenv virtualenv is not installed. Follow instructions here: $(pyenv_virt_instructions) \n\033[0m';\
exit 1;\
else\
echo "\033[0;32m ✔️ pyenv-virtualenv installed\033[0m";\
fi
echo -e "\033[0;32m ✔️ pyenv-virtualenv installed\033[0m";\
fi

help: ## Show this help message.
@## https://gist.github.com/prwhite/8168133#gistcomment-1716694
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" | sort
5 changes: 2 additions & 3 deletions README.md
Expand Up @@ -97,9 +97,8 @@ async def test_foo(event_loop):

### Dev environment setup
- **install pyenv and pyenv-virtualenv** - Makes it easy to install specific versions of python and switch between them. Make sure you install the virtualenv bash hook
- `git clone git@github.com:CircleUp/aresponses.git`
- `cd aresponses`
- `make init` - creates the virtual environment and installs all the requirements
- `git clone` the repo and `cd` into it.
- `make init` - installs proper version of python, creates the virtual environment, activates it and installs all the requirements

### Submitting a feature request
- **`git checkout -b my-feature-branch`**
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -14,6 +14,6 @@ disable = W0612,W0621
source=aresponses

[pytest]
addopts = --doctest-modules -s --tb=native --cov
addopts = --doctest-modules -s --tb=native
collect_ignore = setup.py
norecursedirs = build dist

0 comments on commit 53a899b

Please sign in to comment.