{"id":14958521,"url":"https://github.com/ethereum/py-solc","last_synced_at":"2025-05-16T05:06:07.334Z","repository":{"id":56301291,"uuid":"63730598","full_name":"ethereum/py-solc","owner":"ethereum","description":"Python wrapper around the solc Solidity compiler.","archived":false,"fork":false,"pushed_at":"2020-04-21T10:20:33.000Z","size":160,"stargazers_count":196,"open_issues_count":19,"forks_count":250,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-10T23:17:57.949Z","etag":null,"topics":["blockchain","ethereum","py-solc","python","python-wrapper","python3","solc","solidity","solidity-compiler"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethereum.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-19T21:55:56.000Z","updated_at":"2025-05-10T20:04:01.000Z","dependencies_parsed_at":"2022-08-15T16:20:10.847Z","dependency_job_id":null,"html_url":"https://github.com/ethereum/py-solc","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Fpy-solc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Fpy-solc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Fpy-solc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Fpy-solc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethereum","download_url":"https://codeload.github.com/ethereum/py-solc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471061,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","ethereum","py-solc","python","python-wrapper","python3","solc","solidity","solidity-compiler"],"created_at":"2024-09-24T13:17:17.271Z","updated_at":"2025-05-16T05:06:07.315Z","avatar_url":"https://github.com/ethereum.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py-solc\n\n[![Build Status](https://travis-ci.org/ethereum/py-solc.png)](https://travis-ci.org/ethereum/py-solc)\n[![PyPi version](https://img.shields.io/pypi/v/py-solc.svg)](https://pypi.python.org/pypi/py-solc)\n   \n\nPython wrapper around the `solc` Solidity compiler.\n\n\n## Dependency\n\nThis library requires the `solc` executable to be present.\n\nOnly versions `\u003e=0.4.2` are supported and tested though this library may work\nwith other versions.\n\n[solc installation instructions](http://solidity.readthedocs.io/en/latest/installing-solidity.html)\n\n\n## Quickstart\n\nInstallation\n\n```sh\npip install py-solc\n```\n\n## Development\n\nClone the repository and then run:\n\n```sh\npip install -e . -r requirements-dev.txt\n```\n\n\n### Running the tests\n\nYou can run the tests with:\n\n```sh\npy.test tests\n```\n\nOr you can install `tox` to run the full test suite.\n\n\n### Releasing\n\nPandoc is required for transforming the markdown README to the proper format to\nrender correctly on pypi.\n\nFor Debian-like systems:\n\n```\napt install pandoc\n```\n\nOr on OSX:\n\n```sh\nbrew install pandoc\n```\n\nTo release a new version:\n\n```sh\nbumpversion $$VERSION_PART_TO_BUMP$$\ngit push \u0026\u0026 git push --tags\nmake release\n```\n\n\n#### How to bumpversion\n\nThe version format for this repo is `{major}.{minor}.{patch}` for stable, and\n`{major}.{minor}.{patch}-{stage}.{devnum}` for unstable (`stage` can be alpha or beta).\n\nTo issue the next version in line, use bumpversion and specify which part to bump,\nlike `bumpversion minor` or `bumpversion devnum`.\n\nIf you are in a beta version, `bumpversion stage` will switch to a stable.\n\nTo issue an unstable version when the current version is stable, specify the\nnew version explicitly, like `bumpversion --new-version 4.0.0-alpha.1 devnum`\n\n\n\n\n## Standard JSON Compilation\n\nUse the `solc.compile_standard` function to make use the [standard-json] compilation feature.\n\n[Solidity Documentation for Standard JSON input and ouptup format](http://solidity.readthedocs.io/en/develop/using-the-compiler.html#compiler-input-and-output-json-description)\n\n```\n\u003e\u003e\u003e from solc import compile_standard\n\u003e\u003e\u003e compile_standard({\n...     'language': 'Solidity',\n...     'sources': {'Foo.sol': 'content': \"....\"},\n... })\n{\n    'contracts': {...},\n    'sources': {...},\n    'errors': {...},\n}\n\u003e\u003e\u003e compile_standard({\n...     'language': 'Solidity',\n...     'sources': {'Foo.sol': 'urls': [\"/path/to/my/sources/Foo.sol\"]},\n... }, allow_paths=\"/path/to/my/sources\")\n{\n    'contracts': {...},\n    'sources': {...},\n    'errors': {...},\n}\n```\n\n\n## Legacy Combined JSON compilation\n\n\n```python\n\u003e\u003e\u003e from solc import compile_source, compile_files, link_code\n\u003e\u003e\u003e compile_source(\"contract Foo { function Foo() {} }\")\n{\n    'Foo': {\n        'abi': [{'inputs': [], 'type': 'constructor'}],\n        'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00',\n        'code_runtime': '0x60606040526008565b00',\n        'source': None,\n        'meta': {\n            'compilerVersion': '0.3.5-9da08ac3',\n            'language': 'Solidity',\n            'languageVersion': '0',\n        },\n    },\n}\n\u003e\u003e\u003e compile_files([\"/path/to/Foo.sol\", \"/path/to/Bar.sol\"])\n{\n    'Foo': {\n        'abi': [{'inputs': [], 'type': 'constructor'}],\n        'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00',\n        'code_runtime': '0x60606040526008565b00',\n        'source': None,\n        'meta': {\n            'compilerVersion': '0.3.5-9da08ac3',\n            'language': 'Solidity',\n            'languageVersion': '0',\n        },\n    },\n    'Bar': {\n        'abi': [{'inputs': [], 'type': 'constructor'}],\n        'code': '0x60606040525b5b600a8060126000396000f360606040526008565b00',\n        'code_runtime': '0x60606040526008565b00',\n        'source': None,\n        'meta': {\n            'compilerVersion': '0.3.5-9da08ac3',\n            'language': 'Solidity',\n            'languageVersion': '0',\n        },\n    },\n}\n\u003e\u003e\u003e unlinked_code = \"606060405260768060106000396000f3606060405260e060020a6000350463e7f09e058114601a575b005b60187f0c55699c00000000000000000000000000000000000000000000000000000000606090815273__TestA_________________________________90630c55699c906064906000906004818660325a03f41560025750505056\"\n\u003e\u003e\u003e link_code(unlinked_code, {'TestA': '0xd3cda913deb6f67967b99d67acdfa1712c293601'})\n... \"606060405260768060106000396000f3606060405260e060020a6000350463e7f09e058114601a575b005b60187f0c55699c00000000000000000000000000000000000000000000000000000000606090815273d3cda913deb6f67967b99d67acdfa1712c29360190630c55699c906064906000906004818660325a03f41560025750505056\"\n```\n\n## Setting the path to the `solc` binary\n\nYou can use the environment variable `SOLC_BINARY` to set the path to your solc binary.\n\n\n## Installing the `solc` binary\n\n\u003e This feature is experimental and subject to breaking changes.\n\nAny of the following versions of `solc` can be installed using `py-solc` on the\nlisted platforms.\n\n* `v0.4.1` (linux)\n* `v0.4.2` (linux)\n* `v0.4.6` (linux)\n* `v0.4.7` (linux)\n* `v0.4.8` (linux/osx)\n* `v0.4.9` (linux)\n* `v0.4.11` (linux/osx)\n* `v0.4.12` (linux/osx)\n* `v0.4.13` (linux/osx)\n* `v0.4.14` (linux/osx)\n* `v0.4.15` (linux/osx)\n* `v0.4.16` (linux/osx)\n* `v0.4.17` (linux/osx)\n* `v0.4.18` (linux/osx)\n* `v0.4.19` (linux/osx)\n* `v0.4.20` (linux/osx)\n* `v0.4.21` (linux/osx)\n* `v0.4.22` (linux/osx)\n* `v0.4.23` (linux/osx)\n* `v0.4.24` (linux/osx)\n* `v0.4.25` (linux/osx)\n\nInstallation can be done via the command line:\n\n```bash\n$ python -m solc.install v0.4.25\n```\n\nOr from python using the `install_solc` function.\n\n```python\n\u003e\u003e\u003e from solc import install_solc\n\u003e\u003e\u003e install_solc('v0.4.25')\n```\n\nThe installed binary can be found under your home directory.  The `v0.4.25`\nbinary would be located at `$HOME/.py-solc/solc-v0.4.25/bin/solc`.  Older linux\ninstalls will also require that you set the environment variable\n`LD_LIBRARY_PATH=$HOME/.py-solc/solc-v0.4.25/bin`\n\n\n## Import path remappings\n\n`solc` provides path aliasing allow you to have more reusable project configurations.\n \nYou can use this like:\n\n```\nfrom solc import compile_source, compile_files, link_code\n\ncompile_files([source_file_path], import_remappings=[\"zeppeling=/my-zeppelin-checkout-folder\"])\n```\n\n[More information about solc import aliasing](http://solidity.readthedocs.io/en/develop/layout-of-source-files.html#paths) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethereum%2Fpy-solc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethereum%2Fpy-solc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethereum%2Fpy-solc/lists"}