Skip to main content
# py-solc

[![Build Status](https://travis-ci.org/pipermerriam/py-solc.png)](https://travis-ci.org/pipermerriam/py-solc)
[![PyPi version](https://pypip.in/v/py-solc/badge.png)](https://pypi.python.org/pypi/py-solc)
[![PyPi downloads](https://pypip.in/d/py-solc/badge.png)](https://pypi.python.org/pypi/py-solc)


Python wrapper around the `solc` Solidity compiler.


# Dependency

This library requires the `solc` executable to be present.

solc 0.3.5 or newer is required. [solc installation instructions](http://solidity.readthedocs.io/en/latest/installing-solidity.html)


# Quickstart

Installation

```sh
pip install py-solc
```

```python
>>> from solc import compile_source, compile_files, link_code
>>> compile_source("contract Foo { function Foo() {} }")
{
'Foo': {
'abi': [{'inputs': [], 'type': 'constructor'}],
'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00',
'code_runtime': '0x60606040526008565b00',
'source': None,
'meta': {
'compilerVersion': '0.3.5-9da08ac3',
'language': 'Solidity',
'languageVersion': '0',
},
},
}
>>> compile_files(["/path/to/Foo.sol", "/path/to/Bar.sol"])
{
'Foo': {
'abi': [{'inputs': [], 'type': 'constructor'}],
'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00',
'code_runtime': '0x60606040526008565b00',
'source': None,
'meta': {
'compilerVersion': '0.3.5-9da08ac3',
'language': 'Solidity',
'languageVersion': '0',
},
},
'Bar': {
'abi': [{'inputs': [], 'type': 'constructor'}],
'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00',
'code_runtime': '0x60606040526008565b00',
'source': None,
'meta': {
'compilerVersion': '0.3.5-9da08ac3',
'language': 'Solidity',
'languageVersion': '0',
},
},
}
>>> unlinked_code = "606060405260768060106000396000f3606060405260e060020a6000350463e7f09e058114601a575b005b60187f0c55699c00000000000000000000000000000000000000000000000000000000606090815273__TestA_________________________________90630c55699c906064906000906004818660325a03f41560025750505056"
>>> link_code(unlinked_code, {'TestA': '0xd3cda913deb6f67967b99d67acdfa1712c293601'})
... "606060405260768060106000396000f3606060405260e060020a6000350463e7f09e058114601a575b005b60187f0c55699c00000000000000000000000000000000000000000000000000000000606090815273d3cda913deb6f67967b99d67acdfa1712c29360190630c55699c906064906000906004818660325a03f41560025750505056"
```

Metadata

Release files for py-solc 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-solc 0.3.0
File Size Uploaded Provenance Actions
py-solc-0.3.0.tar.gz 5.9 kB Without provenance Details for py-solc-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for py-solc 0.3.0
File Interpreter ABI Platform Actions
py_solc-0.3.0-py2-none-any.whl Python 2 none any Details for py_solc-0.3.0-py2-none-any.whl
py-solc-0.3.0.macosx-10.11-x86_64.tar.gz Details for py-solc-0.3.0.macosx-10.11-x86_64.tar.gz

Total release size: 18.9 kB

Release files / py-solc-0.3.0.tar.gz

Download URL py-solc-0.3.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
497dc194271262113e272ac7d31f7902bdfb826b34c5b9e4ac6cdddb72a4114f
BLAKE2b-256 checksum
How to use checksums
c6559366f996fb5de5e36fd0cde2727d8e393486d3c02638af40449fdc6a2338
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / py_solc-0.3.0-py2-none-any.whl

Download URL py_solc-0.3.0-py2-none-any.whl
Size 8.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
a02fde2b22e5f4f939fc3a8361519726e4ac613f2439e65079817dc133d36752
BLAKE2b-256 checksum
How to use checksums
a1b374b545667672ad72aef0d6a47dcfbccbbcb00a0af025c1fc826e93da987f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / py-solc-0.3.0.macosx-10.11-x86_64.tar.gz

Download URL py-solc-0.3.0.macosx-10.11-x86_64.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e57509a60c3113a1a51e8f1291ea8fce852c5788f140695d71a4189f3077942b
BLAKE2b-256 checksum
How to use checksums
37f6c71e06b1318dfb2cf20c2eb70ecb27e1b51033e8bb82e64dbbfef4852ef3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for py-solc 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page