Use importlib_resources

This commit is contained in:
mvdbeek
2022-01-19 18:20:16 +00:00
committed by Nicola Soranzo
parent 19e9e55ca3
commit d3cfb72266
3 changed files with 13 additions and 4 deletions
+6 -2
View File
@@ -6,7 +6,6 @@ Universe configuration builder.
import collections
import configparser
import errno
import importlib.resources
import ipaddress
import logging
import logging.config
@@ -63,6 +62,11 @@ from galaxy.web.formatting import expand_pretty_datetime_format
from galaxy.web_stack import get_stack_facts
from ..version import VERSION_MAJOR, VERSION_MINOR
try:
from importlib.resources import files
except ImportError:
from importlib_resources import files
if TYPE_CHECKING:
from galaxy.jobs import JobConfiguration
from galaxy.tool_util.deps.containers import ContainerFinder
@@ -73,7 +77,7 @@ if TYPE_CHECKING:
log = logging.getLogger(__name__)
GALAXY_APP_NAME = 'galaxy'
GALAXY_CONFIG_SCHEMA_PATH = importlib.resources.files('galaxy.webapps.galaxy') / 'config_schema.yml'
GALAXY_CONFIG_SCHEMA_PATH = files('galaxy.webapps.galaxy') / 'config_schema.yml'
LOGGING_CONFIG_DEFAULT: Dict[str, Any] = {
'disable_existing_loggers': False,
'version': 1,
+6 -2
View File
@@ -1,7 +1,6 @@
"""
"""
import datetime
import importlib.resources
import inspect
import logging
import os
@@ -42,6 +41,11 @@ from galaxy.web.framework import (
)
from galaxy.web_stack import get_app_kwds
try:
from importlib.resources import files
except ImportError:
from importlib_resources import files
log = logging.getLogger(__name__)
@@ -91,7 +95,7 @@ class WebApplication(base.WebApplication):
def create_mako_template_lookup(self, galaxy_app, name):
paths = []
base_template_path = importlib.resources.files('galaxy.webapps.base') / 'templates'
base_template_path = files('galaxy.webapps.base') / 'templates'
app_template_path = base_template_path / 'webapps'
# First look in webapp specific directory
if name is not None:
+1
View File
@@ -2,6 +2,7 @@ galaxy-app
Cheetah3
fastapi>=0.68.2,!=0.69.0,!=0.70.0,!=0.70.1
fastapi-utils
importlib_resources
Mako
pydantic
python-multipart # required to support form parsing in FastAPI/Starlette