|
| 1 | +# py-solc |
| 2 | + |
| 3 | +[](https://travis-ci.org/pipermerriam/py-solc) |
| 4 | +[](https://pypi.python.org/pypi/py-solc) |
| 5 | +[](https://pypi.python.org/pypi/py-solc) |
| 6 | + |
| 7 | + |
| 8 | +Python wrapper around the `solc` solidity compiler. |
| 9 | + |
| 10 | + |
| 11 | +# Dependency |
| 12 | + |
| 13 | +This library requires the `solc` executable to be present. |
| 14 | + |
| 15 | + |
| 16 | +# Quickstart |
| 17 | + |
| 18 | +Installation |
| 19 | + |
| 20 | +```sh |
| 21 | +pip install py-solc |
| 22 | +``` |
| 23 | + |
| 24 | +```python |
| 25 | +>>> from solc import compile_source, compile_files |
| 26 | +>>> compile_source("contract Foo { function Foo() {} }") |
| 27 | +{ |
| 28 | + 'Foo': { |
| 29 | + 'abi': [{'inputs': [], 'type': 'constructor'}], |
| 30 | + 'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00', |
| 31 | + 'code_runtime': '0x60606040526008565b00', |
| 32 | + 'source': None, |
| 33 | + 'meta': { |
| 34 | + 'compilerVersion': '0.3.5-9da08ac3', |
| 35 | + 'language': 'Solidity', |
| 36 | + 'languageVersion': '0', |
| 37 | + }, |
| 38 | + }, |
| 39 | +} |
| 40 | +>>> compile_source(["/path/to/Foo.sol", "/path/to/Bar.sol"]) |
| 41 | +{ |
| 42 | + 'Foo': { |
| 43 | + 'abi': [{'inputs': [], 'type': 'constructor'}], |
| 44 | + 'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00', |
| 45 | + 'code_runtime': '0x60606040526008565b00', |
| 46 | + 'source': None, |
| 47 | + 'meta': { |
| 48 | + 'compilerVersion': '0.3.5-9da08ac3', |
| 49 | + 'language': 'Solidity', |
| 50 | + 'languageVersion': '0', |
| 51 | + }, |
| 52 | + }, |
| 53 | + 'Bar': { |
| 54 | + 'abi': [{'inputs': [], 'type': 'constructor'}], |
| 55 | + 'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00', |
| 56 | + 'code_runtime': '0x60606040526008565b00', |
| 57 | + 'source': None, |
| 58 | + 'meta': { |
| 59 | + 'compilerVersion': '0.3.5-9da08ac3', |
| 60 | + 'language': 'Solidity', |
| 61 | + 'languageVersion': '0', |
| 62 | + }, |
| 63 | + }, |
| 64 | +} |
| 65 | +``` |
0 commit comments