From 0c75736a343cb069aac408c5f5e1159c654db714 Mon Sep 17 00:00:00 2001 From: Hristo Krasenov Date: Thu, 25 Jul 2024 13:06:14 +0300 Subject: [PATCH] config(packages/teatime): Add `teatime` --- __pycache__/teatime.cpython-311.pyc | Bin 0 -> 1219 bytes flake.nix | 4 ++++ packages/all-packages.nix | 2 +- packages/teatime/default.nix | 26 ++++++++++++++++++++++++++ shells/teatime-test.nix | 10 ++++++++++ teatime-test.py | 23 +++++++++++++++++++++++ 6 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 __pycache__/teatime.cpython-311.pyc create mode 100644 packages/teatime/default.nix create mode 100644 shells/teatime-test.nix create mode 100644 teatime-test.py diff --git a/__pycache__/teatime.cpython-311.pyc b/__pycache__/teatime.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac70819da12b26ea9b9dd40ab2dd584a10243328 GIT binary patch literal 1219 zcmZuvO-~a+7@qBJKX$tX!OG_aH8E+BR=jvo5feZXt%Sm53E9-{NLO}eH`6HrPCa-) zL&C)bk6eTp_yPU`&#mFmOwz=}c;HrpCr`e!{Q!)!GtWNne7qme%uyntA!wVmqu1FG zLO+DjX-b=%e+9CSEM!RzawS8O1P?hOS2pB;%Z}oPjj$UrB48^<)CwChD`Kct^er+p z9JgZY;2k0QD1@+f2<%vxK{Ir$A0#@~<^MnXdf;p??m4)2c~6I5-FqlO1Q@LbIjOl| zq_i_Jm6CWgSI85BDbQHfv+&ZEk5i!*&ux(c*I(GgCTlsCXXVniI(h#=`W}3fcK#+p z+t=sG>oU!cO)t!k%@E7?Y{CldaKTRnlwq8I1lUKcn+!rMkRsTHSVv?qS)?^5@J)A~ z#V=-=e!(s2By*x9nW_$VHt+=%yx0w-{SE#%*;~jrs*K~6xULk z1E`=zyuT4oHWEXP{*ez8KlS7%?aR}uK2_7FPW7pVK6J2L)yHf4_^CeL49k65Q;q47 zUkKp0fF_ECBlHIN;xW^7Aq&&YruukqCw?bxpv7QkwyjaR;1Py5Sxb!MzpI!PCj)T; zL8y50v`@fw0iqHSl;mA(nmpQ$#ARA0JR$^wiwXM_9wm=5&$R3Uqe*d6q)P_?{=^=- zo>g}6V|oir@jOc>08Lqvq&m7?z1r*OZuM%fqX*Uh_3!#%MXmSrSK{@=t%}xER0*W& z!T?hAo$YV(a8(|z_YCi>zjJrp%3M8>+*^6S@@{o^wK7{*)XL1xoxSw?bWIyM)kbQ{ S=&3SV?eu08DI;(`sOB$QDJTg5 literal 0 HcmV?d00001 diff --git a/flake.nix b/flake.nix index 1a4abdb4..3f8dbdb0 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,10 @@ inherit self'; }; devShells.ci = import ./shells/ci.nix {pkgs = final;}; + devShells.teatime-test = import ./shells/teatime-test.nix { + inherit self'; + pkgs = final; + }; }; }; } diff --git a/packages/all-packages.nix b/packages/all-packages.nix index 81f11ce7..e25d6dde 100644 --- a/packages/all-packages.nix +++ b/packages/all-packages.nix @@ -111,7 +111,7 @@ cosmos-theta-testnet = callPackage ./cosmos-theta-testnet {inherit gaiad;}; blst = callPackage ./blst {}; bnb-beacon-node = callPackage ./bnb-beacon-node {}; - + teatime = callPackage ./teatime/default.nix {inherit python3Packages;}; circom = callPackage ./circom/default.nix {craneLib = craneLib-stable;}; circ = callPackage ./circ/default.nix {craneLib = craneLib-stable;}; diff --git a/packages/teatime/default.nix b/packages/teatime/default.nix new file mode 100644 index 00000000..53589a4d --- /dev/null +++ b/packages/teatime/default.nix @@ -0,0 +1,26 @@ +{ + python3Packages, + fetchPypi, + lib, +}: +python3Packages.buildPythonPackage { + pname = "teatime"; + version = "0.3.1"; + + src = /home/hkrasenov/code/repos/teatime; + + build-system = [ + python3Packages.setuptools + python3Packages.wheel + ]; + + propagatedBuildInputs = with python3Packages; [loguru requests]; + + doCheck = false; + + meta = with lib; { + description = "A minimal Python tea time application"; + homepage = "https://github.com/dmuhs/teatime"; + license = licenses.mit; + }; +} diff --git a/shells/teatime-test.nix b/shells/teatime-test.nix new file mode 100644 index 00000000..e578d48f --- /dev/null +++ b/shells/teatime-test.nix @@ -0,0 +1,10 @@ +{ + self', + pkgs, + ... +}: +pkgs.mkShell { + packages = with pkgs; [ + (python3.withPackages (python-pkgs: with python-pkgs; [self'.packages.teatime])) + ]; +} diff --git a/teatime-test.py b/teatime-test.py new file mode 100644 index 00000000..d745fd39 --- /dev/null +++ b/teatime-test.py @@ -0,0 +1,23 @@ +from teatime.scanner import Scanner +from teatime.plugins.context import NodeType +from teatime.plugins.eth1 import NodeSync, MiningStatus + +TARGET_IP = "127.0.0.1" +TARGET_PORT = 8545 +INFURA_URL = "Infura API Endpoint" + +def get_scanner(): + return Scanner( + ip=TARGET_IP, + port=TARGET_PORT, + node_type=NodeType.GETH, + plugins=[ + NodeSync(infura_url=INFURA_URL, block_threshold=10), + MiningStatus(should_mine=False) + ] + ) + +if __name__ == '__main__': + scanner = get_scanner() + report = scanner.run() + print(report.to_dict()) \ No newline at end of file