forked from mlc-ai/mlc-llm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR enables two Python formatters "black" and "isort" on the following directory: - `./python/` - `./tests/python/` Enabling pylint and mypy is left for future work
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Python Lint | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
IMAGE: 'mlcaidev/ci-cpu:8a87699' | ||
|
||
jobs: | ||
isort: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- name: Version | ||
run: | | ||
wget https://raw.githubusercontent.com/mlc-ai/package/main/docker/bash.sh -O ./ci/bash.sh | ||
chmod u+x ./ci/bash.sh | ||
./ci/bash.sh $IMAGE "conda env export --name ci-lint" | ||
- name: Lint | ||
run: | | ||
./ci/bash.sh $IMAGE bash ./ci/task/isort.sh | ||
black: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- name: Version | ||
run: | | ||
wget https://raw.githubusercontent.com/mlc-ai/package/main/docker/bash.sh -O ./ci/bash.sh | ||
chmod u+x ./ci/bash.sh | ||
./ci/bash.sh $IMAGE "conda env export --name ci-lint" | ||
- name: Lint | ||
run: | | ||
./ci/bash.sh $IMAGE bash ./ci/task/black.sh |
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,9 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
source ~/.bashrc | ||
micromamba activate ci-lint | ||
NUM_THREADS=$(nproc) | ||
|
||
black --check --workers $NUM_THREADS ./python/ | ||
black --check --workers $NUM_THREADS ./tests/python |
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,9 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
source ~/.bashrc | ||
micromamba activate ci-lint | ||
NUM_THREADS=$(nproc) | ||
|
||
isort --check-only -j $NUM_THREADS --profile black ./python/ | ||
isort --check-only -j $NUM_THREADS --profile black ./tests/python/ |