From b454f144bb8119a2969573e5ccf98583a04fa3d8 Mon Sep 17 00:00:00 2001 From: Maxim Avanov <601955+avanov@users.noreply.github.com> Date: Sat, 17 Sep 2022 01:01:46 +0300 Subject: [PATCH] common commands (#59) --- .editorconfig | 31 +++++++++++++++++++++++++++++++ Makefile | 33 +++++++++++++++++++++++++++++++++ default.nix | 1 + requirements-test.txt | 3 ++- 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .editorconfig create mode 100644 Makefile diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ac9ce7d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,31 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + +# Matches multiple files with brace expansion notation +# Set default charset +[*.{js,py}] +charset = utf-8 + +# 4 space indentation +[*.py] +indent_style = space +indent_size = 4 + +[*.sh] +indent_style = space +indent_size = 4 + +# Tab indentation (no size specified) +[Makefile] +indent_style = tab + +[*.nix] +indent_style = space +indent_size = 4 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9a1ee0e --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +# https://www.gnu.org/software/make/manual/html_node/Special-Variables.html +# https://ftp.gnu.org/old-gnu/Manuals/make-3.80/html_node/make_17.html +PROJECT_MKFILE_PATH := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +PROJECT_MKFILE_DIR := $(shell cd $(shell dirname $(PROJECT_MKFILE_PATH)); pwd) + +PROJECT_NAME := plim +PROJECT_ROOT := $(PROJECT_MKFILE_DIR) + +BUILD_DIR := $(PROJECT_ROOT)/build +DIST_DIR := $(PROJECT_ROOT)/dist + +PROJECT=plim + +.PHONY: test +test: + pytest -s --cov=plim --cov-report xml $(PROJECT_ROOT)/tests + +.PHONY: typecheck +typecheck: + mypy --config-file setup.cfg --package $(PROJECT_NAME) + +.PHONY: prepare-dist +prepare-dist: + rm -rf $(BUILD_DIR) $(DIST_DIR) + python $(PROJECT_ROOT)/setup.py sdist bdist_wheel + +.PHONY: publish +publish: | test publish + twine upload $(DIST_DIR)/* + +.PHONY: shell +shell: + nix-shell $(PROJECT_ROOT)/shell.nix diff --git a/default.nix b/default.nix index 22c3847..93c9263 100644 --- a/default.nix +++ b/default.nix @@ -23,6 +23,7 @@ devEnv = pkgs.mkShellNoCC { pythonPkgs.twine pythonPkgs.coveralls + gnumake nodejs nodePackages.npm taglib diff --git a/requirements-test.txt b/requirements-test.txt index a387b08..78fc9ce 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,3 +1,4 @@ pytest coverage -pytest-cov \ No newline at end of file +pytest-cov +mypy