File tree Expand file tree Collapse file tree 4 files changed +69
-0
lines changed Expand file tree Collapse file tree 4 files changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ 0.25
Original file line number Diff line number Diff line change
1
+ import datasette
2
+ from datasette .cli import cli
3
+
4
+
5
+ # Monkey patching for original Datasette
6
+ def init (self , * args , ** kwargs ):
7
+ print ("Test" )
8
+ self .original_init (* args , ** kwargs )
9
+
10
+ datasette .app .Datasette .original_init = datasette .app .Datasette .__init__
11
+ datasette .app .Datasette .__init__ = init
12
+
13
+
14
+ # Read external database connectors
15
+ from . import connectors
16
+ connectors .load_connectors ()
Original file line number Diff line number Diff line change
1
+ import pkg_resources
2
+
3
+ db_connectors = {}
4
+
5
+ def load_connectors ():
6
+ for entry_point in pkg_resources .iter_entry_points ('datasette.connectors' ):
7
+ db_connectors [entry_point .name ] = entry_point .load ()
8
+
9
+ def inspect (path ):
10
+ for connector in db_connectors .values ():
11
+ try :
12
+ return connector .inspect (path )
13
+ except :
14
+ pass
15
+ else :
16
+ raise Exception ("No database connector found for %s" % path )
17
+
18
+ def connect (path , dbtype ):
19
+ try :
20
+ return db_connectors [dbtype ].Connection (path )
21
+ except :
22
+ raise Exception ("No database connector found for %s" % path )
Original file line number Diff line number Diff line change
1
+ from setuptools import setup
2
+ import os
3
+
4
+ def get_version ():
5
+ with open ('VERSION' ) as fd :
6
+ return fd .read ().strip ()
7
+
8
+ def get_long_description ():
9
+ with open (os .path .join (
10
+ os .path .dirname (os .path .abspath (__file__ )), 'README.md'
11
+ ), encoding = 'utf8' ) as fp :
12
+ return fp .read ()
13
+
14
+
15
+ setup (
16
+ name = 'datasette-connectors' ,
17
+ version = get_version (),
18
+ description = 'Datasette support to other database types' ,
19
+ long_description = get_long_description (),
20
+ long_description_content_type = 'text/markdown' ,
21
+ author = 'Javier Sancho' ,
22
+ url = 'https://github.com/pytables/datasette-connectors' ,
23
+ license = 'Apache License, Version 2.0' ,
24
+ packages = ['datasette_connectors' ],
25
+ install_requires = ['datasette==0.25' ],
26
+ entry_points = '''
27
+ [console_scripts]
28
+ datasette=datasette_connectors:cli
29
+ '''
30
+ )
You can’t perform that action at this time.
0 commit comments