boakley / robotframework-hub

Web app for accessing robot framework assets
https://github.com/boakley/robotframework-hub/wiki
Apache License 2.0
170 stars 60 forks source link

How to add libraries from Python path to rfhub #36

Closed aaltat closed 10 years ago

aaltat commented 10 years ago

it is not configurable from command line, how I select libraries from PYTHON_HOME/Lib/site-packages folder.

Example I did install: robotframework-archivelibrary and it is located in: PYTHON_HOME/Lib/site-packages/ArchiveLibrary folder. Then I did start rfhub with commands: python -m rfhub C:\Python27\Lib\site-packages\ArchiveLibraryinit.py python -m rfhub C:\Python27\Lib\site-packages\ArchiveLibrary\ python -m rfhub C:\Python27\Lib\site-packages\ArchiveLibrary

But none of those command add the ArchiveLibrary to the documentation.

It would be nice if there would be command line flag or even a configuration file which libraries are read from PYTHON_HOME/Lib/site-packages folder. As a workaround I did change kwdb.py, line 209 from:

    def add_installed_libraries(self, extra_libs = ["Selenium2Library",
                                                    "SudsLibrary",
                                                    "RequestsLibrary"]):

to:

    def add_installed_libraries(self, extra_libs = ["Selenium2Library",
                                                    "SudsLibrary",
                                                    "RequestsLibrary",
                                                    "ArchiveLibrary"]):
yanne commented 10 years ago

@boakley, how do feel about adding a command line argument to handle this?. It is impossible to do any kind of automatic discovery and loading of libraries without first parsing all test case and resource files for library imports.

In the longer run, I think the hub should support a configuration file also.

boakley commented 10 years ago

I've been thinking about a --library option to add a library (which you could use multiple times), and perhaps supporting argument files like robot does.

For example, you could do "python -m rfhub --library Selenium2Library --library RequestsLibrary

Using an argument file you might do something like this:

python -m rfhub --argumentfile rfhub-libraries.args

rfhub-libraries.args would then have something like:

# foo.args
--library Selenium2Library
--library RequestsLibrary

What do you think?

On Tue, Sep 2, 2014 at 10:41 AM, Janne Härkönen notifications@github.com wrote:

@boakley https://github.com/boakley, how do feel about adding a command line argument to handle this?. It is impossible to do any kind of automatic discovery and loading of libraries without first parsing all test case and resource files for library imports.

In the longer run, I think the hub should support a configuration file also.

— Reply to this email directly or view it on GitHub https://github.com/boakley/robotframework-hub/issues/36#issuecomment-54171428 .

aaltat commented 10 years ago

From my point of view both options are good. If I would have to choose, I would take command line options.

boakley commented 10 years ago

changeset c2b9262 fixes this