diff --git a/datasette_vega/__init__.py b/datasette_vega/__init__.py index 585e26c..ac80b52 100644 --- a/datasette_vega/__init__.py +++ b/datasette_vega/__init__.py @@ -3,17 +3,14 @@ import glob import os cache = {} -static_dir = os.path.join( - os.path.dirname(__file__), 'static' -) +static_dir = os.path.join(os.path.dirname(__file__), "static") + def cached_filepaths_for_extension(extension): - pattern = os.path.join(static_dir, '*.{}'.format(extension)) + pattern = os.path.join(static_dir, "*.{}".format(extension)) if pattern not in cache: cache[pattern] = [ - "/-/static-plugins/datasette_vega/{}".format( - os.path.basename(g) - ) + "/-/static-plugins/datasette_vega/{}".format(os.path.basename(g)) for g in glob.glob(pattern) ] return cache[pattern] @@ -22,10 +19,10 @@ def cached_filepaths_for_extension(extension): @hookimpl def extra_css_urls(view_name): if view_name == "table": - return cached_filepaths_for_extension('css') + return cached_filepaths_for_extension("css") @hookimpl def extra_js_urls(view_name): if view_name == "table": - return cached_filepaths_for_extension('js') + return cached_filepaths_for_extension("js") diff --git a/setup.py b/setup.py index 149a92e..a2753f6 100644 --- a/setup.py +++ b/setup.py @@ -4,20 +4,21 @@ from subprocess import check_output from wheel.bdist_wheel import bdist_wheel import os -VERSION = '0.6.2' +VERSION = "0.6.2" ROOT = os.path.dirname(os.path.abspath(__file__)) def get_long_description(): - with open(os.path.join( - os.path.dirname(os.path.abspath(__file__)), 'README.md' - ), encoding='utf8') as fp: + with open( + os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"), + encoding="utf8", + ) as fp: return fp.read() class BdistWheelWithBuildStatic(bdist_wheel): def run(self): - self.run_command('build_static') + self.run_command("build_static") return bdist_wheel.run(self) @@ -31,39 +32,41 @@ class BuildStatic(Command): pass def run(self): - check_output(['npm', 'install'], cwd=ROOT) - check_output(['npm', 'run', 'build'], cwd=ROOT) - check_output(['mkdir', '-p', 'datasette_vega/static'], cwd=ROOT) - check_output("mv build/static/js/* datasette_vega/static/", shell=True, cwd=ROOT) - check_output("mv build/static/css/* datasette_vega/static/", shell=True, cwd=ROOT) + check_output(["npm", "install"], cwd=ROOT) + check_output(["npm", "run", "build"], cwd=ROOT) + check_output(["mkdir", "-p", "datasette_vega/static"], cwd=ROOT) + check_output( + "mv build/static/js/* datasette_vega/static/", shell=True, cwd=ROOT + ) + check_output( + "mv build/static/css/* datasette_vega/static/", shell=True, cwd=ROOT + ) setup( - name='datasette-vega', - description='A Datasette plugin that provides tools for generating charts using Vega', + name="datasette-vega", + description="A Datasette plugin that provides tools for generating charts using Vega", long_description=get_long_description(), - long_description_content_type='text/markdown', - author='Simon Willison', - url='https://github.com/simonw/datasette-vega', - license='Apache License, Version 2.0', + long_description_content_type="text/markdown", + author="Simon Willison", + url="https://github.com/simonw/datasette-vega", + license="Apache License, Version 2.0", version=VERSION, - packages=['datasette_vega'], + packages=["datasette_vega"], entry_points={ - 'datasette': [ - 'vega = datasette_vega' - ], + "datasette": ["vega = datasette_vega"], }, package_data={ - 'datasette_vega': [ - 'static/*.js', - 'static/*.css', - 'static/*.map', + "datasette_vega": [ + "static/*.js", + "static/*.css", + "static/*.map", ], }, cmdclass={ - 'bdist_wheel': BdistWheelWithBuildStatic, - 'build_static': BuildStatic, + "bdist_wheel": BdistWheelWithBuildStatic, + "build_static": BuildStatic, }, - install_requires=['datasette'], - extras_require={"test": ["pytest", "pytest-asyncio", "httpx"]} + install_requires=["datasette"], + extras_require={"test": ["pytest", "pytest-asyncio", "httpx"]}, )