Skip to content

Commit b75067b

Browse files
committed
Added Ruff config.
1 parent f944319 commit b75067b

File tree

5 files changed

+173
-6
lines changed

5 files changed

+173
-6
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
set -x
105105
bash -e -o pipefail -- mlucas.sh ANONYMOUS
106106
echo -e '## Warnings\n```' >> $GITHUB_STEP_SUMMARY
107-
grep 'warning:' Mlucas/obj/build.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?m//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
107+
grep 'warning:' Mlucas/obj/build.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?[mK]//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
108108
echo '```' >> $GITHUB_STEP_SUMMARY
109109
- uses: actions/upload-artifact@v4
110110
if: always()
@@ -141,5 +141,5 @@ jobs:
141141
python3 -m pip install --upgrade pip
142142
python3 -m pip install ruff
143143
- name: Script
144-
run: ruff check --output-format=github --target-version py37 --select F,E4,E7,E9,W,I,D,UP,YTT,S,BLE,B,A,COM819,C4,T10,EM,EXE,ISC,ICN,G,PIE,PYI,Q,RSE,RET,SLF,SLOT,SIM,TID,TCH,ARG,PGH,PL,TRY,PERF,FURB,LOG,RUF --preview --ignore W191,D211,D213,D401,UP004,UP008,UP009,UP010,UP024,UP030,UP032,UP036,PYI024,PLR09,PLR1702,PLR2004,S324,S404,S603,FURB101,FURB167,RUF001,RUF002,RUF003,RUF005,RUF023 .
144+
run: ruff check --output-format=github .
145145
continue-on-error: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Pull requests welcome! Ideas for contributions:
106106
* Update install scripts to support CLI options
107107
* Add options for setting the maximum CPU time
108108
* Update CUDALucas to support PRP tests and the Jacobi error check for LL tests
109-
* Update Mlucas to support the Jacobi error check for LL and P-1 tests
109+
* Update Mlucas to support the Jacobi error check for LL and P-1 tests, and proof generation for PRP tests
110110
* Finish and improve the performance of [TensorPrime](https://github.com/TPU-Mersenne-Prime-Search/TensorPrime), the [Tensor Processing Unit](https://en.wikipedia.org/wiki/Tensor_Processing_Unit) (TPU) GIMPS program (see [here](https://github.com/TPU-Mersenne-Prime-Search/TensorPrime/wiki#results-and-next-steps))
111111

112112
Thanks to [Daniel Connelly](https://github.com/Danc2050) for porting the MPrime script to Python and for helping create and test the Google Colab Jupyter Notebooks!

google-colab/pyproject.toml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
[tool.ruff]
2+
line-length = 132 # 88
3+
indent-width = 2
4+
5+
target-version = "py310"
6+
7+
preview = true
8+
9+
output-format = "concise"
10+
11+
[tool.ruff.lint]
12+
select = [
13+
"F",
14+
"E4",
15+
"E7",
16+
"E9",
17+
"W",
18+
"I",
19+
"D",
20+
"UP",
21+
"YTT",
22+
"S",
23+
"BLE",
24+
"B",
25+
"A",
26+
"COM819",
27+
"C4",
28+
"T10",
29+
"EM",
30+
"EXE",
31+
"ISC",
32+
"ICN",
33+
"G",
34+
"PIE",
35+
"PYI",
36+
"Q",
37+
"RSE",
38+
"RET",
39+
"SLF",
40+
"SLOT",
41+
"SIM",
42+
"TID",
43+
"TCH",
44+
"ARG",
45+
"PGH",
46+
"PL",
47+
"TRY",
48+
"FLY",
49+
"PERF",
50+
"FURB",
51+
"LOG",
52+
"RUF"
53+
]
54+
ignore = [
55+
"W191",
56+
"D211",
57+
"D213",
58+
"D300",
59+
"D401",
60+
"PLR09",
61+
"PLR1702",
62+
"PLR2004",
63+
"S103",
64+
"FURB101",
65+
"FURB167",
66+
"RUF001",
67+
"RUF002",
68+
"RUF003",
69+
"RUF023"
70+
]
71+
72+
unfixable = ["F841"]
73+
74+
[tool.ruff.lint.isort]
75+
split-on-trailing-comma = false
76+
77+
[tool.ruff.lint.flake8-quotes]
78+
docstring-quotes = "single"
79+
inline-quotes = "single"
80+
multiline-quotes = "single"
81+
82+
[tool.ruff.format]
83+
quote-style = "preserve"
84+
85+
indent-style = "space"
86+
87+
skip-magic-trailing-comma = true

mprime-python-port/mprime.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ def sha256sum(filename):
6666
import requests
6767
except ImportError:
6868
print(
69-
"""Please run the below command to install the Requests library:
69+
f"""Please run the below command to install the Requests library:
7070
71-
{0} -m pip install requests
71+
{os.path.basename(sys.executable) if sys.executable else "python3"} -m pip install requests
7272
73-
Then, run the script again.""".format(os.path.basename(sys.executable) if sys.executable else "python3")
73+
Then, run the script again."""
7474
)
7575
sys.exit(0)
7676
# ----------------------------#

pyproject.toml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
[tool.ruff]
2+
line-length = 132 # 88
3+
indent-width = 4
4+
5+
target-version = "py37"
6+
7+
preview = true
8+
9+
output-format = "concise"
10+
11+
[tool.ruff.lint]
12+
select = [
13+
"F",
14+
"E4",
15+
"E7",
16+
"E9",
17+
"W",
18+
"I",
19+
# "D",
20+
"UP",
21+
"YTT",
22+
"S",
23+
"BLE",
24+
"B",
25+
"A",
26+
"COM819",
27+
"C4",
28+
"T10",
29+
"EM",
30+
"EXE",
31+
"ISC",
32+
"ICN",
33+
"G",
34+
"PIE",
35+
"PYI",
36+
"Q",
37+
"RSE",
38+
"RET",
39+
"SLF",
40+
"SLOT",
41+
"SIM",
42+
"TID",
43+
"TCH",
44+
"ARG",
45+
"PGH",
46+
"PL",
47+
"TRY",
48+
"FLY",
49+
"PERF",
50+
"FURB",
51+
"LOG",
52+
"RUF"
53+
]
54+
ignore = [
55+
"W191",
56+
"D211",
57+
"D213",
58+
"D401",
59+
"PLR09",
60+
"PLR1702",
61+
"PLR2004",
62+
"S404",
63+
"S603",
64+
"FURB101",
65+
"FURB167",
66+
"RUF001",
67+
"RUF002",
68+
"RUF003",
69+
"RUF023"
70+
]
71+
72+
[tool.ruff.lint.isort]
73+
split-on-trailing-comma = false
74+
75+
[tool.ruff.format]
76+
quote-style = "double"
77+
78+
indent-style = "space" # "tab"
79+
80+
skip-magic-trailing-comma = true

0 commit comments

Comments
 (0)