-
Notifications
You must be signed in to change notification settings - Fork 341
[CI] add pre-commit integration
#955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
567d1db
chore: misc cleanup
XuehaiPan cebf47b
feat: add pre-commit config
XuehaiPan 4ad758a
chore: update lint dependencies
XuehaiPan 8b853b6
style: fix lint issues
XuehaiPan f6d2cc7
feat: add pre-commit hooks
XuehaiPan bcc9c87
fix: fix typos
XuehaiPan b13e648
Merge branch 'main' into add-pre-commit-config
XuehaiPan 7721806
Merge remote-tracking branch 'origin/main' into add-pre-commit-config
XuehaiPan a6d59fc
chore: update .gitattributes
XuehaiPan 592ddd9
Merge remote-tracking branch 'origin/main' into add-pre-commit-config
XuehaiPan 9011f4a
[Lint]: [pre-commit.ci] auto fixes [...]
pre-commit-ci[bot] 3ca61ac
docs: update CONTRIBUTING.md
XuehaiPan a7a62bd
chore: update default venv name
XuehaiPan f57e23a
Merge branch 'main' into add-pre-commit-config
XuehaiPan 0439302
chore: revert and exclude CUDA files
XuehaiPan 00ef439
Merge branch 'main' into add-pre-commit-config
XuehaiPan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 @@ | ||
| --- | ||
| BasedOnStyle: LLVM | ||
| UseTab: Never | ||
| IndentWidth: 2 | ||
| ColumnLimit: 80 | ||
|
|
||
| Language: Cpp | ||
| Standard: c++17 |
This file contains hidden or 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 hidden or 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 +1,10 @@ | ||
| * text eol=lf | ||
| *.bat eol=crlf | ||
|
|
||
| *.svg binary | ||
| *.jpg binary | ||
| *.jpeg binary | ||
| *.png binary | ||
| *.gif binary | ||
|
|
||
| *.h linguist-language=C++ |
This file contains hidden or 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,59 @@ | ||
| # See https://pre-commit.com for more information | ||
| # See https://pre-commit.com/hooks.html for more hooks | ||
| ci: | ||
| autofix_prs: true | ||
| autofix_commit_msg: "[Lint]: [pre-commit.ci] auto fixes [...]" | ||
| autoupdate_commit_msg: "[CI] [pre-commit.ci] autoupdate" | ||
| autoupdate_schedule: monthly | ||
| default_stages: [pre-commit, pre-push, manual] | ||
| exclude: '^(build|3rdparty)/.*$' # exclude build and 3rdparty directories | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: check-symlinks | ||
| - id: destroyed-symlinks | ||
| # FIXME: enable these hooks | ||
| # - id: trailing-whitespace | ||
| # - id: end-of-file-fixer | ||
| - id: check-added-large-files | ||
| - id: check-merge-conflict | ||
| fail_fast: true | ||
| # FIXME: enable these hooks | ||
| # - id: check-executables-have-shebangs | ||
| # - id: check-shebang-scripts-are-executable | ||
| - id: detect-private-key | ||
| - id: check-yaml | ||
| - id: check-toml | ||
| - id: check-ast | ||
| fail_fast: true | ||
| - id: debug-statements | ||
| - repo: https://github.com/pre-commit/mirrors-clang-format | ||
| rev: v15.0.7 # sync with requirements-lint.txt | ||
| hooks: | ||
| - id: clang-format | ||
| exclude: | | ||
| (?ix)( | ||
| ^.+\.json$ | ||
| ) | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.14.0 # sync with requirements-lint.txt | ||
| hooks: | ||
| - id: ruff-check | ||
| args: [--fix, --exit-non-zero-on-fix] | ||
| - repo: https://github.com/google/yapf | ||
| rev: v0.43.0 # sync with requirements-lint.txt | ||
| hooks: | ||
| - id: yapf | ||
| args: [--recursive, --in-place] | ||
| - repo: https://github.com/codespell-project/codespell | ||
| rev: v2.4.1 # sync with requirements-lint.txt | ||
| hooks: | ||
| - id: codespell | ||
| additional_dependencies: [".[toml]"] | ||
| exclude: | | ||
| (?x)( | ||
| ^.+\.(cpp|hpp|cxx|cc|c|h|cu|cuh)$| | ||
| ^.+\.svg$| | ||
| ^.*\brequirements\b.*\.txt$ | ||
| ) |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -2,14 +2,19 @@ | |
|
|
||
| That would be awesome if you want to contribute something to TileLang! | ||
|
|
||
| - [Contributing](CONTRIBUTING.md#contributing) | ||
| - [Reporting Bugs](CONTRIBUTING.md#reporting-bugs) | ||
| - [Asking Questions](CONTRIBUTING.md#asking-questions) | ||
| - [Submitting Pull Requests](CONTRIBUTING.md#submitting-pull-requests) | ||
| - [Repository Setup](CONTRIBUTING.md#repository-setup) | ||
| - [Running Tests](CONTRIBUTING.md#running-tests) | ||
| ### Table of Contents <!-- omit in toc --> <!-- markdownlint-disable heading-increment --> | ||
|
|
||
| ## Reporting Bugs | ||
| - [Report Bugs](#report-bugs) | ||
| - [Ask Questions](#ask-questions) | ||
| - [Submit Pull Requests](#submit-pull-requests) | ||
| - [Setup Development Environment](#setup-development-environment) | ||
| - [Install Develop Version](#install-develop-version) | ||
| - [Lint Check](#lint-check) | ||
| - [Test Locally](#test-locally) | ||
| - [Build Wheels](#build-wheels) | ||
| - [Documentation](#documentation) | ||
|
|
||
| ## Report Bugs | ||
|
|
||
| If you run into any weird behavior while using TileLang, feel free to open a new issue in this repository! Please run a **search before opening** a new issue, to make sure that someone else hasn't already reported or solved the bug you've found. | ||
|
|
||
|
|
@@ -18,35 +23,86 @@ Any issue you open must include: | |
| - Code snippet that reproduces the bug with a minimal setup. | ||
| - A clear explanation of what the issue is. | ||
|
|
||
|
|
||
| ## Asking Questions | ||
| ## Ask Questions | ||
|
|
||
| Please ask questions in issues. | ||
|
|
||
| ## Submitting Pull Requests | ||
| ## Submit Pull Requests | ||
|
|
||
| All pull requests are super welcomed and greatly appreciated! Issues in need of a solution are marked with a [`♥ help`](https://github.com/ianstormtaylor/TileLang/issues?q=is%3Aissue+is%3Aopen+label%3A%22%E2%99%A5+help%22) label if you're looking for somewhere to start. | ||
|
|
||
| Please run `./format.sh` before submitting a pull request to make sure that your code is formatted correctly. | ||
| If you're new to contributing to TileLang, you can follow the following guidelines before submitting a pull request. | ||
|
|
||
| > [!NOTE] | ||
| > Please include tests and docs with every pull request if applicable! | ||
|
|
||
| ## Setup Development Environment | ||
|
|
||
| Before contributing to TileLang, please follow the instructions below to setup. | ||
|
|
||
| 1. Fork TileLang ([fork](https://github.com/tile-ai/tilelang/fork)) on GitHub and clone the repository. | ||
|
|
||
| ```bash | ||
| git clone --recurse-submodules [email protected]:<your username>/tilelang.git # use the SSH protocol | ||
| cd tilelang | ||
|
|
||
| git remote add upstream [email protected]:tile-ai/tilelang.git | ||
| ``` | ||
|
|
||
| 2. Setup a development environment: | ||
|
|
||
| ```bash | ||
| uv venv --seed venv # use `python3 -m venv venv` if you don't have `uv` | ||
|
|
||
| source venv/bin/activate | ||
| python3 -m pip install --upgrade pip setuptools wheel "build[uv]" | ||
| uv pip install --requirements requirements-dev.txt | ||
| ``` | ||
|
|
||
| 3. Setup the [`pre-commit`](https://pre-commit.com) hooks: | ||
|
|
||
| ```bash | ||
| pre-commit install --install-hooks | ||
| ``` | ||
|
|
||
| Please include tests and docs with every pull request! | ||
| Then you are ready to rock. Thanks for contributing to TileLang! | ||
|
|
||
| ## Repository Setup | ||
| ## Install Develop Version | ||
|
|
||
| To run the build, you need to have the TileLang repository cloned to your computer. After that, you need to `cd` into the directory where you cloned it, and install the dependencies with `python`: | ||
| To install TileLang in an "editable" mode, run: | ||
|
|
||
| ```bash | ||
| python setup.py install | ||
| python3 -m pip install --no-build-isolation --verbose --editable . | ||
| ``` | ||
|
|
||
| in the main directory. This installation is removable by: | ||
|
|
||
| ## Running Tests | ||
| ```bash | ||
| python3 -m pip uninstall tilelang | ||
| ``` | ||
|
|
||
| ## Lint Check | ||
|
|
||
| To check the linting, run: | ||
|
|
||
| ```bash | ||
| pre-commit run --all-files | ||
| ``` | ||
|
|
||
| ## Test Locally | ||
|
|
||
| To run the tests, start by building the project as described in the [Repository Setup](CONTRIBUTING.md#repository-setup) section. | ||
| To run the tests, start by building the project as described in the [Setup Development Environment](#setup-development-environment) section. | ||
|
|
||
| Then you can rerun the tests with: | ||
|
|
||
| ```text | ||
| python -m pytest testing | ||
| ```bash | ||
| python3 -m pytest testing | ||
| ``` | ||
|
|
||
| ## Build Wheels | ||
|
|
||
| _TBA_ | ||
|
|
||
| ## Documentation | ||
|
|
||
| _TBA_ | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.