Source: nala
Version: 0.16.0
Severity: normal

Dear Maintainer,

python3-tomli will be dropped someday.

Please hybridize you code to make it prefer tomllib.

tomllib is the name of the copy of tomli that
got merged in the standard lbirary from Python 3.11 and up

  https://wiki.debian.org/Python/Backports


Greetings

Alexandre







diff --git a/nala/options.py b/nala/options.py
index 7b92245..dde9270 100644
--- a/nala/options.py
+++ b/nala/options.py
@@ -30,7 +30,10 @@ from pydoc import pager
 from subprocess import run
 from typing import Dict, List, NoReturn, Optional, Union, cast
 
-import tomli
+try:
+    import tomllib
+except ImportError:
+    import tomli as tomllib
 import typer
 from apt_pkg import config as apt_config
 
@@ -53,8 +56,8 @@ class Config:
                """Read the configuration file."""
                try:
                        with open(self.conf, "rb") as file:
-                               self.data = tomli.load(file)
-               except (tomli.TOMLDecodeError, FileNotFoundError) as error:
+                               self.data = tomllib.load(file)
+               except (tomllib.TOMLDecodeError, FileNotFoundError) as error:
                        print(f"{ERROR_PREFIX} {error}")
                        print(
                                _(

Reply via email to