wikilinks / neleval

Entity disambiguation evaluation and error analysis tool
Apache License 2.0
116 stars 23 forks source link

Make it so that the nel script can be run from anywhere. #14

Open johann-petrak opened 9 years ago

johann-petrak commented 9 years ago

Small addition to the nel script that will find the actual location of the script directory and add that location to the PYTHONPATH before running python. That way, the nel script (or a symbolic link) can put in the PATH or the script can be run by specifying the full path like so /where/the/script/is/installed/nel .

benhachey commented 9 years ago

[cc @wejradford, @jnothman]

Hi @johann-petrak.

Thanks for this. It's also possible to install using pip, e.g.:

virtualenv ve
. ve/bin/activate
pip install git+git://github.com/wikilinks/neleval.git#egg=NEL

After which you can use the neleval command anywhere, e.g.:

neleval -h

Does it make sense to have both options?

jnothman commented 9 years ago

I agree with @benhachey. We should rather document the pip install app, if it's not already.

johann-petrak commented 9 years ago

I do not think the addition to the shell script interferes with anything else or does any harm but it makes it possible to just clone the repository and use the scripts right away. The install procedure you pointed out may need additional packages to get installed or require root priviledges (so people may need to beg their system administrators to install something first) or is otherwise not immediately obvious to users who are not familiar with python, so I thought just have the capability to have the main script work out of the box from anywhere would be a good thing. I routinely include that little codeblock in practically all my bash scripts because it is quite useful in general to be able to run a bash script from anywhere.

jnothman commented 9 years ago

Well, I'm not entirely convinced (there are dependencies to install anyway; root is not required if we recommend python setup.py install --user or a virtualenv).

As for the codeblock you use in all your scripts, why do you not use readlink?

jnothman commented 9 years ago

Perhaps, given that we have the launcher script already, we might consider this addition...

johann-petrak commented 9 years ago

I do not feels strongly about this getting added, I am just sharing it in case you may find it useful and I pointed out why I think it could be useful :) As to readlink, TBH I cannot remember exactly but I think it is not available on all platforms (I think it is POSIX only) and there may have been other issues. Even if my method fails, the worst thing that could happen, I think, is that it puts a directory which is not the correct directory into the PYTHONPATH, which will add to what gets put on sys.path anyway, so I cannot see a situation how this could fail in a situation where the original script works.