From 4046aa68f9719b58c07cb265c25de32df5b2dc6e Mon Sep 17 00:00:00 2001 From: Jake Tae <> Date: Fri, 8 Oct 2021 00:17:13 -0400 Subject: [PATCH 1/2] chore: add formatter config files, add make cmds --- Makefile | 10 ++++++++-- pyproject.toml | 3 +++ requirements.txt | 3 +++ setup.cfg | 24 ++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg diff --git a/Makefile b/Makefile index 60f348326..6cd190199 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,12 @@ -.PHONY: test +.PHONY: test style -# Run tests for the library +check_dirs := tests tools/convert_checkpoint +# this target tests for the library test: pytest tests + +# this target runs checks on all files and potentially modifies some of them +style: + black $(check_dirs) + isort $(check_dirs) \ No newline at end of file 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 From d00c9d67aa3986b97112e9ac6e6a0ee941592903 Mon Sep 17 00:00:00 2001 From: Jake Tae <> Date: Tue, 19 Oct 2021 00:05:05 -0400 Subject: [PATCH 2/2] feature: add make help cmd --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6cd190199..cc2292744 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,12 @@ check_dirs := tests tools/convert_checkpoint -# this target tests for the library -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 -# this target runs checks on all files and potentially modifies some of them -style: +style: ## checks for code style and applies formatting black $(check_dirs) - isort $(check_dirs) \ No newline at end of file + isort $(check_dirs)