Skip to content

Commit

Permalink
Configure code style formatters (#130)
Browse files Browse the repository at this point in the history
* chore: add formatter config files, add make cmds

* feature: add make help cmd

Co-authored-by: Jake Tae <>
  • Loading branch information
jaketae committed Oct 19, 2021
1 parent 3b22aa2 commit d0799e7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
13 changes: 10 additions & 3 deletions 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<target>\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)
3 changes: 3 additions & 0 deletions pyproject.toml
@@ -0,0 +1,3 @@
[tool.black]
line-length = 119
target-version = ['py35']
3 changes: 3 additions & 0 deletions requirements.txt
Expand Up @@ -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
24 changes: 24 additions & 0 deletions 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

0 comments on commit d0799e7

Please sign in to comment.