Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure code style formatters (#130)
* chore: add formatter config files, add make cmds * feature: add make help cmd Co-authored-by: Jake Tae <>
- Loading branch information
Showing
4 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[tool.black] | ||
line-length = 119 | ||
target-version = ['py35'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |