netrun 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. netrun-0.2.0/.gitignore +89 -0
  2. netrun-0.2.0/PKG-INFO +16 -0
  3. netrun-0.2.0/README.md +1 -0
  4. netrun-0.2.0/netrun/__init__.py +0 -0
  5. netrun-0.2.0/netrun/_iutils/__init__.py +2 -0
  6. netrun-0.2.0/netrun/_iutils/_base.py +21 -0
  7. netrun-0.2.0/netrun/_iutils/hashing.py +101 -0
  8. netrun-0.2.0/netrun/execution_manager.py +785 -0
  9. netrun-0.2.0/netrun/net/__init__.py +0 -0
  10. netrun-0.2.0/netrun/net/_net.py +1905 -0
  11. netrun-0.2.0/netrun/net/config.py +1557 -0
  12. netrun-0.2.0/netrun/node_factories/__init__.py +3 -0
  13. netrun-0.2.0/netrun/node_factories/function.py +481 -0
  14. netrun-0.2.0/netrun/pool/__init__.py +36 -0
  15. netrun-0.2.0/netrun/pool/aio.py +271 -0
  16. netrun-0.2.0/netrun/pool/base.py +205 -0
  17. netrun-0.2.0/netrun/pool/multiprocess.py +856 -0
  18. netrun-0.2.0/netrun/pool/remote.py +663 -0
  19. netrun-0.2.0/netrun/pool/thread.py +276 -0
  20. netrun-0.2.0/netrun/rpc/__init__.py +61 -0
  21. netrun-0.2.0/netrun/rpc/aio.py +123 -0
  22. netrun-0.2.0/netrun/rpc/base.py +105 -0
  23. netrun-0.2.0/netrun/rpc/multiprocess.py +262 -0
  24. netrun-0.2.0/netrun/rpc/remote.py +348 -0
  25. netrun-0.2.0/netrun/rpc/thread.py +253 -0
  26. netrun-0.2.0/netrun/storage.py +226 -0
  27. netrun-0.2.0/pyproject.toml +99 -0
  28. netrun-0.1.0/PKG-INFO +0 -9
  29. netrun-0.1.0/README.md +0 -1
  30. netrun-0.1.0/pyproject.toml +0 -16
  31. netrun-0.1.0/setup.cfg +0 -4
  32. netrun-0.1.0/src/netrun/__init__.py +0 -2
  33. netrun-0.1.0/src/netrun/graph.py +0 -38
  34. netrun-0.1.0/src/netrun.egg-info/PKG-INFO +0 -9
  35. netrun-0.1.0/src/netrun.egg-info/SOURCES.txt +0 -9
  36. netrun-0.1.0/src/netrun.egg-info/dependency_links.txt +0 -1
  37. netrun-0.1.0/src/netrun.egg-info/requires.txt +0 -1
  38. netrun-0.1.0/src/netrun.egg-info/top_level.txt +0 -1
