diff --git a/Makefile b/Makefile index 60f348326..cc2292744 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,13 @@ -.PHONY: test +.PHONY: test style -# Run tests for the library +check_dirs := tests tools/convert_checkpoint -test: +help: ## this help + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-22s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +test: ## run tests pytest tests + +style: ## checks for code style and applies formatting + black $(check_dirs) + isort $(check_dirs) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..9cb022a7c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.black] +line-length = 119 +target-version = ['py35'] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 38837f542..ef6c6af42 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,6 @@ transformers DeepSpeed @ git+https://github.com/microsoft/DeepSpeed.git # at some point when it starts working freeze with ether min version or sha using the syntax codecarbon.git@deadbeaf codecarbon @ git+https://github.com/mlco2/codecarbon.git +# versions from HF transformers +black==21.4b0 +isort>=5.5.4 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..e5e3c2ecd --- /dev/null +++ b/setup.cfg @@ -0,0 +1,24 @@ +[isort] +default_section = FIRSTPARTY +ensure_newline_before_comments = True +force_grid_wrap = 0 +include_trailing_comma = True +known_first_party = megatron +known_third_party = + apex + codecarbon + datasets + deepspeed + git + nltk + numpy + pytest + tensorboard + torch + tqdm + transformers + +line_length = 119 +lines_after_imports = 2 +multi_line_output = 3 +use_parentheses = True \ No newline at end of file