Subject: [PATCH] gnu: dynaconf: Update to 3.2.4.
From: Giacomo Leidi <[email-masked]>
To: [email-masked]
Cc: Giacomo Leidi <[email-masked]>
Date: Sun, 14 Jan 2024 15:13:53 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/patches/dynaconf-unvendor-deps.patch: Update accordingly.
* gnu/packages/python-xyz.scm (dynaconf): Update to 3.2.4;
[source]<url>; https://github.com/rochacbruno/dynaconf now permanently
redirects to https://github.com/dynaconf/dynaconf ;
<snippet>: update unvendoring and lower coverage quality gate
for unit tests;
[build-system]: switch to pyproject-build-system;
[arguments]<test-flags>: disable tests that require Click 7 instead of
Click 8;
<phases>: comply with #:test-flags argument from pyproject-build-system;
[propagated-inputs]: add python-tomli.

Change-Id: I96597ec39d7aa2d3c3c169147640de19eaefe0b4
---
 .../patches/dynaconf-unvendor-deps.patch      | 172 +++++++++---------
 gnu/packages/python-xyz.scm                   |  39 ++--
 2 files changed, 108 insertions(+), 103 deletions(-)

diff --git a/gnu/packages/patches/dynaconf-unvendor-deps.patch b/gnu/packages/patches/dynaconf-unvendor-deps.patch
index 550e311363..f816264f4a 100644
--- a/gnu/packages/patches/dynaconf-unvendor-deps.patch
+++ b/gnu/packages/patches/dynaconf-unvendor-deps.patch
@@ -1,45 +1,46 @@
-From 3f7b48195500cbbbbecd3cac2f5308c64004479b Mon Sep 17 00:00:00 2001
+From d3252748b0f9036cb31f4697ebb5c6a494aceaca Mon Sep 17 00:00:00 2001
 From: Giacomo Leidi <[email-masked]>
-Date: Sun, 29 Aug 2021 23:39:27 +0200
+Date: Sun, 14 Jan 2024 12:05:49 +0100
 Subject: [PATCH] Use system site dependencies.
 
-Box was not unvendored because it appears to be heavily patched.
+* Box was not unvendored because it appears to be heavily patched.
+* Tomllib seems to be a backport from Python 3.11, as such it wasn't unvendored.
 ---
- dynaconf/cli.py                       | 4 ++--
- dynaconf/default_settings.py          | 2 +-
- dynaconf/loaders/env_loader.py        | 2 +-
- dynaconf/loaders/toml_loader.py       | 2 +-
- dynaconf/loaders/yaml_loader.py       | 2 +-
- dynaconf/utils/parse_conf.py          | 2 +-
- dynaconf/vendor/box/converters.py     | 4 ++--
- dynaconf/vendor/box/from_file.py      | 4 ++--
- dynaconf/vendor_src/box/converters.py | 4 ++--
- dynaconf/vendor_src/box/from_file.py  | 4 ++--
- tests/test_cli.py                     | 2 +-
- 11 files changed, 16 insertions(+), 16 deletions(-)
+ dynaconf/cli.py                   | 4 ++--
+ dynaconf/default_settings.py      | 2 +-
+ dynaconf/loaders/env_loader.py    | 2 +-
+ dynaconf/loaders/toml_loader.py   | 2 +-
+ dynaconf/loaders/yaml_loader.py   | 2 +-
+ dynaconf/utils/inspect.py         | 2 +-
+ dynaconf/utils/parse_conf.py      | 2 +-
+ dynaconf/vendor/box/converters.py | 2 +-
+ dynaconf/vendor/box/from_file.py  | 2 +-
+ tests/test_cli.py                 | 2 +-
+ tests/test_inspect.py             | 2 +-
+ 11 files changed, 12 insertions(+), 12 deletions(-)
 
 diff --git a/dynaconf/cli.py b/dynaconf/cli.py
-index 5bb8316..1341a95 100644
+index c0fd489..5739e79 100644
 --- a/dynaconf/cli.py
 +++ b/dynaconf/cli.py
-@@ -20,8 +20,8 @@ from dynaconf.utils.functional import empty
- from dynaconf.utils.parse_conf import parse_conf_data
+@@ -24,8 +24,8 @@ from dynaconf.utils.parse_conf import parse_conf_data
+ from dynaconf.utils.parse_conf import unparse_conf_data
  from dynaconf.validator import ValidationError
  from dynaconf.validator import Validator
 -from dynaconf.vendor import click
 -from dynaconf.vendor import toml
 +import click
 +import toml
+ from dynaconf.vendor import tomllib

- CWD = Path.cwd()
 diff --git a/dynaconf/default_settings.py b/dynaconf/default_settings.py
