Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
update output
  • Loading branch information
arihant2math committed Apr 23, 2025
commit b574d91174fda6ab44140e761c7b0a0d318fbb74
67 changes: 32 additions & 35 deletions scripts/generate_checklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@

parser = argparse.ArgumentParser(description="Find equivalent files in cpython and rustpython")
parser.add_argument("--cpython", type=pathlib.Path, required=True, help="Path to cpython source code")
parser.add_argument("--updated-libs", type=pathlib.Path, required=False,
help="Libraries that have been updated in RustPython")
parser.add_argument("--notes", type=pathlib.Path, required=False, help="Path to notes file")

args = parser.parse_args()

def check_pr(pr_id) -> bool:
def check_pr(pr_id: str) -> bool:
if pr_id.startswith("#"):
pr_id = pr_id[1:]
pr_id = int(pr_id)
req = f"https://api.github.com/repos/RustPython/RustPython/pulls/{pr_id}"
int_pr_id = int(pr_id)
req = f"https://api.github.com/repos/RustPython/RustPython/pulls/{int_pr_id}"
response = requests.get(req).json()
return response["merged_at"] is not None

Expand All @@ -34,38 +32,37 @@ class LibUpdate:
pr: Optional[str] = None
done: bool = True

updated_libs = {}
if args.updated_libs:
# check if the file exists in the rustpython lib directory
updated_libs_path = args.updated_libs
if updated_libs_path.exists():
with open(updated_libs_path) as f:
for line in f:
line = line.strip()
if not line.startswith("//") and line:
line = line.split(" ")
if len(line) == 2:
is_done = True
try:
is_done = check_pr(line[1])
except Exception as e:
warnings.warn(f"Failed to check PR {line[1]}: {e}")
updated_libs[line[0]] = LibUpdate(line[1])
elif len(line) == 1:
updated_libs[line[0]] = LibUpdate()
else:
raise ValueError(f"Invalid line: {line}")
def parse_updated_lib_issue(issue_body: str) -> dict[str, LibUpdate]:
lines = issue_body.splitlines()
updated_libs = {}
for line in lines:
if line.strip().startswith("- "):
line = line.strip()[2:]
out = line.split(" ")
out = [x for x in out if x]
assert len(out) < 3
if len(out) == 1:
updated_libs[out[0]] = LibUpdate()
elif len(out) == 2:
updated_libs[out[0]] = LibUpdate(out[1], check_pr(out[1]))
return updated_libs

def get_updated_libs() -> dict[str, LibUpdate]:
issue_id = "5736"
req = f"https://api.github.com/repos/RustPython/RustPython/issues/{issue_id}"
response = requests.get(req).json()
return parse_updated_lib_issue(response["body"])

updated_libs = get_updated_libs()

else:
raise FileNotFoundError(f"Path {updated_libs_path} does not exist")
if not args.cpython.exists():
raise FileNotFoundError(f"Path {args.cpython} does not exist")
if not args.cpython.is_dir():
raise NotADirectoryError(f"Path {args.cpython} is not a directory")
if not args.cpython.is_absolute():
args.cpython = args.cpython.resolve()

notes = {}
notes: dict = {}
if args.notes:
# check if the file exists in the rustpython lib directory
notes_path = args.notes
Expand All @@ -74,13 +71,13 @@ class LibUpdate:
for line in f:
line = line.strip()
if not line.startswith("//") and line:
line = line.split(" ")
if len(line) > 1:
rest = " ".join(line[1:])
if line[0] in notes:
notes[line[0]].append(rest)
line_split = line.split(" ")
if len(line_split) > 1:
rest = " ".join(line_split[1:])
if line_split[0] in notes:
notes[line_split[0]].append(rest)
else:
notes[line[0]] = [rest]
notes[line_split[0]] = [rest]
else:
raise ValueError(f"Invalid note: {line}")

Expand Down
48 changes: 48 additions & 0 deletions scripts/notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
__future__ Related test is `test_future_stmt`
abc `_collections_abc.py`
abc `_py_abc.py`
code Related test is `test_code_module`
codecs `_pycodecs.py`
collections See also #3418
ctypes #5572
datetime `_pydatetime.py`
decimal `_pydecimal.py`
dis See also #3846
importlib #4565
io `_pyio.py`
io #3960
io #4702
locale #3850
mailbox #4072
multiprocessing #3965
os Blocker: Some tests requires async comprehension
os #3960
os #4053
pickle #3876
pickle `_compat_pickle.py`
pickle `test/pickletester.py` supports `test_pickle.py`
pickle `test/test_picklebuffer.py`
pydoc `pydoc_data`
queue See also #3608
re Don't forget sre files `sre_compile.py`, `sre_constants.py`, `sre_parse.py`
shutil #3960
site Don't forget `_sitebuiltins.py`
venv #3960
warnings #4013

// test

test_array #3876
test_gc #4158
test_marshal #3458
test_mmap #3847
test_posix #4496
test_property #3430
test_set #3992
test_structseq #4063
test_super #3865
test_support #4538
test_syntax #4469
test_sys #4541
test_time #3850
test_time #4157
Loading