operatorequals/httpimport

Httpimport as a class

lavvy opened this issue · 4 comments

lavvy commented

I have tried to rewrite this module as a class but with no luck. But somehow i believe it would be possible.
If the module can be converted to a class it would more awesome.
E. G.
a = httpimport()
b = a.import(foo)
c = b(new_func)

Hey, good catch!
The module contains a class, that works as the Finder/Loader. Finders/Loaders are called Importers. So, it's the HttpImporter class.

Is there a reason you believe this will be useful, other than an aesthetic/syntax addition. Is there a use-case that demands such syntax?

lavvy commented

Yes. python is one of the best tools for analysis and this module has actually made it limitless.
If we can load a remoteA class as an objectA and load from remoteB as objectB . it will ease analytical use cases. For instance:
a = httpimport(remoteA.com).import(foo).compute()
b = httpimport(remoteB.com).import(bar).get()
print(a(b))

rypc module uses this system like most remote working modules, in that case you can keep conn1, conn2, connN etc
But rypc does not satisfy the use case for httpimport.

lavvy commented

any hope for this feature ?

The feature from PR (#7) has been cooked and implemented in master:

Docs:
https://github.com/operatorequals/httpimport/blob/master/README.md#the-load-function-as-of-0510

Available in last release 0.5.10 through PyPI as well.

Thanks a lot!