-index 66601b0..9605fc5 100644
+index 7e8c222..526b01e 100644
 --- a/dynaconf/default_settings.py
 +++ b/dynaconf/default_settings.py
-@@ -8,7 +8,7 @@ from dynaconf.utils import upperfy
- from dynaconf.utils import warn_deprecations
+@@ -11,7 +11,7 @@ from dynaconf.utils import warn_deprecations
  from dynaconf.utils.files import find_file
+ from dynaconf.utils.parse_conf import boolean_fix
  from dynaconf.utils.parse_conf import parse_conf_data
 -from dynaconf.vendor.dotenv import load_dotenv
 +from dotenv import load_dotenv
@@ -47,36 +48,36 @@ index 66601b0..9605fc5 100644
  
  def try_renamed(key, value, older_key, current_key):
 diff --git a/dynaconf/loaders/env_loader.py b/dynaconf/loaders/env_loader.py
-index e7b13bd..b034c8a 100644
+index a563b4e..91ac3ae 100644
 --- a/dynaconf/loaders/env_loader.py
 +++ b/dynaconf/loaders/env_loader.py
-@@ -2,7 +2,7 @@ from os import environ
+@@ -11,7 +11,7 @@ from dynaconf.utils.parse_conf import parse_conf_data
  
- from dynaconf.utils import upperfy
- from dynaconf.utils.parse_conf import parse_conf_data
--from dynaconf.vendor.dotenv import cli as dotenv_cli
-+from dotenv import cli as dotenv_cli
+ DOTENV_IMPORTED = False
+ with suppress(ImportError, FileNotFoundError):
+-    from dynaconf.vendor.dotenv import cli as dotenv_cli
++    from dotenv import cli as dotenv_cli
  
+     DOTENV_IMPORTED = True
  
- IDENTIFIER = "env"
 diff --git a/dynaconf/loaders/toml_loader.py b/dynaconf/loaders/toml_loader.py
-index 07b973f..d81d675 100644
+index 42db7b3..ba0188b 100644
 --- a/dynaconf/loaders/toml_loader.py
 +++ b/dynaconf/loaders/toml_loader.py
-@@ -5,7 +5,7 @@ from dynaconf import default_settings
+@@ -7,7 +7,7 @@ from dynaconf import default_settings
  from dynaconf.constants import TOML_EXTENSIONS
  from dynaconf.loaders.base import BaseLoader
  from dynaconf.utils import object_merge
--from dynaconf.vendor import toml
-+import toml
+-from dynaconf.vendor import toml  # Backwards compatibility with uiri/toml
++import toml  # Backwards compatibility with uiri/toml
+ from dynaconf.vendor import tomllib  # New tomllib stdlib on py3.11

- def load(obj, env=None, silent=True, key=None, filename=None):
 diff --git a/dynaconf/loaders/yaml_loader.py b/dynaconf/loaders/yaml_loader.py
-index 33c6532..3ef419a 100644
+index 5721681..ab628c2 100644
 --- a/dynaconf/loaders/yaml_loader.py
 +++ b/dynaconf/loaders/yaml_loader.py
-@@ -7,7 +7,7 @@ from dynaconf.constants import YAML_EXTENSIONS
+@@ -10,7 +10,7 @@ from dynaconf.constants import YAML_EXTENSIONS
  from dynaconf.loaders.base import BaseLoader
  from dynaconf.utils import object_merge
  from dynaconf.utils.parse_conf import try_to_encode
