React-Redux-Flask
React-Redux-Flask copied to clipboard
Python 3.6+ Support
This is an improvement rather than an issue at the moment, but is there any plan for Python 3.6+ support?
Per the README, the optional install of python3 and the Python 3.+ in the project requirements threw me off a bit. When running with 3.6.4, the tests throw a number of issues, starting with the utf8 decoding. I rolled back to the macOS default of 2.7.14 and was able to run the tests/server successfully.
(This could very well also be unrelated to this project's Python 3.6+ support and some weird python3 macOS nonsense.)
For added detail (using the caniusepython3 pip package):
❯ caniusepython3 -r requirements.txt
Finding and checking dependencies ...
You need 1 project to transition to Python 3.
Of that 1 project, 1 has no direct dependencies blocking its transition:
flask-bcrypt
Per the flask-bcrypt docs: "In Python 3, you need to use decode(‘utf-8’) on generate_password_hash(), like below:
pw_hash = bcrypt.generate_password_hash(‘hunter2’).decode(‘utf-8’)
This all appears to be done correctly in the repo then, so I'm guessing that it's macOS related at this point.
The flask docs are wrong, in Python 3 strings are decoded for you and you'll get an error if you try:
Traceback (most recent call last):
...
File "/home/application/models.py", line 12, in __init__
self.password = User.hashed_password(password)
File "/home/application/models.py", line 16, in hashed_password
return bcrypt.generate_password_hash(password).decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'
Simply removing the decode
function will make the app run fine, and pass all the tests too.