From patchwork Fri Nov 19 23:41:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Giacomo Leidi X-Patchwork-Id: 34667 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2CF6127BBE3; Fri, 19 Nov 2021 23:42:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1B3FD27BBE1 for ; Fri, 19 Nov 2021 23:42:14 +0000 (GMT) Received: from localhost ([::1]:40512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1moDWG-0001Rj-3O for patchwork@mira.cbaines.net; Fri, 19 Nov 2021 18:42:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1moDW7-0001Po-NY for guix-patches@gnu.org; Fri, 19 Nov 2021 18:42:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:57554) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1moDW7-0002L9-Fa for guix-patches@gnu.org; Fri, 19 Nov 2021 18:42:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1moDW7-000802-EE for guix-patches@gnu.org; Fri, 19 Nov 2021 18:42:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49834] [PATCH 4/4] gnu: Add dynaconf. Resent-From: Giacomo Leidi Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 19 Nov 2021 23:42:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49834 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49834@debbugs.gnu.org Cc: Giacomo Leidi Received: via spool by 49834-submit@debbugs.gnu.org id=B49834.163736532030720 (code B ref 49834); Fri, 19 Nov 2021 23:42:03 +0000 Received: (at 49834) by debbugs.gnu.org; 19 Nov 2021 23:42:00 +0000 Received: from localhost ([127.0.0.1]:40864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1moDVr-0007z4-Oh for submit@debbugs.gnu.org; Fri, 19 Nov 2021 18:42:00 -0500 Received: from latitanza.investici.org ([82.94.249.234]:42475) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1moDVm-0007yK-Rw for 49834@debbugs.gnu.org; Fri, 19 Nov 2021 18:41:44 -0500 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4HwtVG2rQzzGp5s; Fri, 19 Nov 2021 23:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1637365302; bh=lk6EOISBAtl23Yz8ZQ7AbV97XqpZIdVf5qRzElEzm20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lbvH4idP8nRTAiHYEnJSyNbgGy6uGAiTGWC6DdMc/0QhxnDp8vkhQjVJl5POVJM+u fwcQXAt9Bj2/+rkDRdCNwgDu4gvaLzzskR8H+EtxRAR8PIxSZFFKXZznF0fBV7MvIX ATuPX6JbclVF3uMW/hVabTnYI0UkC8716Gocafh4= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4HwtVG1zh7zGp59; Fri, 19 Nov 2021 23:41:42 +0000 (UTC) Date: Sat, 20 Nov 2021 00:41:25 +0100 Message-Id: <20211119234125.2344-4-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211119234125.2344-1-goodoldpaul@autistici.org> References: <20211119234125.2344-1-goodoldpaul@autistici.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Giacomo Leidi X-ACL-Warn: , Giacomo Leidi via Guix-patches X-Patchwork-Original-From: Giacomo Leidi via Guix-patches via From: Giacomo Leidi X-getmail-retrieved-from-mailbox: Patches * gnu/packages/python-xyz.scm (dynaconf): New variable. * gnu/packages/patches/dynaconf-Unvendor-dependencies.patch: New file. * local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + .../dynaconf-Unvendor-dependencies.patch | 180 ++++++++++++++++++ gnu/packages/python-xyz.scm | 75 +++++++- 3 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/dynaconf-Unvendor-dependencies.patch diff --git a/gnu/local.mk b/gnu/local.mk index 7cc06c8212..ab05667bc0 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -994,6 +994,7 @@ dist_patch_DATA = \ %D%/packages/patches/dstat-skip-devices-without-io.patch \ %D%/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch \ %D%/packages/patches/dvd+rw-tools-add-include.patch \ + %D%/packages/patches/dynaconf-Unvendor-dependencies.patch \ %D%/packages/patches/ecl-16-format-directive-limit.patch \ %D%/packages/patches/ecl-16-ignore-stderr-write-error.patch \ %D%/packages/patches/ecl-16-libffi.patch \ diff --git a/gnu/packages/patches/dynaconf-Unvendor-dependencies.patch b/gnu/packages/patches/dynaconf-Unvendor-dependencies.patch new file mode 100644 index 0000000000..a379b1f00c --- /dev/null +++ b/gnu/packages/patches/dynaconf-Unvendor-dependencies.patch @@ -0,0 +1,180 @@ +From 3f7b48195500cbbbbecd3cac2f5308c64004479b Mon Sep 17 00:00:00 2001 +From: Giacomo Leidi +Date: Sun, 29 Aug 2021 23:39:27 +0200 +Subject: [PATCH] Use system site dependencies. + +Box was not unvendored because it appears to be heavily patched. +--- + 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(-) + +diff --git a/dynaconf/cli.py b/dynaconf/cli.py +index 5bb8316..1341a95 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 + from dynaconf.validator import ValidationError + from dynaconf.validator import Validator +-from dynaconf.vendor import click +-from dynaconf.vendor import toml ++import click ++import toml + + + CWD = Path.cwd() +diff --git a/dynaconf/default_settings.py b/dynaconf/default_settings.py +index 66601b0..9605fc5 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 + from dynaconf.utils.files import find_file + from dynaconf.utils.parse_conf import parse_conf_data +-from dynaconf.vendor.dotenv import load_dotenv ++from dotenv import load_dotenv + + + 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 +--- a/dynaconf/loaders/env_loader.py ++++ b/dynaconf/loaders/env_loader.py +@@ -2,7 +2,7 @@ from os import environ + + 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 + + + IDENTIFIER = "env" +diff --git a/dynaconf/loaders/toml_loader.py b/dynaconf/loaders/toml_loader.py +index 07b973f..d81d675 100644 +--- a/dynaconf/loaders/toml_loader.py ++++ b/dynaconf/loaders/toml_loader.py +@@ -5,7 +5,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 + + + 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 +--- a/dynaconf/loaders/yaml_loader.py ++++ b/dynaconf/loaders/yaml_loader.py +@@ -7,7 +7,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 +-from dynaconf.vendor.ruamel import yaml ++from ruamel import yaml + + # Add support for Dynaconf Lazy values to YAML dumper + yaml.SafeDumper.yaml_representers[ +diff --git a/dynaconf/utils/parse_conf.py b/dynaconf/utils/parse_conf.py +index c42b07a..01ccdae 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 + from dynaconf.utils import recursively_evaluate_lazy_format + from dynaconf.utils.boxing import DynaBox +-from dynaconf.vendor import toml ++import toml + + try: + from jinja2 import Environment +diff --git a/dynaconf/vendor/box/converters.py b/dynaconf/vendor/box/converters.py +index 93cdcfb..e34c7dc 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 + 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 + + + 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 + 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 +diff --git a/tests/test_cli.py b/tests/test_cli.py +index 6693701..df44409 100644 +--- a/tests/test_cli.py ++++ b/tests/test_cli.py +@@ -11,7 +11,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 + + + runner = CliRunner() + +base-commit: ebf7b17cffd5e08b212948bd8036d580718d5bf8 +-- +2.32.0 + diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 4181b47d10..dfd5668827 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -63,7 +63,7 @@ ;;; Copyright © 2019, 2020 Alex Griffin ;;; Copyright © 2019, 2020, 2021 Pierre Langlois ;;; Copyright © 2019 Jacob MacDonald -;;; Copyright © 2019, 2020 Giacomo Leidi +;;; Copyright © 2019, 2020, 2021 Giacomo Leidi ;;; Copyright © 2019 Wiktor Żelazny ;;; Copyright © 2019, 2020, 2021 Tanguy Le Carrour ;;; Copyright © 2019, 2021 Mădălin Ionel Patrașcu @@ -141,6 +141,7 @@ (define-module (gnu packages python-xyz) #:use-module (gnu packages compression) #:use-module (gnu packages crypto) #:use-module (gnu packages databases) + #:use-module (gnu packages django) #:use-module (gnu packages dbm) #:use-module (gnu packages djvu) #:use-module (gnu packages docker) @@ -28074,3 +28075,75 @@ (define-public python-sgmllib3k It is used to parse text files formatted in @acronym{SGML,Standard Generalized Mark-up Language}.") (license license:bsd-3))) + +(define-public dynaconf + (package + (name "dynaconf") + (version "3.1.7") + (source + (origin + (method git-fetch) + (uri + (git-reference + (url "https://github.com/rochacbruno/dynaconf") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0pjyjsdzairpn5vq8nzddhxwxmr18grn272nj31wcy2ipwdl3c3h")) + (patches (search-patches "dynaconf-Unvendor-dependencies.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) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? outputs #:allow-other-keys) + (when tests? + (setenv "PATH" + (string-append (assoc-ref outputs "out") "/bin:" + (getenv "PATH"))) + ;; These tests depend on hvac and a + ;; live Vault process. + (delete-file "tests/test_vault.py") + (invoke "make" "test_only"))))))) + (propagated-inputs + `(("python-click" ,python-click) + ("python-configobj" ,python-configobj) + ("python-dotenv" ,python-dotenv-0.13.0) + ("python-ruamel.yaml" ,python-ruamel.yaml) + ("python-toml" ,python-toml))) + (native-inputs + `(("python-django" ,python-django) + ("python-flask" ,python-flask) + ("python-pytest" ,python-pytest-6) + ("python-pytest-cov" ,python-pytest-cov) + ("python-pytest-mock" ,python-pytest-mock))) + (home-page "https://www.dynaconf.com/") + (synopsis "The dynamic configurator for your Python project") + (description + "This package provides @code{dynaconf} the dynamic configurator manager for +your Python project. It provides features such as: + +@itemize +@item Inspired by the @url{https://12factor.net/config, 12-factor application guide}; +@item Settings management (default values, validation, parsing, templating); +@item Protection of sensitive information (passwords/tokens); +@item Multiple file formats @code{toml|yaml|json|ini|py} and also customizable +loaders; +@item Full support for environment variables to override existing settings +(dotenv support included); +@item Optional layered system for multiple environments @code{[default, +development, testing, production]}; +@item Built-in support for Hashicorp Vault and Redis as settings and secrets storage; +@item Built-in extensions for Django and Flask web frameworks; +@item CLI for common operations such as @code{init, list, write, validate, export}. +@end itemize") + (license license:expat)))