configuration filesยค
i'm going to include my configuration files in this package. it seems like a great place to keep them for consistency. we can import them.
from tonyfast import ipython_config, jupyter_lab_config
the configurations on the c
symbol staying consistent with traitlets configurations.
ipython_config.c
then we can apply the configuration files to the property directories.
IPython
and jupyter_core
ship their path locations
import IPython.paths, jupyter_core.paths
from pathlib import Path
JUPYTER = Path(jupyter_core.paths.jupyter_config_dir())
IPYTHON = Path(IPython.paths.get_ipython_dir())
set the configuration files for IPython
and jupyter
def set_configs(use_platform_dir: bool=True):
import shutil
if use_platform_dir:
shutil.copy(jupyter_lab_config.__file__, JUPYTER / Path(jupyter_lab_config.__file__).name)
shutil.copy(ipython_config.__file__, IPYTHON / Path(ipython_config.__file__).name)
else:
shutil.copy(jupyter_lab_config.__file__, Path(jupyter_lab_config.__file__).name)
shutil.copy(ipython_config.__file__, Path(ipython_config.__file__).name)
if __name__ == "__main__":
if "__file__" in locals():
__import__("typer").run(set_configs)
else:
!importnb 2022-12-31-jupyter-config-files.ipynb --help