Skip to content

Conversation

XuehaiPan
Copy link
Contributor

@XuehaiPan XuehaiPan commented Oct 20, 2025

Resolves #1044 (comment)

Example usages:

USE_CUDA=ON make install-editable

USE_CUDA=ON make clang-tidy

make test
make test PYTESTOPTS="--maxfail=3 --numprocesses=4"

make pre-commit
make yapf
make ruff-fix
make format
make lint
make docs
make clean

cc @LeiWang1999

Summary by CodeRabbit

  • Chores

    • Added a comprehensive project Makefile providing one-command workflows for setup, optional editable installs, dependency checks, test execution, formatting, linting, C++ build/analysis, docs build/serve, and cleanup.
    • Updated packaging manifest and packaging rules to include additional metadata and adjust included/excluded files.
    • Added ignore rules for CMake build artifacts and configured the linter to skip common build and virtual-environment directories.
  • Documentation

    • Updated contributor instructions to use Make targets for install, lint, and local docs build/serve.

Copy link

👋 Hi! Thank you for contributing to the TileLang project.

Please remember to run pre-commit run --all-files in the root directory of the project to ensure your changes are properly linted and formatted. This will help ensure your contribution passes the format check.

We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀

Copy link
Contributor

coderabbitai bot commented Oct 20, 2025

Walkthrough

Adds a comprehensive Makefile providing targets for installation, editable installs, uninstall, formatting, linting, testing, C/C++ build, docs, and cleanup. Updates CONTRIBUTING.md to reference Make targets and local docs serving. Adds CMake ignores to .gitignore, refines Ruff excludes in pyproject.toml, and revises MANIFEST.in packaging entries and prunes.

Changes

Cohort / File(s) Summary
Build Infrastructure
Makefile
New Makefile with project metadata and many phony targets: install / install-editable / uninstall, pre-commit-install, format (python-format, yapf, ruff, clang-format), lint (format + clang-tidy), test (import check + pytest), docs (sphinx / sphinx-autobuild), cmake-configure / cmake-build, and multiple clean targets for Python, builds, docs, and caches.
Contributor Docs
CONTRIBUTING.md
Replaced direct Python commands with Make targets (e.g., make install-editable, make lint) and added instructions to build and serve docs locally via make docs with watch behavior and example URL.
Packaging Manifest
MANIFEST.in
Reworked manifest: adjusted explicit inclusions/exclusions, added files (LICENSE, THIRDPARTYNOTICES.txt, version_provider.py, Makefile, requirements*.txt), grafted directories (src, cmake, 3rdparty), pruned certain 3rdparty/compiled artifacts and common build outputs, and added global excludes.
VCS Ignore
.gitignore
Added CMake-related ignore entries under # CMake: cmake-build/ and cmake-build-*/.
Tooling config
pyproject.toml
Updated [tool.ruff] with an exclude list (e.g., build, 3rdparty, dist, .venv) so Ruff skips common build and virtualenv directories.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer
  participant Make as make
  participant Shell as Shell/Env
  participant Py as Python tools
  participant Cpp as C/C++ tools
  participant Docs as Sphinx

  Dev->>Make: make <target> (install / install-editable / test / format / docs / cmake-build)
  Make->>Shell: set flags, check PATH, read project metadata
  alt Python targets
    Make->>Py: check/install pip deps, pre-commit, yapf, ruff, pytest
    Py-->>Make: run formatting/lint/tests -> results
  else C/C++ targets
    Make->>Cpp: check/install cmake, clang-format, clang-tidy
    Cpp-->>Make: configure/build/format/lint -> results
  else Docs
    Make->>Py: install docs deps
    Make->>Docs: sphinx-build / sphinx-autobuild (watch & serve)
    Docs-->>Make: serve URL/logs
  end
  Make-->>Dev: exit code & logs
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • LeiWang1999

Poem

I nibble targets, tidy and neat,
Pip and CMake tap soft tiny feet,
Tests hop forward, docs hum bright,
One Makefile guides the day and night,
🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "[Maint] add Makefile to replace format.sh" is directly related to the main change in this changeset. The PR introduces a comprehensive Makefile as its primary contribution, which is accurately reflected in the title. The supporting changes to CONTRIBUTING.md (to reference Make targets), .gitignore, pyproject.toml, and MANIFEST.in are all aligned with integrating this new Makefile into the project workflow. The title is concise, uses standard maintenance convention notation, and clearly communicates the primary objective without vague language or unnecessary noise.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd1b246 and d810d57.

📒 Files selected for processing (1)
  • pyproject.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Test for Python 3.12 with CUDA-12.8 (on self-hosted-nvidia)
  • GitHub Check: Test for Python 3.12 with Metal (on macos-latest)
  • GitHub Check: Build wheels for Python 3.8 on ubuntu-latest with CUDA-12.1
  • GitHub Check: Build wheels for Python 3.8 on macos-latest with Metal
  • GitHub Check: Build wheels for Python 3.8 on ubuntu-24.04-arm with CUDA-12.8

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
Makefile (1)

166-167: Add the standard all target.

Static analysis tools and Makefile conventions expect an all phony target. While the current default target provides similar functionality, adding all as an alias or primary target improves convention compliance.

Consider adding the all target:

+.PHONY: all
+all: default
+
 .PHONY: default
 default: install

Alternatively, rename default to all if it better reflects the intended primary workflow.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc37ea6 and a617393.

📒 Files selected for processing (1)
  • Makefile (1 hunks)
🧰 Additional context used
🪛 checkmake (0.2.2)
Makefile

[warning] 166-166: Missing required phony target "all"

(minphony)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test for Python 3.12 with Metal (on macos-latest)
  • GitHub Check: Test for Python 3.12 with ROCm-6.3 (on self-hosted-amd)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
