From 154b876a7c1390e27eac09b9ded738c3812d98d2 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Sat, 25 Nov 2023 20:28:28 +0000 Subject: [PATCH] Locate the config using jupyter_core.paths.jupyter_config_dir() --- src/jupytext_config/jupytext_config.py | 12 ++++++++++-- src/jupytext_config/labconfig.py | 4 ---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/jupytext_config/jupytext_config.py b/src/jupytext_config/jupytext_config.py index 451524c1..871395e3 100644 --- a/src/jupytext_config/jupytext_config.py +++ b/src/jupytext_config/jupytext_config.py @@ -6,8 +6,11 @@ import sys from argparse import ArgumentParser +from pathlib import Path -from .labconfig import DEFAULT_SETTINGS_FILE, LabConfig +import jupyter_core.paths as jupyter_core_paths + +from .labconfig import LabConfig class SubCommand: @@ -86,7 +89,12 @@ def fill_parser(self, subparser): def main(): parser = ArgumentParser() - parser.add_argument("--settings-file", default=DEFAULT_SETTINGS_FILE) + parser.add_argument( + "--settings-file", + default=Path(jupyter_core_paths.jupyter_config_dir()) + / "labconfig" + / "default_setting_overrides.json", + ) subparsers = parser.add_subparsers(required=True) for subcommand in SUBCOMMANDS: subparser = subparsers.add_parser(subcommand.name, help=subcommand.help) diff --git a/src/jupytext_config/labconfig.py b/src/jupytext_config/labconfig.py index 69356422..05c3ac2d 100644 --- a/src/jupytext_config/labconfig.py +++ b/src/jupytext_config/labconfig.py @@ -9,10 +9,6 @@ import logging from pathlib import Path -DEFAULT_SETTINGS_FILE = ( - Path.home() / ".jupyter" / "labconfig" / "default_setting_overrides.json" -) - class LabConfig: DOCTYPES = [