Look at the bottom before reading anything else.
py -3.7 -m pip install -e git+file:C:\Users\CanrigAdmin\Documents\git\pylogix@udt-addon-01#egg=pylogix-0.4.0-py3.7.egg-info
To expand a bit on this, it is just a pip intall with the -e flag which indicates development. That means you can make code changes to the
package and test without having to pip uninstall/install.
The next piece is the `git+file:path@branch#eggInfo
- path: indicates the package root directory
- branch: can be a branch/tag/commit
- eggInfo: I wasn't sure about this but I tried to uninstall pylogix and after site-packages you can see the current egg-info.
The default structure looks like packageName-version-pythonVersion.egg-info
Run pip list, and you should see a local path next to the version.
Open up idle in whatever python version you installed it, and then:
import pylogix
dir(pylogix)
If you get LGXDevice, PLC, built-in functions, and eip, and lgxDevice then you have installed it properly. I like to ensure things are in good working order before making big changes. I will add a silly funtion to make sure pylogix is in development mode.
Somewhere in the PLC Class, I will do it after exit, feel free to change the return string to your like:
def __exit__(self, exc_type, exc_val, exc_tb):
'''
Clean up on exit
'''
return self._closeConnection()
def HelloWorld(self):
return "Hello World FAB"
...
I ended up working straight on the local git repo, and created a script inside pylogix to test any changes I was making. I couldn't get the pip install from the local git repo branch to work in development mode, maybe I'll comeback to this later but I wanted to work on some ideas right away.