--- /dev/null
+import datasette
+from datasette.cli import cli
+
+
+# Monkey patching for original Datasette
+def init(self, *args, **kwargs):
+ print("Test")
+ self.original_init(*args, **kwargs)
+
+datasette.app.Datasette.original_init = datasette.app.Datasette.__init__
+datasette.app.Datasette.__init__ = init
+
+
+# Read external database connectors
+from . import connectors
+connectors.load_connectors()
--- /dev/null
+import pkg_resources
+
+db_connectors = {}
+
+def load_connectors():
+ for entry_point in pkg_resources.iter_entry_points('datasette.connectors'):
+ db_connectors[entry_point.name] = entry_point.load()
+
+def inspect(path):
+ for connector in db_connectors.values():
+ try:
+ return connector.inspect(path)
+ except:
+ pass
+ else:
+ raise Exception("No database connector found for %s" % path)
+
+def connect(path, dbtype):
+ try:
+ return db_connectors[dbtype].Connection(path)
+ except:
+ raise Exception("No database connector found for %s" % path)
--- /dev/null
+from setuptools import setup
+import os
+
+def get_version():
+ with open('VERSION') as fd:
+ return fd.read().strip()
+
+def get_long_description():
+ with open(os.path.join(
+ os.path.dirname(os.path.abspath(__file__)), 'README.md'
+ ), encoding='utf8') as fp:
+ return fp.read()
+
+
+setup(
+ name='datasette-connectors',
+ version=get_version(),
+ description='Datasette support to other database types',
+ long_description=get_long_description(),
+ long_description_content_type='text/markdown',
+ author='Javier Sancho',
+ url='https://github.com/pytables/datasette-connectors',
+ license='Apache License, Version 2.0',
+ packages=['datasette_connectors'],
+ install_requires=['datasette==0.25'],
+ entry_points='''
+ [console_scripts]
+ datasette=datasette_connectors:cli
+ '''
+)