steemit / steem-python

The official Python (3) library for the Steem Blockchain.
https://steem.io
MIT License
154 stars 100 forks source link

Python 2.7 Support - Closes Issues #128, #135, #138, and #157 #158

Closed cyon1c closed 6 years ago

cyon1c commented 6 years ago

This PR will bring Python 2.7 Support to steem-python.

Changes roughly fall into 2 broad categories:

  1. Remove Breaking 3.6 Syntax

    • Type Hinting -> removal of type hints from method signatures.
    • Dictionary Unpacking/Flattening -> removal of ** syntax in dict construction.
    • Changing yield from syntax to for x in xyz: yield x.
    • Class definitions & super updated.
  2. Type Compatibility

    • Bytes: in Python 2.7, bytes is simply an alias for str, which caused wide ranging issues. To resolve this, the future_bytes method was added to utils.py, along with the library python-future. All class methods named __bytes__ have been refactored to to_bytes and all references in the app to bytes() has been refactored to future_bytes.
    • Chr: chr() in 3.6 maps to unichr() in 2.7, so version checking was added in utils.py to call the appropriate function in the form of to_chr.

Currently, steem-python passes all tests (65/65) when run both in Python 2.7 and Python 3.6

roadscape commented 6 years ago

Some feedback after a cursory look:

cyon1c commented 6 years ago

I've made updates which should address all your comments, @roadscape . @sneak and @john-g-g , how are we addressing the proposed changes for the pipfile?

@john-g-g regarding the updates to the circle.yml file, it just runs the docker build - so really do the updates need to be in the Dockerfile, not circle.yml file?