Makefile (2)

35-35: Remove cd && from the check_pip_install helper—this issue was flagged in review but remains unfixed.

The helper invokes cd && which changes to $HOME before installing packages. This is problematic in CI/CD environments or workspaces with specific isolation requirements, and it's unnecessary for package installation. Packages install correctly in the current environment.

Apply this diff to remove the directory change:

-check_pip_install = $(PYTHON) -m pip show $(1) &>/dev/null || (cd && $(PYTHON) -m pip install --upgrade $(1))
+check_pip_install = $(PYTHON) -m pip show $(1) &>/dev/null || $(PYTHON) -m pip install --upgrade $(1)

150-151: Separate lint and format concerns—this issue was flagged in review but remains unfixed.

The lint target depends on format, which means make lint automatically reformats code before linting. This violates separation of concerns: linting should check code without modifying it. Users may not expect their code to be changed by a lint target. Keep format for modifications and lint for checks only.

Consider restructuring:

 .PHONY: format
 format: pre-commit python-format ruff clang-format
 
 .PHONY: lint
-lint: format clang-tidy
+lint: pre-commit python-format ruff clang-format clang-tidy

Alternatively, rename a combined target to format-and-lint to signal both operations occur.

🧹 Nitpick comments (1)
Makefile (1)

16-17: Add an all phony target per Makefile conventions.

Static analysis tools expect an all target as the canonical default. While default works, consider adding all for broader compatibility:

+.PHONY: all
+all: install
+
 .PHONY: default
 default: install

Alternatively, set .DEFAULT_GOAL := install at the top of the file to specify the implicit default.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a617393 and 17ece1e.

📒 Files selected for processing (1)
  • Makefile (1 hunks)
🧰 Additional context used
🪛 checkmake (0.2.2)
Makefile

[warning] 166-166: Missing required phony target "all"

(minphony)

🔇 Additional comments (2)
Makefile (2)

1-17: Project metadata and defaults are well-structured.

The shell configuration with strict error handling (-eu -o pipefail) and comprehensive file discovery patterns (Python, C++, CUDA) provide a solid foundation. The explicit inclusion of version_provider.py at the root is a good defensive measure.


91-95: LGTM – yapf configuration is correct.

The flags --in-place and --parallel are complementary and appropriate. The pre-check for docs/conf.py handles a special case gracefully.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
Makefile (2)

35-35: Unresolved: Remove cd && from the check_pip_install helper function.

This was previously flagged but remains unaddressed. The helper invokes cd && which changes to the home directory before installing packages. This is problematic in CI/CD environments or isolated workspaces—packages should install in the current environment regardless of working directory.

Apply this diff to fix:

-check_pip_install = $(PYTHON) -m pip show $(1) &>/dev/null || (cd && $(PYTHON) -m pip install --upgrade $(1))
+check_pip_install = $(PYTHON) -m pip show $(1) &>/dev/null || $(PYTHON) -m pip install --upgrade $(1)

152-153: Unresolved: Separate lint and format targets.

This was previously flagged but remains unaddressed. The lint target depends on format, causing make lint to automatically reformat code. This violates separation of concerns—linting should check code without modifying it. Users may not expect their code to be modified by a lint target.

Apply this diff to fix:

 .PHONY: format
 format: pre-commit python-format ruff clang-format
 
 .PHONY: lint
-lint: format clang-tidy
+lint: pre-commit python-format ruff clang-format clang-tidy
🧹 Nitpick comments (1)
Makefile (1)

1-5: Add the .PHONY: all target.

Per Makefile best practices, an explicit all target should be defined and marked as phony. Currently, default points to install, but standard convention reserves all as the primary entry point.

Add this target definition near the top of the file after the metadata:

 .PHONY: default
 default: install
+
+.PHONY: all
+all: default
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17ece1e and 9ace086.

📒 Files selected for processing (1)
  • Makefile (1 hunks)
🧰 Additional context used
🪛 checkmake (0.2.2)
Makefile

[warning] 168-168: Missing required phony target "all"

(minphony)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test for Python 3.12 with ROCm-6.3 (on self-hosted-amd)
  • GitHub Check: Test for Python 3.12 with Metal (on macos-latest)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
CONTRIBUTING.md (1)

99-99: Update "Test Locally" section for consistency.

The "Install Develop Version" and "Lint Check" sections now reference Make targets, but the "Test Locally" section (line 99) still uses a direct python3 -m pytest command. Per the PR objectives, make test is a supported target.

For consistency, update line 99 to reference the Make target:

-Then you can rerun the tests with:
+Then you can rerun the tests with:

-```bash
-python3 -m pytest testing
-```
+```bash
+make test
+```
+
+You can also pass pytest options:
+
+```bash
+make test PYTESTOPTS="--maxfail=3 --numprocesses=4"
+```

This also exposes users to the flexibility of passing pytest options through the Makefile.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ace086 and e166548.

📒 Files selected for processing (1)
  • CONTRIBUTING.md (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test for Python 3.12 with Metal (on macos-latest)
  • GitHub Check: Test for Python 3.12 with ROCm-6.3 (on self-hosted-amd)
🔇 Additional comments (2)
CONTRIBUTING.md (2)

75-75: Make targets appropriately integrated. Good update to reference make install-editable and make lint instead of raw commands.

Also applies to: 89-89


108-114: Documentation section for make docs clearly describes the watch behavior. Good addition explaining the auto-rebuild and browser refresh capability, plus the localhost URL.

Verify that the Makefile's docs target actually implements the watch and auto-rebuild behavior described in the documentation.

@LeiWang1999
Copy link
Member

would also be great for developers to checkout this modifications, cc @chengyupku @Rachmanino @tzj-fxz @kurisu6912 @Elevator14B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants