diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..3c5f3cb --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,23 @@ +[bumpversion] +current_version = 0.7.1 +commit = True +tag = True +parse = (?P\d+)\.(?P\d+)\.(?P\d+)(-(?P[^.]*)\.(?P\d+))? +serialize = + {major}.{minor}.{patch}-{stage}.{devnum} + {major}.{minor}.{patch} + +[bumpversion:part:stage] +optional_value = stable +first_value = stable +values = + alpha + beta + stable + +[bumpversion:part:devnum] + +[bumpversion:file:setup.py] +search = version='{current_version}', +replace = version='{new_version}', + diff --git a/.travis.yml b/.travis.yml index e7e4aeb..fd53dad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ python: - "3.5" os: - linux - #- osx dist: trusty sudo: required env: @@ -23,95 +22,95 @@ matrix: env: TOX_POSARGS="-e py35-installation" # solc 0.4.1 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.1 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.1 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.1 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.1 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.1 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.1 # solc 0.4.2 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.2 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.2 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.2 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.2 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.2 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.2 # solc 0.4.6 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.6 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.6 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.6 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.6 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.6 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.6 # solc 0.4.7 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.7 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.7 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.7 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.7 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.7 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.7 # solc 0.4.8 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.8 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.8 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.8 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.8 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.8 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.8 # solc 0.4.9 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.9 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.9 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.9 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.9 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.9 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.9 # solc 0.4.11 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.11 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.11 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.11 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.11 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.11 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.11 # solc 0.4.12 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.12 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.12 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.12 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.12 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.12 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.12 # solc 0.4.13 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.13 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.13 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.13 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.13 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.13 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.13 # solc 0.4.14 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.14 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.14 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.14 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.14 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.14 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.14 # solc 0.4.15 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.15 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.15 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.15 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.15 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.15 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.15 # solc 0.4.16 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.16 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.16 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.16 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.16 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.16 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.16 # solc 0.4.17 - python: "2.7" - env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.17 + env: TOX_POSARGS="-e py27" SOLC_VERSION=v0.4.17 - python: "3.4" - env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.17 + env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.17 - python: "3.5" - env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.17 + env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.17 cache: - pip: true before_install: diff --git a/README.md b/README.md index bb8cc97..a5cc551 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Python wrapper around the `solc` Solidity compiler. -# Dependency +## Dependency This library requires the `solc` executable to be present. @@ -18,7 +18,7 @@ with other versions. [solc installation instructions](http://solidity.readthedocs.io/en/latest/installing-solidity.html) -# Quickstart +## Quickstart Installation @@ -26,13 +26,66 @@ Installation pip install py-solc ``` -Or to install with support for gevent +## Development + +Clone the repository and then run: + +```sh +pip install -e . -r requirements-dev.txt +``` + + +### Running the tests + +You can run the tests with: + +```sh +py.test tests +``` + +Or you can install `tox` to run the full test suite. + + +### Releasing + +Pandoc is required for transforming the markdown README to the proper format to +render correctly on pypi. + +For Debian-like systems: + +``` +apt install pandoc +``` + +Or on OSX: + +```sh +brew install pandoc +``` + +To release a new version: ```sh -pip install py-solc[gevent] +bumpversion $$VERSION_PART_TO_BUMP$$ +git push && git push --tags +make release ``` -To enable gevent subprocessing set the environment variable `SOLC_THREADING_BACKEND=gevent` + +#### How to bumpversion + +The version format for this repo is `{major}.{minor}.{patch}` for stable, and +`{major}.{minor}.{patch}-{stage}.{devnum}` for unstable (`stage` can be alpha or beta). + +To issue the next version in line, use bumpversion and specify which part to bump, +like `bumpversion minor` or `bumpversion devnum`. + +If you are in a beta version, `bumpversion stage` will switch to a stable. + +To issue an unstable version when the current version is stable, specify the +new version explicitly, like `bumpversion --new-version 4.0.0-alpha.1 devnum` + + ## Standard JSON Compilation diff --git a/requirements-dev.txt b/requirements-dev.txt index 93eb7b3..624a138 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,4 @@ pytest>=2.9.2 tox>=2.3.1 semantic_version>=2.6.0 +bumpversion==0.5.3 diff --git a/setup.py b/setup.py index 9e16028..d7a2a99 100644 --- a/setup.py +++ b/setup.py @@ -1,42 +1,30 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import os - from setuptools import ( setup, find_packages, ) -DIR = os.path.dirname(os.path.abspath(__file__)) - -readme = open(os.path.join(DIR, 'README.md')).read() - - setup( name='py-solc', version="1.4.0", description="""Python wrapper around the solc binary""", - long_description=readme, + long_description_markdown_filename='README.md', author='Piper Merriam', author_email='pipermerriam@gmail.com', url='https://github.com/pipermerriam/py-solc', include_package_data=True, py_modules=['solc'], + setup_requires=['setuptools-markdown'], install_requires=[ "semantic_version>=2.6.0", ], - extras_require={ - 'gevent': [ - "gevent>=1.1.1,<1.2.0", - ], - }, license="MIT", zip_safe=False, keywords='ethereum solidity solc', packages=find_packages(exclude=["tests", "tests.*"]), classifiers=[ - 'Development Status :: 2 - Pre-Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', diff --git a/solc/compat.py b/solc/compat.py deleted file mode 100644 index e17e7e6..0000000 --- a/solc/compat.py +++ /dev/null @@ -1,21 +0,0 @@ -import os - - -def get_threading_backend(): - if 'SOLC_THREADING_BACKEND' in os.environ: - return os.environ['SOLC_THREADING_BACKEND'] - elif 'THREADING_BACKEND' in os.environ: - return os.environ['THREADING_BACKEND'] - else: - return 'stdlib' - - -THREADING_BACKEND = get_threading_backend() - - -if THREADING_BACKEND == 'stdlib': - import subprocess -elif THREADING_BACKEND == 'gevent': - from gevent import subprocess # noqa: F401 -else: - raise ValueError("Unsupported threading backend. Must be one of 'gevent' or 'stdlib'") diff --git a/solc/wrapper.py b/solc/wrapper.py index 3ea461c..56e7e0f 100644 --- a/solc/wrapper.py +++ b/solc/wrapper.py @@ -1,8 +1,8 @@ from __future__ import absolute_import import os +import subprocess -from .compat import subprocess from .exceptions import ( SolcError, ) diff --git a/tests/compilation/test_compile_empty.py b/tests/core/compilation/test_compile_empty.py similarity index 100% rename from tests/compilation/test_compile_empty.py rename to tests/core/compilation/test_compile_empty.py diff --git a/tests/compilation/test_compile_from_source_code.py b/tests/core/compilation/test_compile_from_source_code.py similarity index 100% rename from tests/compilation/test_compile_from_source_code.py rename to tests/core/compilation/test_compile_from_source_code.py diff --git a/tests/compilation/test_compile_standard.py b/tests/core/compilation/test_compile_standard.py similarity index 100% rename from tests/compilation/test_compile_standard.py rename to tests/core/compilation/test_compile_standard.py diff --git a/tests/compilation/test_compiler_from_source_file.py b/tests/core/compilation/test_compiler_from_source_file.py similarity index 100% rename from tests/compilation/test_compiler_from_source_file.py rename to tests/core/compilation/test_compiler_from_source_file.py diff --git a/tests/compilation/test_compiler_remappings.py b/tests/core/compilation/test_compiler_remappings.py similarity index 100% rename from tests/compilation/test_compiler_remappings.py rename to tests/core/compilation/test_compiler_remappings.py diff --git a/tests/linking/test_library_linking.py b/tests/core/linking/test_library_linking.py similarity index 100% rename from tests/linking/test_library_linking.py rename to tests/core/linking/test_library_linking.py diff --git a/tests/utility/test_is_executable_available.py b/tests/core/utility/test_is_executable_available.py similarity index 100% rename from tests/utility/test_is_executable_available.py rename to tests/core/utility/test_is_executable_available.py diff --git a/tests/utility/test_solc_supports_standard_json.py b/tests/core/utility/test_solc_supports_standard_json.py similarity index 100% rename from tests/utility/test_solc_supports_standard_json.py rename to tests/core/utility/test_solc_supports_standard_json.py diff --git a/tests/utility/test_solc_version.py b/tests/core/utility/test_solc_version.py similarity index 100% rename from tests/utility/test_solc_version.py rename to tests/core/utility/test_solc_version.py diff --git a/tests/wrapper/test_solc_wrapper.py b/tests/core/wrapper/test_solc_wrapper.py similarity index 100% rename from tests/wrapper/test_solc_wrapper.py rename to tests/core/wrapper/test_solc_wrapper.py diff --git a/tox.ini b/tox.ini index 7b9bd91..c2be667 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,6 @@ [tox] envlist= - py{27,34,35}-{gevent,stdlib}, - py{27,34,35}-installation + py{27,34,35}-{core,installation} flake8 [flake8] @@ -10,17 +9,15 @@ exclude= tests/* [testenv] commands= - {gevent,stdlib}: py.test {posargs:tests} - py{27,34,35}-installation: py.test {posargs:-s tests/installation} + core: py.test {posargs:tests/core} + installation: py.test {posargs:-s tests/installation} passenv = SOLC_BINARY TRAVIS_BUILD_DIR setenv = - gevent: SOLC_THREADING_BACKEND=gevent py{27,34,35}-installation: SOLC_RUN_INSTALL_TESTS=enabled deps = -r{toxinidir}/requirements-dev.txt - gevent: gevent>=1.1.1,<1.2.0 basepython = py27: python2.7 py34: python3.4