-
Notifications
You must be signed in to change notification settings - Fork 6
/
pyproject.toml
91 lines (84 loc) · 2.73 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
[build-system]
requires = [
"ninja",
"setuptools",
"torch",
"wheel",
]
[tool.cibuildwheel]
build = "cp310-* cp311-* cp312-*"
skip = "*musllinux*"
# If more than one wheel is built (e.g. cp310 and cp311), the second wheel fails due to a non-clean build directory
# Hence, we just delete it to start fresh
before-build = """\
python -c "import shutil; shutil.rmtree('build', ignore_errors=True)"\
"""
before-test = "pip install pytest"
test-command = [
'''python -c "import os; from importlib.metadata import version; assert 'v' + version('imsy-htc') == os.getenv('CI_COMMIT_TAG'), os.getenv('CI_COMMIT_TAG')"''',
'''py.test --doctest-modules --import-mode=importlib --collect-only --pyargs "htc" "htc_projects"''',
'''python -c "from htc import settings; assert settings.src_dir == settings.htc_package_dir, settings.src_dir"''',
]
[tool.cibuildwheel.linux]
archs = [ "x86_64" ]
# We are excluding all the libraries which PyTorch provides
repair-wheel-command = "auditwheel repair --exclude libtorch_cpu.so --exclude libtorch_python.so --exclude libtorch.so --exclude libc10.so -w {dest_dir} {wheel}"
[tool.cibuildwheel.macos]
archs = [ "auto" ]
repair-wheel-command = "delocate-wheel --ignore-missing-dependencies --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
[tool.cibuildwheel.windows]
archs = [ "AMD64" ]
[tool.ruff]
target-version = "py310"
line-length = 120
format.preview = true
format.docstring-code-line-length = 120
format.docstring-code-format = true
# TODO: enable at some point: E721, NPY002, SIM
lint.extend-select = [
"A",
"B",
"C4",
"D",
"FLY",
"FURB",
"I",
"NPY",
"PERF",
"PIE",
"PTH",
"RUF",
"T10",
"TCH",
"UP",
"YTT",
]
lint.ignore = [
"B007", # It can be intended to name loop variables even if they are not used
"B023", # Leads to a lot of false alarms
"B027", # It is totally valid to prepare more methods in an abstract class without forcing them to be abstract
"C408", # We still want to use the dict(key=value) syntax
# pydocstyle has a lot of irrelevant checks by default. We are mainly interested in D417 (checks for missing arguments)
"D1",
"D200",
"D202",
"D205",
"D212",
"D400",
"D401",
"D402",
"D415",
"E721",
"E731", # Assigning lambdas to variables can be cleaner
"E741", # Usually not an issue
"F841", # Does not detect df.query usage
"NPY002", # Requires manual changes and testing
"PERF203", # Not so relevant anymore in Python 3.11+
"PERF401", # May lead to too complex code
"RUF001", # Explicitly intended
"RUF003", # Same
"RUF013", # Produces unnecessary complexity
]
lint.per-file-ignores."__init__.py" = [ "F401" ]
lint.unfixable = [ "B905" ] # We don't want strict=False but strict=True
lint.pydocstyle.convention = "google"