solpython 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

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.
pysol/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """solpython — Python-to-EVM compiler, runs Python on-chain."""
2
2
 
3
- __version__ = "0.1.1"
3
+ __version__ = "0.1.2"
pysol/executor.py CHANGED
@@ -111,23 +111,22 @@ def run(source: str, *, verbose: bool = False) -> str:
111
111
  return _decode_output(w3, receipt)
112
112
 
113
113
 
114
- def _resolve_imports(source: str, script_dir: Path) -> dict[str, str]:
115
- """Parse source for import statements and load module files from disk."""
114
+ def _resolve_imports(source: str, script_dir: Path, *, _seen: set[str] | None = None) -> dict[str, str]:
115
+ """Parse source for import statements and load module files from disk (recursive)."""
116
+ if _seen is None:
117
+ _seen = set()
116
118
  modules = {}
117
- for match in re.finditer(r"^from\s+(\w+)\s+import\s+", source, re.MULTILINE):
118
- mod_name = match.group(1)
119
- if mod_name in modules:
119
+ for match in re.finditer(r"^(?:from\s+(\w+)\s+import\s+|import\s+(\w+))", source, re.MULTILINE):
120
+ mod_name = match.group(1) or match.group(2)
121
+ if mod_name in _seen:
120
122
  continue
123
+ _seen.add(mod_name)
121
124
  mod_path = script_dir / f"{mod_name}.py"
122
125
  if mod_path.exists():
123
- modules[mod_name] = mod_path.read_text()
124
- for match in re.finditer(r"^import\s+(\w+)", source, re.MULTILINE):
125
- mod_name = match.group(1)
126
- if mod_name in modules:
127
- continue
128
- mod_path = script_dir / f"{mod_name}.py"
129
- if mod_path.exists():
130
- modules[mod_name] = mod_path.read_text()
126
+ mod_src = mod_path.read_text()
127
+ modules[mod_name] = mod_src
128
+ nested = _resolve_imports(mod_src, script_dir, _seen=_seen)
129
+ modules.update(nested)
131
130
  return modules
132
131
 
133
132
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: solpython
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Python-to-EVM compiler — run Python on-chain via a Solidity smart contract pipeline
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -1,14 +1,14 @@
1
- pysol/__init__.py,sha256=CrThJr4pnScCO4lsl6ltTLk0JWxiQZ9ZRNb18AyhFmU,89
1
+ pysol/__init__.py,sha256=zJrpUdldW1PEsvELG18k6eCi5QLv7Yy7Xu_7JYtcpY4,89
2
2
  pysol/build.py,sha256=HUF8iFaegQcCY0DP45xsoFUCEWqPqIaXb4YhwXABETk,4483
3
- pysol/executor.py,sha256=WaRZd3fOchFoACkn-e86RbcFUWpe0mw5zWLuxZ7LBTI,5517
3
+ pysol/executor.py,sha256=sezxdR7EmzUk07hpBMrOlF1Ks4KI57csSZpPfIt7tpw,5516
4
4
  pysol/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  pysol/cli/main.py,sha256=ElB-LXK7Br0vtn84i-QhPNBDzAOLu_d9RBIWJxNCFlU,3280
6
6
  pysol/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  pysol/contracts/artifacts/PythonCompiler.json,sha256=01k6L0j8ZBWn2JG6CNdlRmhxpa-cHewJjY86-V3XfnU,437747
8
8
  pysol/contracts/artifacts/VM.json,sha256=_qK4oc1KN2Zy0bhRMvrGorYhp2mHbKWGddqjQv4kSEE,91038
9
- solpython-0.1.1.dist-info/licenses/LICENSE,sha256=GTNYUQJMKq5FV1co1N2BKUIxkAPPa2FCc8sLKO7x9FA,1065
10
- solpython-0.1.1.dist-info/METADATA,sha256=ggj-hf8P8w51exL1auqa656jxxylwE1idX-n2UpEqaA,6497
11
- solpython-0.1.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
12
- solpython-0.1.1.dist-info/entry_points.txt,sha256=_s3EKcXf0MyFyfvA2r3llhjghAuMwS0PNRgFLxERppo,84
13
- solpython-0.1.1.dist-info/top_level.txt,sha256=rM0iJ3CoB_QH43ATGuXjYgViiQkxBgtslv7tJqxUulM,6
14
- solpython-0.1.1.dist-info/RECORD,,
9
+ solpython-0.1.2.dist-info/licenses/LICENSE,sha256=GTNYUQJMKq5FV1co1N2BKUIxkAPPa2FCc8sLKO7x9FA,1065
10
+ solpython-0.1.2.dist-info/METADATA,sha256=Anb1PbwQ_nb3OmvZvzMdIPzKYFxCPku6c5BZIZrXyQY,6497
11
+ solpython-0.1.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
12
+ solpython-0.1.2.dist-info/entry_points.txt,sha256=_s3EKcXf0MyFyfvA2r3llhjghAuMwS0PNRgFLxERppo,84
13
+ solpython-0.1.2.dist-info/top_level.txt,sha256=rM0iJ3CoB_QH43ATGuXjYgViiQkxBgtslv7tJqxUulM,6
14
+ solpython-0.1.2.dist-info/RECORD,,