From 5404a4c968d6d23e70e57d05132135455ac1c40c Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Sun, 23 Nov 2025 10:28:23 -0800 Subject: [PATCH 1/2] Remove `atomicwrites` dependency --- dessert/rewrite.py | 24 +++++++++++++----------- pyproject.toml | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/dessert/rewrite.py b/dessert/rewrite.py index 1d9e2ca2..758e0087 100644 --- a/dessert/rewrite.py +++ b/dessert/rewrite.py @@ -21,8 +21,6 @@ from typing import Set from typing import Tuple -import atomicwrites - from . import util from .util import format_explanation as _format_explanation @@ -231,15 +229,19 @@ def _write_pyc(state, co, source_stat, pyc): # (C)Python, since these "pycs" should never be seen by builtin # import. However, there's little reason deviate. try: - with atomicwrites.atomic_write(pyc, mode="wb", overwrite=True, dir=tempfile.gettempdir()) as fp: - fp.write(importlib.util.MAGIC_NUMBER) - # as of now, bytecode header expects 32-bit numbers for size and mtime (#4903) - mtime = int(source_stat.st_mtime) & 0xFFFFFFFF - size = source_stat.st_size & 0xFFFFFFFF - # "=1.0", "attrs"] +dependencies = ["munch", "py", "attrs"] dynamic = ["version"] From 4e0090b3c6b9f1345568d90ed82a60ffdc23ab55 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Tue, 25 Nov 2025 09:16:19 -0800 Subject: [PATCH 2/2] Fix pylint --- dessert/rewrite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dessert/rewrite.py b/dessert/rewrite.py index 758e0087..7cd4ceae 100644 --- a/dessert/rewrite.py +++ b/dessert/rewrite.py @@ -241,7 +241,7 @@ def _write_pyc(state, co, source_stat, pyc): fp.write(marshal.dumps(co)) os.replace(tmp_file, pyc) - except EnvironmentError | OSError as e: + except (EnvironmentError, OSError) as e: _logger.debug("error writing pyc file at {}: errno={}".format(pyc, e.errno)) # we ignore any failure to write the cache file # there are many reasons, permission-denied, __pycache__ being a