You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if smart_open could be extended using setuptools / entry_points capabilities.
For now, if user install a package that provide new smart_open transport mechanism, it cannot be automatically registered.
Example use case
Please note: schema is not relevant here.
In package smart_ext_transport I have following file:
Once package is installed, smart_open can automatically load every plugin that is registered using setuptools entry points.
User will no longer have to import package to register extension manually.
This is how pytest / setuptools CLI / flake8 / jupyter nb convert works for example.
Problem description
It would be great if
smart_open
could be extended using setuptools / entry_points capabilities.For now, if user install a package that provide new
smart_open
transport mechanism, it cannot be automatically registered.Example use case
Please note: schema is not relevant here.
In package
smart_ext_transport
I have following file:Current situation
The only way to load extension for now are listed bellow:
Option 1: using
register_transport
everywhere and every time it might be required 😢Option 2: using
__init__.py
andimport
statement:Adding:
Then every time
custom
schema might be needed:Improved situation with setuptools
In
setup.py
fromsmart_ext_transport
we may add:Once package is installed,
smart_open
can automatically load every plugin that is registered using setuptools entry points.User will no longer have to import package to register extension manually.
This is how pytest / setuptools CLI / flake8 / jupyter nb convert works for example.
Possible implementation
Feature can be easily implemented.
It would require adding following lines between: https://github.com/RaRe-Technologies/smart_open/blob/84e9aac271653e029d68b090b02c545e7b43efcb/smart_open/transport.py#L103-L105
I can provide PR for this if needed 😁.
Versions
The text was updated successfully, but these errors were encountered: