From 9402f7c19abe8978f7241c5eb132ab103d3a5f66 Mon Sep 17 00:00:00 2001 From: Craig Jones Date: Mon, 21 Mar 2022 02:47:15 -0700 Subject: [PATCH 1/3] Added the option to use the isort linter along with flake8 and black. --- cookiecutter.json | 1 + {{cookiecutter.project_slug}}/Makefile | 6 +++++- {{cookiecutter.project_slug}}/requirements_dev.txt | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cookiecutter.json b/cookiecutter.json index 208f8d1a8..1b559b2a7 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -9,6 +9,7 @@ "version": "0.1.0", "use_pytest": "n", "use_black": "n", + "use_isort": "n", "use_pypi_deployment_with_travis": "y", "add_pyup_badge": "n", "command_line_interface": ["Click", "Argparse", "No command-line interface"], diff --git a/{{cookiecutter.project_slug}}/Makefile b/{{cookiecutter.project_slug}}/Makefile index b2cf6cda7..535116446 100644 --- a/{{cookiecutter.project_slug}}/Makefile +++ b/{{cookiecutter.project_slug}}/Makefile @@ -1,5 +1,6 @@ .PHONY: clean clean-build clean-pyc clean-test coverage dist docs help install lint lint/flake8 {%- if cookiecutter.use_black == 'y' %} lint/black{% endif %} + {%- if cookiecutter.use_isort == 'y' %} lint/isort{% endif %} .DEFAULT_GOAL := help define BROWSER_PYSCRIPT @@ -56,7 +57,10 @@ lint/black: ## check style with black black --check {{ cookiecutter.project_slug }} tests {%- endif %} -lint: lint/flake8{%- if cookiecutter.use_black == 'y' %} lint/black{%- endif %} ## check style +lint/isort: | .venv ## clean up all of the imports (using isort) + ${BIN}\isort src tests + +lint: lint/flake8{%- if cookiecutter.use_black == 'y' %} lint/black{%- endif %}{%- if cookiecutter.use_isort == 'y' %} lint/isort{%- endif %} ## check style test: ## run tests quickly with the default Python {%- if cookiecutter.use_pytest == 'y' %} diff --git a/{{cookiecutter.project_slug}}/requirements_dev.txt b/{{cookiecutter.project_slug}}/requirements_dev.txt index e02093f48..451836999 100644 --- a/{{cookiecutter.project_slug}}/requirements_dev.txt +++ b/{{cookiecutter.project_slug}}/requirements_dev.txt @@ -13,3 +13,5 @@ Click==7.1.2{% endif %} pytest==6.2.4{% endif %} {% if cookiecutter.use_black == 'y' -%} black==21.7b0{% endif %} +{% if cookiecutter.use_isort == 'y' -%} +isort{% endif %} From 7407e89e36d853814d3af5bea9c4976c3ad42486 Mon Sep 17 00:00:00 2001 From: Craig Jones Date: Mon, 21 Mar 2022 03:23:41 -0700 Subject: [PATCH 2/3] Removed some code that slipped in by accident. --- {{cookiecutter.project_slug}}/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/Makefile b/{{cookiecutter.project_slug}}/Makefile index 535116446..00d04e905 100644 --- a/{{cookiecutter.project_slug}}/Makefile +++ b/{{cookiecutter.project_slug}}/Makefile @@ -57,7 +57,7 @@ lint/black: ## check style with black black --check {{ cookiecutter.project_slug }} tests {%- endif %} -lint/isort: | .venv ## clean up all of the imports (using isort) +lint/isort: ## clean up all of the imports (using isort) ${BIN}\isort src tests lint: lint/flake8{%- if cookiecutter.use_black == 'y' %} lint/black{%- endif %}{%- if cookiecutter.use_isort == 'y' %} lint/isort{%- endif %} ## check style From a5f7d2f53e4beaffac2c5664e0782a1ee2e1366e Mon Sep 17 00:00:00 2001 From: Craig Jones Date: Mon, 21 Mar 2022 03:25:59 -0700 Subject: [PATCH 3/3] Removed some more code that slipped in by accident. --- {{cookiecutter.project_slug}}/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/Makefile b/{{cookiecutter.project_slug}}/Makefile index 00d04e905..60f75a277 100644 --- a/{{cookiecutter.project_slug}}/Makefile +++ b/{{cookiecutter.project_slug}}/Makefile @@ -58,7 +58,7 @@ lint/black: ## check style with black {%- endif %} lint/isort: ## clean up all of the imports (using isort) - ${BIN}\isort src tests + isort src tests lint: lint/flake8{%- if cookiecutter.use_black == 'y' %} lint/black{%- endif %}{%- if cookiecutter.use_isort == 'y' %} lint/isort{%- endif %} ## check style