@@ -0,0 +1,89 @@
1
+ nbs/
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+
51
+ # Translations
52
+ *.mo
53
+ *.pot
54
+
55
+ # Environments
56
+ .env
57
+ .venv
58
+ env/
59
+ venv/
60
+ ENV/
61
+ env.bak/
62
+ venv.bak/
63
+
64
+ # IDE
65
+ .idea/
66
+ .vscode/
67
+ *.swp
68
+ *.swo
69
+ *~
70
+
71
+ # Jupyter Notebook
72
+ .ipynb_checkpoints
73
+
74
+ # mypy
75
+ .mypy_cache/
76
+ .dmypy.json
77
+ dmypy.json
78
+
79
+ # ruff
80
+ .ruff_cache/
81
+
82
+ # Documentation builds
83
+ _docs/
84
+ _build/
85
+ site/
86
+
87
+ # OS files
88
+ .DS_Store
89
+ Thumbs.db
netrun-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,16 @@
1
+ Metadata-Version: 2.4
2
+ Name: netrun
3
+ Version: 0.2.0
4
+ Summary: A flow-based development (FBD) runtime system.
5
+ Project-URL: Homepage, https://github.com/lukastk/netrun
6
+ Project-URL: Documentation, https://github.com/lukastk/netrun
7
+ Project-URL: Repository, https://github.com/lukastk/netrun
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: diskcache>=5.6.3
10
+ Requires-Dist: nblite>=1.1.1
11
+ Requires-Dist: netrun-sim>=0.1.1
12
+ Requires-Dist: websockets>=16.0
13
+ Requires-Dist: xxhash>=3.6.0
14
+ Description-Content-Type: text/markdown
15
+
16
+ A flow-based development (FBD) runtime system.
netrun-0.2.0/README.md ADDED
@@ -0,0 +1 @@
1
+ A flow-based development (FBD) runtime system.
File without changes
@@ -0,0 +1,2 @@
1
+ from ._base import get_timestamp_utc as get_timestamp_utc
2
+ from ._base import patch_to as patch_to
@@ -0,0 +1,21 @@
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/netrun/00_iutils/00_base.ipynb
2
+
3
+ __all__ = ['get_timestamp_utc', 'patch_to']
4
+
5
+ # %% nbs/netrun/00_iutils/00_base.ipynb 2
6
+ import datetime
7
+
8
+ # %% nbs/netrun/00_iutils/00_base.ipynb 4
9
+ def patch_to(cls):
10
+ """Patch a class to add a method."""
11
+
12
+ def decorator(func):
13
+ setattr(cls, func.__name__, func)
14
+ return func
15
+
16
+ return decorator
17
+
18
+ # %% nbs/netrun/00_iutils/00_base.ipynb 6
19
+ def get_timestamp_utc():
20
+ """Get the current timestamp in UTC."""
21
+ return datetime.datetime.now(datetime.UTC)
@@ -0,0 +1,101 @@
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/netrun/00_iutils/01_hashing.ipynb
2
+
3
+ __all__ = ['HashMethod', 'adler32', 'blake2b', 'crc32', 'hash', 'sha256', 'xxh64']
4
+
5
+ # %% nbs/netrun/00_iutils/01_hashing.ipynb 2
6
+ from typing import Any
7
+
8
+ import pickle
9
+ import pickletools
10
+ import zlib
11
+ import binascii
12
+ import hashlib
13
+ import struct
14
+ import xxhash
15
+ import json
16
+ from enum import Enum
17
+
18
+ # %% nbs/netrun/00_iutils/01_hashing.ipynb 4
19
+ def _preprocess_data(data: Any, pickle_protocol: int, try_json_dump: bool):
20
+ """
21
+ Preprocesses and converts the data to bytes for hashing.
22
+ """
23
+ if try_json_dump:
24
+ try:
25
+ data = json.dumps(data).encode("utf-8")
26
+ except TypeError:
27
+ pass
28
+
29
+ type_data = type(data)
30
+
31
+ if type_data is bytes:
32
+ return data
33
+ elif type_data is str:
34
+ return data.encode("utf-8")
35
+ elif type_data is int:
36
+ return data.to_bytes((data.bit_length() + 8) // 8, byteorder="big", signed=True)
37
+ elif type_data is float:
38
+ return struct.pack("!d", data)
39
+ else:
40
+ _data = pickle.dumps(data, protocol=pickle_protocol)
41
+ return pickletools.optimize(_data)
42
+
43
+ # %% nbs/netrun/00_iutils/01_hashing.ipynb 6
44
+ def adler32(bdata: bytes) -> int:
45
+ """
46
+ Compute portable hash for given data.
47
+ """
48
+ mask = 0xFFFFFFFF
49
+ return zlib.adler32(bdata) & mask
50
+
51
+ # %% nbs/netrun/00_iutils/01_hashing.ipynb 8
52
+ def crc32(bdata: bytes) -> int:
53
+ """
54
+ Compute portable hash using CRC32.
55
+ """
56
+ mask = 0xFFFFFFFF
57
+ return binascii.crc32(bdata) & mask
58
+
59
+ # %% nbs/netrun/00_iutils/01_hashing.ipynb 10
60
+ def sha256(bdata: bytes) -> int:
61
+ """
62
+ Compute hash using SHA-256.
63
+ """
64
+ return int.from_bytes(hashlib.sha256(bdata).digest(), byteorder="big")
65
+
66
+ # %% nbs/netrun/00_iutils/01_hashing.ipynb 12
67
+ def blake2b(bdata: bytes) -> int:
68
+ """
69
+ Compute hash using BLAKE2b.
70
+ """
71
+ return int.from_bytes(hashlib.blake2b(bdata).digest(), byteorder="big")
72
+
73
+ # %% nbs/netrun/00_iutils/01_hashing.ipynb 14
74
+ def xxh64(bdata: bytes) -> int:
75
+ """
76
+ Compute hash using xxHash (64-bit).
77
+ """
78
+ return xxhash.xxh64(bdata).intdigest()
79
+
80
+ # %% nbs/netrun/00_iutils/01_hashing.ipynb 16
81
+ class HashMethod(Enum):
82
+ adler32 = "adler32"
83
+ crc32 = "crc32"
84
+ sha256 = "sha256"
85
+ blake2b = "blake2b"
86
+ xxh64 = "xxh64"
87
+
88
+ def hash(data: Any, method: HashMethod, pickle_protocol: int, try_json_dump: bool) -> int:
89
+ bdata = _preprocess_data(data, pickle_protocol=pickle_protocol, try_json_dump=try_json_dump)
90
+ if method == HashMethod.adler32:
91
+ return adler32(bdata)
92
+ elif method == HashMethod.crc32:
93
+ return crc32(bdata)
94
+ elif method == HashMethod.sha256:
95
+ return sha256(bdata)
96
+ elif method == HashMethod.blake2b:
97
+ return blake2b(bdata)
98
+ elif method == HashMethod.xxh64:
99
+ return xxh64(bdata)
100
+ else:
101
+ raise ValueError(f"Invalid hash method: {method}")