From 98822ee896a3a5aeb5c6747da0ea40f86d5ac167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alu=C3=ADsio=20Augusto=20Silva=20Gon=C3=A7alves?= Date: Fri, 23 Apr 2021 15:18:07 -0300 Subject: [PATCH 1/3] python3Packages.json-logging: init at 1.3.0 --- .../python-modules/json-logging/default.nix | 49 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 51 insertions(+) create mode 100644 pkgs/development/python-modules/json-logging/default.nix diff --git a/pkgs/development/python-modules/json-logging/default.nix b/pkgs/development/python-modules/json-logging/default.nix new file mode 100644 index 00000000000..3d34cb2475a --- /dev/null +++ b/pkgs/development/python-modules/json-logging/default.nix @@ -0,0 +1,49 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, fetchpatch +, pytestCheckHook +, wheel +, flask +, sanic +, fastapi +, uvicorn +, requests +}: + +buildPythonPackage rec { + pname = "json-logging"; + version = "1.3.0"; + + src = fetchFromGitHub { + owner = "bobbui"; + repo = "json-logging-python"; + rev = version; + hash = "sha256-0eIhOi30r3ApyVkiBdTQps5tNj7rI+q8TjNWxTnhtMQ="; + }; + patches = [ + # Fix tests picking up test modules instead of real packages. + (fetchpatch { + url = "https://github.com/bobbui/json-logging-python/commit/6fdb64deb42fe48b0b12bda0442fd5ac5f03107f.patch"; + sha256 = "sha256-BLfARsw2FdvY22NCaFfdFgL9wTmEZyVIi3CQpB5qU0Y="; + }) + ]; + + # - Quart is not packaged for Nixpkgs. + # - FastAPI is broken, see #112701 and tiangolo/fastapi#2335. + checkInputs = [ wheel flask /*quart*/ sanic /*fastapi*/ uvicorn requests pytestCheckHook ]; + disabledTests = [ "quart" "fastapi" ]; + disabledTestPaths = [ "tests/test_fastapi.py" ]; + # Tests spawn servers and try to connect to them. + __darwinAllowLocalNetworking = true; + + meta = with lib; { + description = "Python library to emit logs in JSON format"; + longDescription = '' + Python logging library to emit JSON log that can be easily indexed and searchable by logging infrastructure such as ELK, EFK, AWS Cloudwatch, GCP Stackdriver. + ''; + homepage = "https://github.com/bobbui/json-logging-python"; + license = licenses.asl20; + maintainers = with maintainers; [ AluisioASG ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 90f766ed459..dc54e6ae5fc 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3443,6 +3443,8 @@ in { jsonlines = callPackage ../development/python-modules/jsonlines { }; + json-logging = callPackage ../development/python-modules/json-logging { }; + jsonmerge = callPackage ../development/python-modules/jsonmerge { }; json-merge-patch = callPackage ../development/python-modules/json-merge-patch { }; From 932ec5518e854d4388827ea45f65284766da0317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alu=C3=ADsio=20Augusto=20Silva=20Gon=C3=A7alves?= Date: Fri, 23 Apr 2021 16:16:43 -0300 Subject: [PATCH 2/3] python3Packages.pytest-console-scripts: init at 1.2.0 Thanks to @kvas-it for cutting a release with the patches needed to make tests work. --- .../pytest-console-scripts/default.nix | 41 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 43 insertions(+) create mode 100644 pkgs/development/python-modules/pytest-console-scripts/default.nix diff --git a/pkgs/development/python-modules/pytest-console-scripts/default.nix b/pkgs/development/python-modules/pytest-console-scripts/default.nix new file mode 100644 index 00000000000..aaecd191e93 --- /dev/null +++ b/pkgs/development/python-modules/pytest-console-scripts/default.nix @@ -0,0 +1,41 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pytestCheckHook +, python +, mock +, setuptools-scm +}: + +buildPythonPackage rec { + pname = "pytest-console-scripts"; + version = "1.2.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "4a2138d7d567bc581fe081b6a5975849a2a36b3925cb0f066d2380103e13741c"; + }; + postPatch = '' + # setuptools-scm is pinned to <6 because it dropped Python 3.5 + # support. That's not something that affects us. + substituteInPlace setup.py --replace "'setuptools_scm<6'" "'setuptools_scm'" + # Patch the shebang of a script generated during test. + substituteInPlace tests/test_run_scripts.py --replace "#!/usr/bin/env python" "#!${python.interpreter}" + ''; + + SETUPTOOLS_SCM_PRETEND_VERSION = version; + nativeBuildInputs = [ setuptools-scm ]; + + checkInputs = [ mock pytestCheckHook ]; + + meta = with lib; { + description = "Pytest plugin for testing console scripts"; + longDescription = '' + Pytest-console-scripts is a pytest plugin for running python scripts from within tests. + It's quite similar to subprocess.run(), but it also has an in-process mode, where the scripts are executed by the interpreter that's running pytest (using some amount of sandboxing). + ''; + homepage = "https://github.com/kvas-it/pytest-console-scripts"; + license = licenses.mit; + maintainers = with maintainers; [ AluisioASG ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index dc54e6ae5fc..ec7afc633ea 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6261,6 +6261,8 @@ in { pytest-click = callPackage ../development/python-modules/pytest-click { }; + pytest-console-scripts = callPackage ../development/python-modules/pytest-console-scripts { }; + pytest-cov = self.pytestcov; # self 2021-01-04 pytestcov = callPackage ../development/python-modules/pytest-cov { }; From 093ab98c80be3db7b81a6ac569c6fa5e70081226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alu=C3=ADsio=20Augusto=20Silva=20Gon=C3=A7alves?= Date: Fri, 23 Apr 2021 16:18:38 -0300 Subject: [PATCH 3/3] dyndnsc: 0.5.1 -> 0.6.1 --- pkgs/applications/networking/dyndns/dyndnsc/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/dyndns/dyndnsc/default.nix b/pkgs/applications/networking/dyndns/dyndnsc/default.nix index 65d46305741..66b1d2639d6 100644 --- a/pkgs/applications/networking/dyndns/dyndnsc/default.nix +++ b/pkgs/applications/networking/dyndns/dyndnsc/default.nix @@ -2,11 +2,11 @@ python3Packages.buildPythonApplication rec { pname = "dyndnsc"; - version = "0.5.1"; + version = "0.6.1"; src = python3Packages.fetchPypi { inherit pname version; - hash = "sha256-Sy6U0XhIQ9mPmznmWKqoyqE34vaE84fwlivouaF7Dd0="; + sha256 = "13078d29eea2f9a4ca01f05676c3309ead5e341dab047e0d51c46f23d4b7fbb4"; }; postPatch = '' @@ -19,9 +19,10 @@ python3Packages.buildPythonApplication rec { dnspython netifaces requests + json-logging setuptools ]; - checkInputs = with python3Packages; [ bottle pytestCheckHook ]; + checkInputs = with python3Packages; [ bottle mock pytest-console-scripts pytestCheckHook ]; disabledTests = [ # dnswanip connects to an external server to discover the