single yaml implementation

consolidate to a single yaml implementation,
removing pyyaml
This commit is contained in:
Min RK
2019-02-11 13:27:08 +01:00
parent d3af75a1d7
commit 13648050ae
3 changed files with 7 additions and 8 deletions

View File

@@ -11,7 +11,6 @@ setup(
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
install_requires=[ install_requires=[
'pyyaml==3.*',
'ruamel.yaml==0.15.*', 'ruamel.yaml==0.15.*',
'jinja2', 'jinja2',
'pluggy>0.7<1.0' 'pluggy>0.7<1.0'

View File

@@ -9,9 +9,9 @@ FIXME: A strong feeling that JSON Schema should be involved somehow.
""" """
import os import os
import yaml
from tljh.config import CONFIG_FILE from .config import CONFIG_FILE
from .yaml import yaml
# Default configuration for tljh # Default configuration for tljh
# User provided config is merged into this # User provided config is merged into this
@@ -59,7 +59,7 @@ def load_config(config_file=CONFIG_FILE):
""" """
if os.path.exists(config_file): if os.path.exists(config_file):
with open(config_file) as f: with open(config_file) as f:
config_overrides = yaml.safe_load(f) config_overrides = yaml.load(f)
else: else:
config_overrides = {} config_overrides = {}
return _merge_dictionaries(dict(default), config_overrides) return _merge_dictionaries(dict(default), config_overrides)

View File

@@ -1,15 +1,15 @@
""" """
JupyterHub config for the littlest jupyterhub. JupyterHub config for the littlest jupyterhub.
""" """
import copy
import os
import yaml
from glob import glob from glob import glob
import os
from systemdspawner import SystemdSpawner from systemdspawner import SystemdSpawner
from tljh import configurer, user from tljh import configurer, user
from tljh.config import INSTALL_PREFIX, USER_ENV_PREFIX, CONFIG_DIR from tljh.config import INSTALL_PREFIX, USER_ENV_PREFIX, CONFIG_DIR
from tljh.normalize import generate_system_username from tljh.normalize import generate_system_username
from tljh.yaml import yaml
class UserCreatingSpawner(SystemdSpawner): class UserCreatingSpawner(SystemdSpawner):
@@ -54,7 +54,7 @@ c.SystemdSpawner.unit_name_template = 'jupyter-{USERNAME}'
config_overrides_path = os.path.join(CONFIG_DIR, 'config.yaml') config_overrides_path = os.path.join(CONFIG_DIR, 'config.yaml')
if os.path.exists(config_overrides_path): if os.path.exists(config_overrides_path):
with open(config_overrides_path) as f: with open(config_overrides_path) as f:
config_overrides = yaml.safe_load(f) config_overrides = yaml.load(f)
else: else:
config_overrides = {} config_overrides = {}
configurer.apply_config(config_overrides, c) configurer.apply_config(config_overrides, c)