@@ -85,95 +86,84 @@ index 33c6532..3ef419a 100644
  
  # Add support for Dynaconf Lazy values to YAML dumper
  yaml.SafeDumper.yaml_representers[
+diff --git a/dynaconf/utils/inspect.py b/dynaconf/utils/inspect.py
+index 21d724e..2933b8f 100644
+--- a/dynaconf/utils/inspect.py
++++ b/dynaconf/utils/inspect.py
+@@ -18,7 +18,7 @@ from dynaconf.loaders.base import SourceMetadata
+ from dynaconf.utils.boxing import DynaBox
+ from dynaconf.utils.functional import empty
+ from dynaconf.vendor.box.box_list import BoxList
+-from dynaconf.vendor.ruamel.yaml import YAML
++from ruamel.yaml import YAML
+ 
+ if TYPE_CHECKING:  # pragma: no cover
+     from dynaconf.base import LazySettings, Settings
 diff --git a/dynaconf/utils/parse_conf.py b/dynaconf/utils/parse_conf.py
-index c42b07a..01ccdae 100644
+index 882110e..a262864 100644
 --- a/dynaconf/utils/parse_conf.py
 +++ b/dynaconf/utils/parse_conf.py
-@@ -9,7 +9,7 @@ from dynaconf.utils import isnamedtupleinstance
- from dynaconf.utils import multi_replace
+@@ -12,7 +12,7 @@ from dynaconf.utils import multi_replace
  from dynaconf.utils import recursively_evaluate_lazy_format
  from dynaconf.utils.boxing import DynaBox
+ from dynaconf.utils.functional import empty
 -from dynaconf.vendor import toml
 +import toml
+ from dynaconf.vendor import tomllib
  
  try:
-     from jinja2 import Environment
 diff --git a/dynaconf/vendor/box/converters.py b/dynaconf/vendor/box/converters.py
-index 93cdcfb..e34c7dc 100644
+index 08694fe..4e84930 100644
 --- a/dynaconf/vendor/box/converters.py
 +++ b/dynaconf/vendor/box/converters.py
-@@ -7,9 +7,9 @@ _B='utf-8'
- _A=None
- import csv,json,sys,warnings
- from pathlib import Path
--import dynaconf.vendor.ruamel.yaml as yaml
-+import ruamel.yaml as yaml
- from dynaconf.vendor.box.exceptions import BoxError,BoxWarning
--from dynaconf.vendor import toml
-+import toml
- BOX_PARAMETERS='default_box','default_box_attr','conversion_box','frozen_box','camel_killer_box','box_safe_prefix','box_duplicates','ordered_box','default_box_none_transform','box_dots','modify_tuples_box','box_intact_types','box_recast'
- def _exists(filename,create=_E):
- 	A=filename;B=Path(A)
-diff --git a/dynaconf/vendor/box/from_file.py b/dynaconf/vendor/box/from_file.py
-index daa1137..d75940b 100644
---- a/dynaconf/vendor/box/from_file.py
-+++ b/dynaconf/vendor/box/from_file.py
-@@ -1,8 +1,8 @@
- from json import JSONDecodeError
- from pathlib import Path
- from typing import Union
--from dynaconf.vendor.toml import TomlDecodeError
--from dynaconf.vendor.ruamel.yaml import YAMLError
-+from toml import TomlDecodeError
-+from ruamel.yaml import YAMLError
- from .exceptions import BoxError
- from .box import Box
- from .box_list import BoxList
-diff --git a/dynaconf/vendor_src/box/converters.py b/dynaconf/vendor_src/box/converters.py
-index c9a2293..ae42bf6 100644
---- a/dynaconf/vendor_src/box/converters.py
-+++ b/dynaconf/vendor_src/box/converters.py
-@@ -9,9 +9,9 @@ import sys
+@@ -9,7 +9,7 @@ import sys
  import warnings
  from pathlib import Path
  
 -import dynaconf.vendor.ruamel.yaml as yaml
 +import ruamel.yaml as yaml
  from dynaconf.vendor.box.exceptions import BoxError, BoxWarning
--from dynaconf.vendor import toml
-+import toml
- 
+ from dynaconf.vendor import tomllib as toml
  
- BOX_PARAMETERS = ('default_box', 'default_box_attr', 'conversion_box',
-diff --git a/dynaconf/vendor_src/box/from_file.py b/dynaconf/vendor_src/box/from_file.py
-index 2e2a6ad..3f76819 100644
---- a/dynaconf/vendor_src/box/from_file.py
-+++ b/dynaconf/vendor_src/box/from_file.py
-@@ -3,8 +3,8 @@
- from json import JSONDecodeError
+diff --git a/dynaconf/vendor/box/from_file.py b/dynaconf/vendor/box/from_file.py
+index a82ac96..cd01f13 100644
+--- a/dynaconf/vendor/box/from_file.py
++++ b/dynaconf/vendor/box/from_file.py
+@@ -4,7 +4,7 @@ from json import JSONDecodeError
  from pathlib import Path
  from typing import Union
--from dynaconf.vendor.toml import TomlDecodeError
+ from dynaconf.vendor.tomllib import TOMLDecodeError
 -from dynaconf.vendor.ruamel.yaml import YAMLError
-+from toml import TomlDecodeError
 +from ruamel.yaml import YAMLError

  from .exceptions import BoxError
 diff --git a/tests/test_cli.py b/tests/test_cli.py
-index 6693701..df44409 100644
+index c679ae5..9df5f7f 100644
 --- a/tests/test_cli.py
 +++ b/tests/test_cli.py
-@@ -11,7 +11,7 @@ from dynaconf.cli import main
+@@ -15,7 +15,7 @@ from dynaconf.cli import main
  from dynaconf.cli import read_file_in_root_directory
  from dynaconf.cli import WRITERS
  from dynaconf.utils.files import read_file
 -from dynaconf.vendor.click.testing import CliRunner
 +from click.testing import CliRunner
  
+ settings = LazySettings(OPTION_FOR_TESTS=True, environments=True)
  
- runner = CliRunner()
-
-base-commit: ebf7b17cffd5e08b212948bd8036d580718d5bf8
+diff --git a/tests/test_inspect.py b/tests/test_inspect.py
+index 0819715..96638c1 100644
+--- a/tests/test_inspect.py
++++ b/tests/test_inspect.py
+@@ -18,7 +18,7 @@ from dynaconf.utils.inspect import inspect_settings
+ from dynaconf.utils.inspect import KeyNotFoundError
+ from dynaconf.utils.inspect import OutputFormatError
+ from dynaconf.validator import Validator
+-from dynaconf.vendor.ruamel import yaml
++from ruamel import yaml
+ 
+ 
+ def create_file(filename: str, data: str) -> str:
 -- 
-2.32.0
+2.41.0
+
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 37d7dd0dd5..167b329dda 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -63,7 +63,7 @@
 ;;; Copyright © 2019, 2020 Alex Griffin <[email-masked]>
 ;;; Copyright © 2019, 2020, 2021, 2022, 2023 Pierre Langlois <[email-masked]>
 ;;; Copyright © 2019 Jacob MacDonald <[email-masked]>
-;;; Copyright © 2019-2021, 2023 Giacomo Leidi <[email-masked]>
+;;; Copyright © 2019-2021, 2023, 2024 Giacomo Leidi <[email-masked]>
 ;;; Copyright © 2019 Wiktor Żelazny <[email-masked]>
 ;;; Copyright © 2019, 2020, 2021, 2022 Tanguy Le Carrour <[email-masked]>
 ;;; Copyright © 2019, 2021-2023 Mădălin Ionel Patrașcu <[email-masked]>
@@ -32480,30 +32480,40 @@ (define-public python-orgparse
 (define-public dynaconf
   (package
     (name "dynaconf")
-    (version "3.1.7")
+    (version "3.2.4")
     (source
      (origin
        (method git-fetch)
        (uri
         (git-reference
-         (url "https://github.com/rochacbruno/dynaconf")
+         (url "https://github.com/dynaconf/dynaconf")
          (commit version)))
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "0pjyjsdzairpn5vq8nzddhxwxmr18grn272nj31wcy2ipwdl3c3h"))
+         "0fj2ffvzfvjf4d7f672h5x5fzq26f8hax9j3dfsix158fwm0212w"))
        (patches (search-patches "dynaconf-unvendor-deps.patch"))
        (modules '((guix build utils)))
        (snippet '(begin
                    ;; Remove vendored dependencies
                    (let ((unvendor '("click" "dotenv" "ruamel" "toml")))
                      (with-directory-excursion "dynaconf/vendor"
-                       (for-each delete-file-recursively unvendor))
-                     (with-directory-excursion "dynaconf/vendor_src"
-                       (for-each delete-file-recursively unvendor)))))))
-    (build-system python-build-system)
+                       (for-each delete-file-recursively unvendor)))
+                   ;; Lower coverage quality gate for unit tests
+                   (substitute* ".coveragerc"
+                     (("fail_under = 95") "fail_under = 50"))))))
+    (build-system pyproject-build-system)
     (arguments
-     `(#:phases
+     `(#:test-flags
+       '("-k"
+         ,(let ((click-tests '("test_negative_get"
+                               "test_inspect_invalid_format")))
+            ;; Disable integration tests
+            (string-append "not integration and not "
+                           ;; These tests fail because we use Click 8.* instead of
+                           ;; Click 7
+                           (string-join click-tests " and not "))))
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-for-click-8
            (lambda _
@@ -32511,14 +32521,19 @@ (define-public dynaconf
                (("click.get_os_args\\()") ;deprecated from Click 8.1+
                 "sys.argv[1:]"))))
          (replace 'check
-           (lambda* (#:key tests? outputs #:allow-other-keys)
+           (lambda* (#:key tests? test-flags #:allow-other-keys)
              (when tests?
                ;; These tests depend on hvac and a live Vault process.
                (delete-file "tests/test_vault.py")
-               (invoke "make" "test_only")))))))
+               (apply invoke
+                      `("py.test" ,@test-flags "-v"
+                        "--cov-config" ".coveragerc"
+                        "--cov=dynaconf"
+                        "-l" "--tb=short"
+                        "--maxfail=1" "tests/"))))))))
     (propagated-inputs
      (list python-click python-configobj python-dotenv-0.13.0
-           python-ruamel.yaml python-toml))
+           python-ruamel.yaml python-toml python-tomli))
     (native-inputs
      (list python-django python-flask python-pytest python-pytest-cov
            python-pytest-mock))

base-commit: bcc9cd1aaeb53c323b199623de4fafe8594d1a95
-- 
2.41.0