Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

Commit 26d88a5

Browse files
committed
Add isort.
Fixes #6
1 parent 405dd4c commit 26d88a5

4 files changed

Lines changed: 67 additions & 1 deletion

File tree

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
VIRTUALENV = virtualenv --python=python3
2+
3+
VENV := $(shell echo $${VIRTUAL_ENV-.venv})
4+
PYTHON = $(VENV)/bin/python
5+
6+
INSTALL_STAMP = $(VENV)/.install.stamp
7+
DEV_STAMP = $(VENV)/.dev_env_installed.stamp
8+
TEMPDIR := $(shell mktemp -du)
9+
10+
help:
11+
@echo "Please use 'make <target>' where <target> is one of"
12+
@echo " format reformat code: black and isort"
13+
@echo " install install dependencies and prepare environment"
14+
@echo " install-dev install dependencies and everything needed to run tests"
15+
@echo " black run the black tool, which will automatically reformat the code"
16+
@echo " isort run the isort tool, which will automatically sort all of the imports"
17+
@echo " clean remove *.pyc files and __pycache__ directory"
18+
@echo " distclean remove *.egg-info files and *.egg, build and dist directories"
19+
@echo " maintainer-clean remove the .tox and the .venv directories"
20+
@echo "Check the Makefile to know exactly what each target is doing."
21+
22+
virtualenv: $(PYTHON)
23+
$(PYTHON):
24+
$(VIRTUALENV) $(VENV)
25+
26+
install: $(INSTALL_STAMP)
27+
$(INSTALL_STAMP): $(PYTHON) setup.py requirements.txt
28+
$(VENV)/bin/pip install -U pip
29+
$(VENV)/bin/pip install -Ue . -c requirements.txt
30+
touch $(INSTALL_STAMP)
31+
32+
install-dev: $(INSTALL_STAMP) $(DEV_STAMP)
33+
$(DEV_STAMP): $(PYTHON) dev-requirements.txt
34+
$(VENV)/bin/pip install -Ur dev-requirements.txt
35+
touch $(DEV_STAMP)
36+
37+
format: black isort
38+
39+
black: install-dev
40+
$(VENV)/bin/black setup.py alma
41+
42+
isort: install-dev
43+
$(VENV)/bin/isort setup.py alma
44+
45+
build-requirements:
46+
$(VIRTUALENV) $(TEMPDIR)
47+
$(TEMPDIR)/bin/pip install -U pip
48+
$(TEMPDIR)/bin/pip install -Ue .
49+
$(TEMPDIR)/bin/pip freeze | grep -v -- '-e' > requirements.txt
50+
51+
clean:
52+
find . -name '__pycache__' -type d | xargs rm -fr
53+
54+
distclean: clean
55+
rm -fr *.egg *.egg-info/ dist/ build/
56+
57+
maintainer-clean: distclean
58+
rm -fr .venv/ .tox/

dev-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
black
2+
isort

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
certifi==2019.11.28
2+
chardet==3.0.4
3+
idna==2.8
4+
requests==2.22.0
5+
urllib3==1.25.8

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pathlib
2-
from setuptools import setup, find_packages
2+
3+
from setuptools import find_packages, setup
34

45
# The directory containing this file
56
HERE = pathlib.Path(__file__).parent

0 commit comments

Comments
 (0)