You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2022/01/21 18:21:07 UTC
[superset] branch use_pkg_resources created (now 1c288c1)
This is an automated email from the ASF dual-hosted git repository.
beto pushed a change to branch use_pkg_resources
in repository https://gitbox.apache.org/repos/asf/superset.git.
at 1c288c1 feat: use pkg_resources for cleaner config
This branch includes the following new commits:
new 1c288c1 feat: use pkg_resources for cleaner config
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[superset] 01/01: feat: use pkg_resources for cleaner config
Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch use_pkg_resources
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 1c288c1ac42db846656f5489be44aac366268af2
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Fri Jan 21 10:18:08 2022 -0800
feat: use pkg_resources for cleaner config
---
superset/config.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/superset/config.py b/superset/config.py
index b9a98c4..1e74173 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -32,6 +32,7 @@ from collections import OrderedDict
from datetime import date, timedelta
from typing import Any, Callable, Dict, List, Optional, Type, TYPE_CHECKING, Union
+import pkg_resources
from cachelib.base import BaseCache
from celery.schedules import crontab
from dateutil import tz
@@ -64,17 +65,21 @@ EVENT_LOGGER = DBEventLogger()
SUPERSET_LOG_VIEW = True
-BASE_DIR = os.path.abspath(os.path.dirname(__file__))
+BASE_DIR = pkg_resources.resource_filename("superset", "")
if "SUPERSET_HOME" in os.environ:
DATA_DIR = os.environ["SUPERSET_HOME"]
else:
- DATA_DIR = os.path.join(os.path.expanduser("~"), ".superset")
+ DATA_DIR = os.path.expanduser("~/.superset")
# ---------------------------------------------------------
# Superset specific config
# ---------------------------------------------------------
-VERSION_INFO_FILE = os.path.join(BASE_DIR, "static", "version_info.json")
-PACKAGE_JSON_FILE = os.path.join(BASE_DIR, "static", "assets", "package.json")
+VERSION_INFO_FILE = pkg_resources.resource_filename(
+ "superset", "static/version_info.json"
+)
+PACKAGE_JSON_FILE = pkg_resources.resource_filename(
+ "superset", "static/assets/package.json"
+)
# Multiple favicons can be specified here. The "href" property
# is mandatory, but "sizes," "type," and "rel" are optional.