diff --git a/.gitignore b/.gitignore index 27e03b67ae1..ad106b34fa1 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ .DS_Store .eggs .idea +.mypy_cache .python-version .tox .vscode diff --git a/MANIFEST.in b/MANIFEST.in index 363faac03b3..10872f48f5f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -20,15 +20,15 @@ graft licenses/ include README.md recursive-include superset/examples * recursive-include superset/migrations * -recursive-include superset/static * -recursive-exclude superset/static/assets/docs * -recursive-exclude superset/static/assets/images/viz_thumbnails_large * -recursive-exclude superset/static/docs * -recursive-exclude superset/static/spec * -recursive-exclude superset/static/assets/src * -recursive-include superset/static/assets/src/visualizations/CountryMap/ * + +# Whitelist anything that needs to be added to the static bundle +recursive-exclude superset/static * +recursive-include superset/static/assets/branding * +recursive-include superset/static/assets/dist * +recursive-include superset/static/assets/images * recursive-exclude superset/static/images/viz_thumbnails_large * -recursive-exclude superset/static/assets/node_modules * +recursive-include superset/static/assets/stylesheets * + recursive-include superset/templates * recursive-include superset/translations * recursive-exclude tests * diff --git a/superset/config.py b/superset/config.py index c19e4c894f0..e0fb649f19c 100644 --- a/superset/config.py +++ b/superset/config.py @@ -49,9 +49,22 @@ else: # Superset specific config # --------------------------------------------------------- PACKAGE_DIR = os.path.join(BASE_DIR, "static", "assets") -PACKAGE_FILE = os.path.join(PACKAGE_DIR, "package.json") -with open(PACKAGE_FILE) as package_file: - VERSION_STRING = json.load(package_file)["version"] +VERSION_INFO_FILE = os.path.join(PACKAGE_DIR, "version_info.json") +PACKAGE_JSON_FILE = os.path.join(PACKAGE_DIR, "package.json") + +# +# Depending on the context in which this config is loaded, the version_info.json file +# may or may not be available, as it is generated on install via setup.py. In the event +# that we're actually running Superset, we will have already installed, therefore it WILL +# exist. When unit tests are running, however, it WILL NOT exist, so we fall +# back to reading package.json +# +try: + with open(VERSION_INFO_FILE) as version_file: + VERSION_STRING = json.load(version_file)["version"] +except Exception: + with open(PACKAGE_JSON_FILE) as version_file: + VERSION_STRING = json.load(version_file)["version"] ROW_LIMIT = 50000 VIZ_ROW_LIMIT = 10000