-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faraday-Proxy PyPi Support #203
Conversation
Initial add of setup.py for setuptools use when installing with pip.
Added Faraday specific data into the setup.py file.
Removed test folder indicated in setup.py as well as changed the README to REAMDE.md in the same file.
Still having 'pip install faraday' issues but it uploades to pypi!
Specified requirements in setup.py
Will move over to pbr and this requires a simplified setup.py.
Faraday-proxy appears to work. Now I need to fix the formatters ini filer error per @hdmike.
Used @hdkmike suggested import code and the issue was fixed. Now I need to do the same for proxy.ini.
Successfully made it past the proxy.ini import. Now we need to get the sqlite schema file imported as it fails when running faraday-proxy.
After installing with pip in editable mode I can use the command faraday-proxy to start up the proxy application correctly! I simply brute forced the relative file paths for the database and database schema files.
Imported faraday/telemetry.py directly as well as fixed up paths to configuration files and databases.
Modified paths to configuration files in faraday/aprs.py as well as added correct lines to setup.cfg to properly create console entry points for faraday-aprs.
Very simple update of logging file locations as well as setup.cfg to point to the correct entry points.
Fixed data_file formatting and also forced a difference base version so I can upload to pypi without committing.
Updated proxy.py to use configuration files from etc/ folder.
To ensure all files are in a common faraday folder.
updated file paths to enable use of /etc/faraday/
After talking to @hdkmike and @reillyeon we figured out a path forward for python packaging and config file locations. This is a sort of brute force attempt to get this working so not pretty but I don't want to optimise until I know we actually understand this.
Had to change some files around but this version works! Added a new path element as well. Still very brute forced. The user MUST copy proxy.sample.ini over to proxy.ini and edit it all manually right now. Also, the log file is created in /etc and it shouldn't but one step at a time.
Decided to save the log files in ~/faraday/.faraday/lib which now works. Not sure if long term want to keep this current structure with lib in user area and etc in python sys.prefix. Again, brute force trying to understand the workings of it all. Progress!
Ran pytest and fixed the PEP8 errors/warnings.
@reillyeon any thoughts? |
Oh no, I think this is messing with all my other faraday branches I have checked out... I can run applications and such from other branches after install this PR... I need to uninstall to run any other heritage branches? EDIT: I needed to |
Yes, I experienced a similar problem. I think the package installed via pip
takes precedence over some other stuff in the code. After I uninstalled the
package it fixed it
…On Jun 4, 2017 4:37 PM, "Brenton Salmi" ***@***.***> wrote:
Oh no, I think this is messing with all my other faraday branches I have
checked out... I can run applications and such from other branches after
install this PR... I need to uninstall to run any other heritage branches?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#203 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AXZdHos9X68SRYj1Ih3vWoDn1m_0sbR3ks5sAyOngaJpZM4NvMMk>
.
|
Yes please do not use pip install Faraday at this time. In learning PyPi I uploaded a non working package to the main PyPi site instead of test PyPi. That version us very old and won't work. You must install editable or from PyPi test server. However the PyPi test server will often fail on a fresh install since not all required packages have test PyPi uploads with the latest versions so you need to install thise from normal PyPi instead of test. https://stackoverflow.com/a/34561435 This is the latest test PyPi which should be the same version in my git PR Use the stack overflow method above to install from the test PyPi if you want. However I still suggest editable mode! |
@kb1lqd @el-iso woops! --init-config is what you want to create the initial config file, sorry about the confusion! After that runs you'll have a config file with REPLACEME placeholders. Then run in one or more command line entries Faraday-Proxy --callsign CALLSIGN --nodeid NODEID --port PORT Make sure you remember port is com port so COM5 or similar on Windows and dev/ttyusb or similar on Linux and mac |
I made sure to restart the command window just incase.
It looks like it is not expecting arguments but getting them? Also, I definitely could NOT run my RFDataport branch with this installed so I had to remove it again. |
Hmm make sure you have the python module shutil though I think it comes with python anyways. That said weird, it's complaining that I passed the initial argument which should be true or false... |
Yup @kb1lqd looks like line 86 of proxy.py clearly shows no arguments yet like 215 passes them. Not sure how this happened. Try modifying line 215 to remove the argument passed. Installed in editable mode literally means you can edit the file and try again, no need to re install |
@kb1lqc @reillyeon I verified that Bryce's suggestion to remove line 215 argument in proxy.py worked and I can now run proxy as described: |
Running the current commit b6798b4 results in the following error if not launched from the main folder. This test was performed by moving up one directory.
It appears that the code for finding |
Not bothering making faraday-telemetry and other apps since we are only focusing on getting faraday-proxy to run correctly right now.
Keeping it simple for the README by linking to the quickstart tutorial which will be updated with correct installation instructions.
Performing a logging debug message of the proxy.ini path instead of a print.
path = location | ||
break | ||
except ConfigParser.NoSectionError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I don't fail gracefully this code allows editable mode (or other installations) to fail if the file is never found. The code simply moves on with a blank path. Woops. This is related
to IT #206
faraday/proxy.py
Outdated
|
||
#Create Proxy configuration file path | ||
proxyConfigPath = os.path.join(path, "proxy.ini") | ||
logger.debug('Proxy.ini PATH: ', proxyConfigPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops, this is wrong. I need to use a +
instead of comma to join the two items inside the logging.debug() code. Also, this is redundant and I should delete line 47
parser.add_argument('--unit', type=int, default=0, help='Specify Faraday unit to configure') | ||
|
||
#Proxy options | ||
parser.add_argument('--number', type=int, default=0, help='Set number of Faraday radios to use') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be dangerous and/or not work. Keep an eye on this one. Might need to default to 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually OK. Defaulting to 0 basically keeps the 1 in the proxy.ini
file until you specify something other than 0 or 1 (since 0 is ignored... you'd never have 0 units to startup. Maybe in testmode but that's getting in the weeds for now). Programming a number.
This does allow negative numbers and any number that is positive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK this is addressed in Issue #207
logger.info("Log initialization complete") | ||
|
||
|
||
def saveProxyLog(name, config): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May not work without pip install creating ~user/.faraday/lib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not applicable, folder created if not already existing whenever proxy is run:
sys.exit(0) | ||
|
||
|
||
def showProxyLogs(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May not work without pip install creating ~user/.faraday/lib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not applicable, folder created if not already existing whenever proxy is run:
requirements.txt
Outdated
@@ -1,4 +1,5 @@ | |||
appdirs==1.4.3 | |||
argparse==1.4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't need this since python >2.6 has argparse in the stdlib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also should possibly add setuptools?
Corrected erroneous comma instead of a plus sign for combining strings in a logging.debug() command. Also removed an extra an unneeded logging.debug() command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sat down with Bryce and we went through all of the code updates. I verified that I could install, configure, and start proxy from the command line. I also verified that telemetry and and APRS also worked (also commanding local and remote) using traditional methods of manually running the github scripts.
It's part of stdlib in Python >2.6 so it's already there.
Needed to change it so that uploading to PyPi works. However it should be oding this by commit anywyas so might not be needed but hell... Let's start on 0.0.1010 with this PR. For funzies.
Uploaded to PyPi servers! @el-iso @reillyeon @kb1lqd TestPyPi: https://testpypi.python.org/pypi/faraday/0.0.1010.dev996 |
Related to Issue #191
This PR is intended to get the Proxy application into the pip index. It also allows for "editable" mode installation with command line operation of proxy.
This PR will definitely need some love before merging but it's a good starting point for discussion
Operation
Navigate to the main folder and
pip install -e .
to install in editable mode. One can also follow the python packaging guides to create an uploadable distribution for the PyPi servers.Once installed simply run "Faraday-Proxy" to run the proxy program from command line.
You will need to configure the proxy application by first seeing the options by running
faraday-proxy -h
First you will need to create a new configure file by running
faraday-proxy --configure
then run a second Faraday-Proxy command with the appropriate options to set the callsign, node Id, and port (usually comx on windiws).This is the best I got for remembering from memory try to figure it out the best you can with the help options and then asking me the rest. I don't have access to the software as I'm traveling internationally at this time without a laptop!