Conversation
| repeatedly with a few vendors. | ||
|
|
||
| ## Prerequisites | ||
| `Iota-swarm-node` is compatible with Python 3.5. |
There was a problem hiding this comment.
The wording is misleading. Instead, python 3.5+ is required as PyOTA configures. You have to emphasize on the rationale in plain English descriptions, otherwise nobody can be aware of it.
| @@ -0,0 +1,12 @@ | |||
| PYTHON = python3 | |||
| PYTHON := $(shell which $(PYTHON)) | |||
| ifndef PYTHON | |||
There was a problem hiding this comment.
Add extra condition if python indicated by $PATH is exactly of version 3. Think of the case that somebody built Python3 from source and the generated executable is python.
| PYTHON = python3 | ||
| PYTHON := $(shell which $(PYTHON)) | ||
| ifndef PYTHON | ||
| $(error "python3 is required.") |
There was a problem hiding this comment.
Since Python 3.5+ is required, you have to validate its version.
| PY_CHECK_MOD_IOTA := $(shell $(PYTHON) -c "import iota" 2>/dev/null && \ | ||
| echo 1 || echo 0) | ||
| ifneq ("$(PY_CHECK_MOD_IOTA)","1") | ||
| $(error "skip $@ because PyIOTA is not installed.") |
There was a problem hiding this comment.
It is PyOTA or iota.lib.py.
There was a problem hiding this comment.
The error message is wrong because it does not "skip". Instead, we would take actions if both Python3 and PyOTA are absent. You shall dump informative diagnosis messages.
| PY_CHECK_MOD_IOTA := $(shell $(PYTHON) -c "import iota" 2>/dev/null && \ | ||
| echo 1 || echo 0) | ||
| ifneq ("$(PY_CHECK_MOD_IOTA)","1") | ||
| $(error "skip $@ because PyOTA is not installed.") |
There was a problem hiding this comment.
Inform users of the diagnosis and information about trouble shooting. Change the wording from "skip" to something really making sense.
|
TODO: Validate Python installation from the perspectives of the following:
|
jserv
left a comment
There was a problem hiding this comment.
Improve Python version validation.
| PY_CHECK_MOD_IOTA := $(shell $(PYTHON) -c "import iota" 2>/dev/null && \ | ||
| echo 1 || echo 0) | ||
| ifneq ("$(PY_CHECK_MOD_IOTA)","1") | ||
| $(error "dependency error $@ because PyOTA is not installed, to install the latest version: pip install pyota") |
There was a problem hiding this comment.
Display error messages in multiple lines.
| @@ -0,0 +1,12 @@ | |||
| PYTHON = python3.5 | |||
There was a problem hiding this comment.
The detection is not correct. If python is built from source, only file python is generated. You shall validate through the output of python --version.
There was a problem hiding this comment.
The coverage about Python 3.7 is not addressed yet.
There was a problem hiding this comment.
You shall always try to build Python from source and check how its directory structure is.
| repeatedly with a few vendors. | ||
|
|
||
| ## Prerequisites | ||
| `iota-swarm-node`, writing with Python3+ compatible code as well as depending on [Pyota](https://github.com/iotaledger/iota.lib.py) is theoretically available for bot Python 3.5 and 3.6; yet, our testing result indicates that the environment for Python 3.6 is invalid in this case. Details as [Pyota issue#203](https://github.com/iotaledger/iota.lib.py/issues/203). |
There was a problem hiding this comment.
Fix the grammar again. It is not "writing with".
There was a problem hiding this comment.
You might have to consider virtualenv or pythonbrew.
There was a problem hiding this comment.
The explanation should be enforced to validation logic.
| PY_CHECK_MOD_IOTA := $(shell $(PYTHON) -c "import iota" 2>/dev/null && \ | ||
| echo 1 || echo 0) | ||
| ifneq ("$(PY_CHECK_MOD_IOTA)","1") | ||
| $(error "dependency error $@ because PyOTA is not installed, to install the latest version: pip3 install pyota") |
There was a problem hiding this comment.
If Python executable is restricted, the validation of pip would be considered.
|
|
||
| ## Prerequisites | ||
| `iota-swarm-node`, writing with Python3+ compatible code as well as depending on [Pyota](https://github.com/iotaledger/iota.lib.py) is theoretically available for bot Python 3.5 and 3.6; yet, our testing result indicates that the environment for Python 3.6 is invalid in this case. Details as [Pyota issue#203](https://github.com/iotaledger/iota.lib.py/issues/203). | ||
| `iota-swarm-node`, compatible with Python3+ as well as depending on [Pyota](https://github.com/iotaledger/iota.lib.py) is theoretically available for both Python 3.5 and 3.6; yet, our testing result indicates that the environment for Python 3.6 is invalid in this case. Details as [Pyota issue#203](https://github.com/iotaledger/iota.lib.py/issues/203). |
There was a problem hiding this comment.
It is PyOTA instead of Pyota.
| $(error "Python is not executable, try to check the PATH environment variable or install $(PYTHON_COMPATIBLE) package.") | ||
| endif # PYTHON | ||
|
|
||
| ifdef PYTHON |
There was a problem hiding this comment.
You don't have to check $(PYTHON) since you already exclude its absence.
|
|
||
| ifdef PYTHON_COMPATIBLE_PATH | ||
| $(error "Found $(PYTHON_COMPATIBLE) in current environment, but it should be setting as \ | ||
| default interpreter, try to create a symbolic link for $(PYTHON_COMPATIBLE_PATH)") |
There was a problem hiding this comment.
Don't suggest to make symbolic link. Instead, configure via environment variables.
| endif | ||
| endif # PYTHON | ||
|
|
||
| ifndef PYTHON |
There was a problem hiding this comment.
Ditto. Focus on detailed items.
| ifneq ("$(PY_CHECK_MOD_IOTA)","1") | ||
| $(error "dependency error $@ because PyOTA is not installed, to install the latest version: pip3 install pyota") | ||
| endif | ||
| endif # PYTHON |
There was a problem hiding this comment.
Avoid nested ifdef and endif pair as possible as you can.
| $(error "Found $(PYTHON_COMPATIBLE) in current environment, but it should be setting as \ | ||
| default interpreter, try to create a symbolic link for $(PYTHON_COMPATIBLE_PATH)") | ||
| else | ||
| $(error "$(shell python -V):Invalid Python version, only available for $(PYTHON_COMPATIBLE).") |
There was a problem hiding this comment.
It is NOT Invalid Python version. Instead, only Python 3.5 is known to work with PyOTA. You have to address.
| PYTHON := $(shell which $(PYTHON)) | ||
| # check Python version | ||
| PYTHON := $(shell which "python") | ||
| PYTHON_COMPATIBLE = python3.5 |
There was a problem hiding this comment.
Rename it to PYTHON35 to reflect its functionality.
| PY_CHECK_VERSION := $(shell python -c "print(__import__('sys').version_info[0:2])") | ||
|
|
||
| ifneq ($(PY_CHECK_VERSION), (3, 5)) | ||
| PYTHON_COMPATIBLE_PATH := $(shell which $(PYTHON_COMPATIBLE)) |
There was a problem hiding this comment.
Don't rely on new var PYTHON_COMPATIBLE_PATH. Instead, override PYTHON since you always block the one which is not accepted by each qualification.
| repeatedly with a few vendors. | ||
|
|
||
| ## Prerequisites | ||
| `iota-swarm-node`, compatible with Python3+ as well as depending on [Pyota](https://github.com/iotaledger/iota.lib.py) is theoretically available for both Python 3.5 and 3.6; yet, our testing result indicates that the environment for Python 3.6 is invalid in this case. Details as [Pyota issue#203](https://github.com/iotaledger/iota.lib.py/issues/203). |
There was a problem hiding this comment.
Correct the wording: "invalid"
There was a problem hiding this comment.
Remove "theoretically". Instead, it would be "expectedly" or something alike.
There was a problem hiding this comment.
Replace Pyota issue#203 with PyOTA issue #203. Be aware of the spelling.
| str('.') + str(__import__('sys').version_info.minor) )") | ||
|
|
||
| ifneq ($(PY_CHECK_VERSION), $(PYTHON_COMPATIBLE_VERSION)) | ||
|
|
| PYTHON := $(shell which "python") | ||
| PYTHON_COMPATIBLE_VERSION = 3.5 | ||
|
|
||
| ifndef PYTHON |
There was a problem hiding this comment.
If python is not present, try python3. Then, if version is mismatching, try python3.5.
| $(error "Found python$(PYTHON_COMPATIBLE_VERSION) in current environment, but it should be setting as \ | ||
| default interpreter, try to set $(PYTHON_COMPATIBLE_PATH) in PATH environment variable.") | ||
| else | ||
| $(error "$(shell python -V):Unsupported python version, only available for Python$(PYTHON_COMPATIBLE_VERSION).") |
There was a problem hiding this comment.
Replace python with $(PYTHON).
Could you explain more about that? |
The $(PYTHON) assign priority is python --> python3 --> python(favored version), if both python3.5, python3.6 are available in $PATH and symbolic link |
| repeatedly with a few vendors. | ||
|
|
||
| ## Prerequisites | ||
| `iota-swarm-node`, compatible with Python3+ as well as depending on [Pyota](https://github.com/iotaledger/iota.lib.py) is theoretically available for both Python 3.5 and 3.6; yet, our testing result indicates that the environment for Python 3.6 is invalid in this case. Details as [Pyota issue#203](https://github.com/iotaledger/iota.lib.py/issues/203). |
There was a problem hiding this comment.
Rewrite the abobe wording to
"This package depends in PyOTA, which is known to work with Python 3.5. However, before PyOTA issue #203 is resolved, Python 3.6/3.7 will be excluded for running this package. The build system would detect and validate the environment in advance."
jserv
left a comment
There was a problem hiding this comment.
Reduce the indentation. We shall always make detection script slight and elegant.
| PY_FAVORED_VER = 3.5 | ||
| PYTHON := $(shell which "python") | ||
| ifndef PYTHON | ||
| PYTHON := $(shell which "python3") |
| endif | ||
|
|
||
| ifndef PYTHON | ||
| PYTHON := $(shell which "python$(PY_FAVORED_VER)") |
| endif | ||
|
|
||
| ifndef PYTHON | ||
| $(error "Python is not executable, try to check the PATH environment variable or \ |
| PY_CHECK_VERSION := $(shell $(PYTHON) -V) | ||
|
|
||
| ifeq "$(filter $(PY_FAVORED_VER).%, $(PY_CHECK_VERSION))" "" | ||
| PYTHON := $(shell which "python"$(PY_FAVORED_VER)) |
There was a problem hiding this comment.
Reduce the indentation for pretty code snip.
| PY_CHECK_MOD_IOTA := $(shell python -c "import iota" 2>/dev/null && \ | ||
| echo 1 || echo 0) | ||
| ifneq ("$(PY_CHECK_MOD_IOTA)","1") | ||
| PIP := $(shell pip -V) |
| ifndef PIP_CHECK_VERSION | ||
| PIP_FAVORED_VER = 3 | ||
| endif | ||
| $(error "PyOTA package doesn't pre-configured, install the latest version: pip$(PIP_FAVORED_VER) install pyota") |
|
Check dcurl for illustrating macro usage with GNU make: https://github.com/DLTcollab/dcurl/blob/dev/Makefile#L32 |
|
Once macros are appropriately facilitated, no more nested conditional syntax (such as |
|
|
||
| ## Prerequisites | ||
| `iota-swarm-node`, compatible with Python3+ as well as depending on [Pyota](https://github.com/iotaledger/iota.lib.py) is theoretically available for both Python 3.5 and 3.6; yet, our testing result indicates that the environment for Python 3.6 is invalid in this case. Details as [Pyota issue#203](https://github.com/iotaledger/iota.lib.py/issues/203). | ||
| This package depends in PyOTA, which is known to work with Python 3.5. However, before PyOTA issue [#203](https://github.com/iotaledger/iota.lib.py/issues/203) is resolved, Python 3.6/3.7 will be excluded for running this package. The build system would detect and validate the environment in advance. |
| endif | ||
| PYTHON := $(shell which "python"$(PY_FAVORED_VER)) | ||
| ifdef PYTHON | ||
| $(error "Found python$(PY_FAVORED_VER), but it should be set as \ |
There was a problem hiding this comment.
Do you think it is valid according to the error message?
| PIP_CHECK_VERSION := $(findstring python 3, $(PIP) && echo $@ || echo 0) | ||
| endif | ||
|
|
||
| ifneq ("$(PIP)", "1") |
There was a problem hiding this comment.
Use ifdef rather than ifneq or ifeq for consistency.
| endif | ||
|
|
||
| ifneq ("$(PIP)", "1") | ||
| $(error "PIP package doesn't pre-configured, try to install it.") |
| ifndef PIP_CHECK_VERSION | ||
| PIP_FAVORED_VER = 3 | ||
| ifeq ("$(PY_CHECK_MOD_IOTA)", "0") | ||
| $(error "PyOTA package doesn't pre-configured, install the latest version: pip$(PIP_FAVORED_VER) install pyota") |
There was a problem hiding this comment.
Using pip is not the only way to install Python packages. Sometimes, package maintainer might prepare prebuilt one or recipes that describe how to install Python packages. You can leave the message: "please ask your administrator to install the package 'pyota' or build from source: https://github.com/iotaledger/iota.lib.py"
| ifndef PYTHON | ||
| $(error "Python is not executable, try to check the PATH environment variable or \ | ||
| install python$(PY_FAVORED_VER) package.") | ||
| $(error "Python is not executable, try to check the PATH environment variable or \ |
There was a problem hiding this comment.
It is ambiguous to say "Python is not executable". Use precise words.
| ifndef PYTHON | ||
| PYTHON := $(shell which "python3") | ||
| endif | ||
|
|
| ifndef PYTHON | ||
| $(error "Python is not executable, try to check the PATH environment variable or \ | ||
| install python$(PY_FAVORED_VER) package.") | ||
| endif # $(shell which "python") |
There was a problem hiding this comment.
Remove non-effective "$(shell which "python")".
There was a problem hiding this comment.
Let's say, "no valid Python interpreter is found".
| $(error "Found python$(PY_FAVORED_VER), but it should be set as \ | ||
| default interpreter, try to set $(PYTHON) in PATH environment variable.") | ||
| else | ||
| $(error "$(shell python -V):Unsupported python version, only available for Python$(PY_FAVORED_VER).") |
There was a problem hiding this comment.
Explain the exact reason and point unresolved issue(s) here.
There was a problem hiding this comment.
Validate ifdef-else statement. Logic error.
| else | ||
| $(error "$(shell python -V):Unsupported python version, only available for Python$(PY_FAVORED_VER).") | ||
| endif # PYTHON | ||
| endif # "$(filter ... |
There was a problem hiding this comment.
Ditto. You don't have to mention "$(filter ..." once you remove nested conditions.
|
@yillkid, you should create a new branch as workspace for commit "Store transaction before broadcast |
| repeatedly with a few vendors. | ||
|
|
||
| ## Prerequisites | ||
| This package depends on PyOTA, which is known to work with Python 3.5. However, before PyOTA issue [#203](https://github.com/iotaledger/iota.lib.py/issues/203) is resolved, Python 3.6/3.7 will be excluded for running this package. The build system would detect and validate the environment in advance. |
There was a problem hiding this comment.
PyOTA doesn't support Python 3.7 because it has package Filters which doesn't either.
Switch test suites invocation to Python3.