From afb87a7e8220fabaf54c6e2a8af99e5406ba6225 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Sat, 11 Jun 2022 08:48:00 +0800 Subject: [PATCH 1/4] Problem: don't support override config for all validators Solution: - support config section in global level --- pystarport/cluster.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pystarport/cluster.py b/pystarport/cluster.py index 9a79f82..1fc7a03 100644 --- a/pystarport/cluster.py +++ b/pystarport/cluster.py @@ -855,6 +855,7 @@ def create_account(cli, account, use_ledger=False): data_dir / f"node{i}/config/config.toml", val["base_port"], clean_peers, + jsonmerge.merge(config.get("config", {}), val.get("config", {})), val.get("config", {}), ) edit_app_cfg( From f2b4088f26b99d26c8996c8b77fc8173c237c855 Mon Sep 17 00:00:00 2001 From: yihuang Date: Sat, 11 Jun 2022 08:53:58 +0800 Subject: [PATCH 2/4] Update pystarport/cluster.py --- pystarport/cluster.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pystarport/cluster.py b/pystarport/cluster.py index 1fc7a03..86d4d25 100644 --- a/pystarport/cluster.py +++ b/pystarport/cluster.py @@ -856,7 +856,6 @@ def create_account(cli, account, use_ledger=False): val["base_port"], clean_peers, jsonmerge.merge(config.get("config", {}), val.get("config", {})), - val.get("config", {}), ) edit_app_cfg( data_dir / f"node{i}/config/app.toml", From 6cf74ea3a1d189b693d48e23f20997ac2db2e624 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Sat, 11 Jun 2022 20:56:05 +0800 Subject: [PATCH 3/4] fix nix flake --- flake.lock | 34 +++++++++++++++++++++++++++++----- flake.nix | 36 ++++++++++++++++++++++++++++++------ poetry.lock | 46 +++++++++++++++++++++++----------------------- pyproject.toml | 2 +- 4 files changed, 83 insertions(+), 35 deletions(-) diff --git a/flake.lock b/flake.lock index 97379b3..d75d5e0 100644 --- a/flake.lock +++ b/flake.lock @@ -17,24 +17,48 @@ }, "nixpkgs": { "locked": { - "lastModified": 1643275623, - "narHash": "sha256-B0E8q5iDEkgX+kdnzqP8XgnrwyxJofWl4Uz90M9ffLI=", + "lastModified": 1653936696, + "narHash": "sha256-M6bJShji9AIDZ7Kh7CPwPBPb/T7RiVev2PAcOi4fxDQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4c3f44ad68325d118c082553a5e40dd79a47fa27", + "rev": "ce6aa13369b667ac2542593170993504932eb836", "type": "github" }, "original": { "owner": "NixOS", - "ref": "release-21.11", + "ref": "22.05", "repo": "nixpkgs", "type": "github" } }, + "poetry2nix": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1654827942, + "narHash": "sha256-8TywCKZiTyiCFhjRLrsAvuxprYbeVYYzTOmfn3T7Qrc=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "e727bea80d0d6659b21abda027a4839d70270edc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix" } } }, diff --git a/flake.nix b/flake.nix index b93f922..f69737e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,17 +1,41 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/release-21.11"; + nixpkgs.url = "github:NixOS/nixpkgs/22.05"; flake-utils.url = "github:numtide/flake-utils"; + poetry2nix = { + url = "github:nix-community/poetry2nix"; + inputs.flake-utils.follows = "flake-utils"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils, poetry2nix }: (flake-utils.lib.eachDefaultSystem (system: let - pkgs = (import nixpkgs { inherit system; config = { }; }); + pkgs = (import nixpkgs { + inherit system; config = { }; + overlays = [ + poetry2nix.overlay + ]; + }); in rec { - defaultPackage = pkgs.poetry2nix.mkPoetryApplication { - projectDir = ./.; - }; + defaultPackage = pkgs.poetry2nix.mkPoetryApplication + { + projectDir = ./.; + overrides = pkgs.poetry2nix.overrides.withDefaults + (self: super: { + pyparsing = super.pyparsing.overridePythonAttrs ( + old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.flit-core ]; + } + ); + jsonschema = super.jsonschema.overridePythonAttrs ( + old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.hatchling self.hatch-vcs ]; + } + ); + }); + }; defaultApp = { type = "app"; program = "${defaultPackage}/bin/pystarport"; diff --git a/poetry.lock b/poetry.lock index caca1a6..a16b254 100644 --- a/poetry.lock +++ b/poetry.lock @@ -56,11 +56,11 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "certifi" -version = "2021.10.8" +version = "2022.5.18.1" description = "Python package for providing Mozilla's CA Bundle." category = "main" optional = false -python-versions = "*" +python-versions = ">=3.6" [[package]] name = "charset-normalizer" @@ -94,7 +94,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "deepdiff" -version = "5.8.0" +version = "5.8.1" description = "Deep Difference and Search of any Python object/data." category = "dev" optional = false @@ -216,13 +216,13 @@ jsonschema = "*" name = "jsonnet" version = "0.18.0" description = "Python bindings for Jsonnet - The data templating language" -category = "dev" +category = "main" optional = false python-versions = "*" [[package]] name = "jsonschema" -version = "4.4.0" +version = "4.6.0" description = "An implementation of JSON Schema validation for Python" category = "main" optional = false @@ -235,7 +235,7 @@ pyrsistent = ">=0.14.0,<0.17.0 || >0.17.0,<0.17.1 || >0.17.1,<0.17.2 || >0.17.2" [package.extras] format = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3987", "uri-template", "webcolors (>=1.11)"] -format_nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3986-validator (>0.1.0)", "uri-template", "webcolors (>=1.11)"] +format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3986-validator (>0.1.0)", "uri-template", "webcolors (>=1.11)"] [[package]] name = "mccabe" @@ -344,7 +344,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pyparsing" -version = "3.0.8" +version = "3.0.9" description = "pyparsing module - Classes and methods to define and execute parsing grammars" category = "dev" optional = false @@ -437,20 +437,20 @@ toml = ["toml"] [[package]] name = "requests" -version = "2.27.1" +version = "2.28.0" description = "Python HTTP for Humans." category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +python-versions = ">=3.7, <4" [package.dependencies] certifi = ">=2017.4.17" -charset-normalizer = {version = ">=2.0.0,<2.1.0", markers = "python_version >= \"3\""} -idna = {version = ">=2.5,<4", markers = "python_version >= \"3\""} +charset-normalizer = ">=2.0.0,<2.1.0" +idna = ">=2.5,<4" urllib3 = ">=1.21.1,<1.27" [package.extras] -socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"] [[package]] @@ -553,7 +553,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "7dccbb1e664e3bf143ec7af0ed9f70746684116fa77417684738d479f9d56655" +content-hash = "89105e8df58e08ee7a0d47e264594a2f98cd597f0b8e6d2a1b0ad075d69d7e1e" [metadata.files] atomicwrites = [ @@ -573,8 +573,8 @@ black = [ {file = "black-21.12b0.tar.gz", hash = "sha256:77b80f693a569e2e527958459634f18df9b0ba2625ba4e0c2d5da5be42e6f2b3"}, ] certifi = [ - {file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"}, - {file = "certifi-2021.10.8.tar.gz", hash = "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"}, + {file = "certifi-2022.5.18.1-py3-none-any.whl", hash = "sha256:f1d53542ee8cbedbe2118b5686372fb33c297fcd6379b050cca0ef13a597382a"}, + {file = "certifi-2022.5.18.1.tar.gz", hash = "sha256:9c5705e395cd70084351dd8ad5c41e65655e08ce46f2ec9cf6c2c08390f71eb7"}, ] charset-normalizer = [ {file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"}, @@ -588,8 +588,8 @@ colorama = [ {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, ] deepdiff = [ - {file = "deepdiff-5.8.0-py3-none-any.whl", hash = "sha256:6b71714a6a5fb4cd6ab74c97f53303029118f96128082422342a9129a5f25c8f"}, - {file = "deepdiff-5.8.0.tar.gz", hash = "sha256:7e641c0cd6429c9e1b64a07b8f7713382a5626afe18c72bcafa8a4343c05c701"}, + {file = "deepdiff-5.8.1-py3-none-any.whl", hash = "sha256:e9aea49733f34fab9a0897038d8f26f9d94a97db1790f1b814cced89e9e0d2b7"}, + {file = "deepdiff-5.8.1.tar.gz", hash = "sha256:8d4eb2c4e6cbc80b811266419cb71dd95a157094a3947ccf937a94d44943c7b8"}, ] docker = [ {file = "docker-5.0.3-py2.py3-none-any.whl", hash = "sha256:7a79bb439e3df59d0a72621775d600bc8bc8b422d285824cb37103eab91d1ce0"}, @@ -628,8 +628,8 @@ jsonnet = [ {file = "jsonnet-0.18.0.tar.gz", hash = "sha256:4ccd13427e9097b6b7d6d38f78f638a55ab8b452a257639e8e9af2178ec235d4"}, ] jsonschema = [ - {file = "jsonschema-4.4.0-py3-none-any.whl", hash = "sha256:77281a1f71684953ee8b3d488371b162419767973789272434bbc3f29d9c8823"}, - {file = "jsonschema-4.4.0.tar.gz", hash = "sha256:636694eb41b3535ed608fe04129f26542b59ed99808b4f688aa32dcf55317a83"}, + {file = "jsonschema-4.6.0-py3-none-any.whl", hash = "sha256:1c92d2db1900b668201f1797887d66453ab1fbfea51df8e4b46236689c427baf"}, + {file = "jsonschema-4.6.0.tar.gz", hash = "sha256:9d6397ba4a6c0bf0300736057f649e3e12ecbc07d3e81a0dacb72de4e9801957"}, ] mccabe = [ {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, @@ -675,8 +675,8 @@ pyflakes = [ {file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"}, ] pyparsing = [ - {file = "pyparsing-3.0.8-py3-none-any.whl", hash = "sha256:ef7b523f6356f763771559412c0d7134753f037822dad1b16945b7b846f7ad06"}, - {file = "pyparsing-3.0.8.tar.gz", hash = "sha256:7bf433498c016c4314268d95df76c81b842a4cb2b276fa3312cfb1e1d85f6954"}, + {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, + {file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, ] pyrsistent = [ {file = "pyrsistent-0.18.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:df46c854f490f81210870e509818b729db4488e1f30f2a1ce1698b2295a878d1"}, @@ -763,8 +763,8 @@ pyyaml-include = [ {file = "pyyaml_include-1.3-py3-none-any.whl", hash = "sha256:5142a0b0f93d9b1e5872d5a814f3681ffbc70638128ced1acfd9fb57da7825ca"}, ] requests = [ - {file = "requests-2.27.1-py2.py3-none-any.whl", hash = "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"}, - {file = "requests-2.27.1.tar.gz", hash = "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"}, + {file = "requests-2.28.0-py3-none-any.whl", hash = "sha256:bc7861137fbce630f17b03d3ad02ad0bf978c844f3536d0edda6499dafce2b6f"}, + {file = "requests-2.28.0.tar.gz", hash = "sha256:d568723a7ebd25875d8d1eaf5dfa068cd2fc8194b2e483d7b1f7c81918dbec6b"}, ] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, diff --git a/pyproject.toml b/pyproject.toml index 0eb937c..dbc1d73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ bech32 = "^1.1.0" multitail2 = "^1.5.2" python-dotenv = "^0.19.2" pyyaml-include = "^1.3" +jsonnet = "^0.18.0" [tool.poetry.dev-dependencies] pytest = "^6.2.5" @@ -30,7 +31,6 @@ deepdiff = "^5.6.0" flake8 = "^4.0.1" black = "^21.12b0" isort = "^5.10.1" -jsonnet = "^0.18.0" [tool.poetry.scripts] pystarport = "pystarport.cli:main" From 14a55eba4590cab15db5d9ab716d5fe013676e63 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 13 Jun 2022 17:54:32 +0800 Subject: [PATCH 4/4] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0907e1e..a3fa88a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## UNRELEASED - [#52](https://github.com/crypto-com/pystarport/pull/52) support jsonnet as config language +- [#56](https://github.com/crypto-com/pystarport/pull/56) Support override config.toml for all validators *Feb 18, 2022*