Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,112 @@ repos:
rev: 25.1.0
hooks:
- id: black
exclude: |
(?x)^(
ci/.+

| cmake/.+

| r/.+

| paddle/scripts/.+

| setup.py

# | paddle/.+

# | python/paddle/[a-c].+

# | python/paddle/de.+

# | python/paddle/distributed/a.+

# | python/paddle/distributed/[b-e].+

# | python/paddle/distributed/f.+

# | python/paddle/distributed/[g-z].+

# | python/paddle/[e-i].+

# | python/paddle/j.+

# | python/paddle/[k-n].+

# | python/paddle/[o-t].+

# | python/paddle/[u-z].+

# | python/_.+

# | test/a.+

# | test/[b-h].+

# | test/[i-k].+

# | test/l.+

# | test/[m-z].+

# | tools/.+
)$
Copy link
Member

Choose a reason for hiding this comment

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

由于 exclude 不能写注释所以不能写注释防止冲突

我试了下应该可以,之后每个 PR 注释下面,解开上面就好了

特意空一行以免冲突

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix, --no-cache]
- id: ruff-format
exclude: |
(?x)^(
# ci/.+

# | cmake/.+

# | r/.+

# | paddle/scripts/.+

# | setup.py

| paddle/.+

| python/paddle/[a-c].+

| python/paddle/de.+

| python/paddle/distributed/a.+

| python/paddle/distributed/[b-e].+

| python/paddle/distributed/f.+

| python/paddle/distributed/[g-z].+

| python/paddle/[e-i].+

| python/paddle/j.+

| python/paddle/[k-n].+

| python/paddle/[o-t].+

| python/paddle/[u-z].+

| python/_.+

| test/a.+

| test/[b-h].+

| test/[i-k].+

| test/l.+

| test/[m-z].+

| tools/.+
)$
# For C++ files
- repo: local
hooks:
Expand Down
42 changes: 21 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@

# check cmake
CMAKE = shutil.which('cmake3') or shutil.which('cmake')
assert (
CMAKE
), 'The "cmake" executable is not found. Please check if Cmake is installed.'
assert CMAKE, (
'The "cmake" executable is not found. Please check if Cmake is installed.'
)


TOP_DIR = os.path.dirname(os.path.realpath(__file__))
Expand Down Expand Up @@ -312,10 +312,10 @@ def git_commit() -> str:


def _get_version_detail(idx):
assert (
idx < 3
), "version info consists of %(major)d.%(minor)d.%(patch)d, \
assert idx < 3, (
"version info consists of %(major)d.%(minor)d.%(patch)d, \
so detail index must less than 3"
)
tag_version_regex = env_dict.get("TAG_VERSION_REGEX")
paddle_version = env_dict.get("PADDLE_VERSION")
if re.match(tag_version_regex, paddle_version):
Expand Down Expand Up @@ -1154,21 +1154,21 @@ def get_paddle_extra_install_requirements():
),
}
if env_dict.get("WITH_CINN") == "ON":
PADDLE_CUDA_INSTALL_REQUIREMENTS[
"12.3"
] += " | nvidia-cuda-cccl-cu12==12.3.52;platform_system == 'Linux' and platform_machine == 'x86_64' "
PADDLE_CUDA_INSTALL_REQUIREMENTS[
"12.4"
] += " | nvidia-cuda-cccl-cu12==12.4.99;platform_system == 'Linux' and platform_machine == 'x86_64' "
PADDLE_CUDA_INSTALL_REQUIREMENTS[
"12.6"
] += " | nvidia-cuda-cccl-cu12==12.6.77;platform_system == 'Linux' and platform_machine == 'x86_64' "
PADDLE_CUDA_INSTALL_REQUIREMENTS[
"12.8"
] += " | nvidia-cuda-cccl-cu12==12.8.90;platform_system == 'Linux' and platform_machine == 'x86_64' "
PADDLE_CUDA_INSTALL_REQUIREMENTS[
"12.9"
] += " | nvidia-cuda-cccl-cu12==12.9.27;platform_system == 'Linux' and platform_machine == 'x86_64' "
PADDLE_CUDA_INSTALL_REQUIREMENTS["12.3"] += (
" | nvidia-cuda-cccl-cu12==12.3.52;platform_system == 'Linux' and platform_machine == 'x86_64' "
)
PADDLE_CUDA_INSTALL_REQUIREMENTS["12.4"] += (
" | nvidia-cuda-cccl-cu12==12.4.99;platform_system == 'Linux' and platform_machine == 'x86_64' "
)
PADDLE_CUDA_INSTALL_REQUIREMENTS["12.6"] += (
" | nvidia-cuda-cccl-cu12==12.6.77;platform_system == 'Linux' and platform_machine == 'x86_64' "
)
PADDLE_CUDA_INSTALL_REQUIREMENTS["12.8"] += (
" | nvidia-cuda-cccl-cu12==12.8.90;platform_system == 'Linux' and platform_machine == 'x86_64' "
)
PADDLE_CUDA_INSTALL_REQUIREMENTS["12.9"] += (
" | nvidia-cuda-cccl-cu12==12.9.27;platform_system == 'Linux' and platform_machine == 'x86_64' "
)

elif platform.system() == 'Windows':
PADDLE_CUDA_INSTALL_REQUIREMENTS = {
Expand Down