From 4d33416696bf43327a0e8ac5623c355bf66ff3f2 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sat, 11 Apr 2020 21:14:32 +0100 Subject: [PATCH] add development doc --- doc/DEVELOPMENT.org | 8 ++++++++ my/init.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 doc/DEVELOPMENT.org diff --git a/doc/DEVELOPMENT.org b/doc/DEVELOPMENT.org new file mode 100644 index 0000000..c57e5e8 --- /dev/null +++ b/doc/DEVELOPMENT.org @@ -0,0 +1,8 @@ +* IDE setup: make sure my.config is in your package search path +In runtime, ~my.config~ is imported from the user config directory dynamically. + +However, Pycharm/Emacs/whatever you use won't be able to figure that out, so you'd need to adjust your IDE configuration. + +- Pycharm: basically, follow the instruction [[https://stackoverflow.com/a/55278260/706389][here]] + + i.e. create a new interpreter configuration (e.g. name it "Python 3.7 (for HPI)"), and add =~/.config/my=. diff --git a/my/init.py b/my/init.py index d3638de..99ad837 100644 --- a/my/init.py +++ b/my/init.py @@ -19,6 +19,8 @@ def setup_config(): cfg_dir = Path('~/.config').expanduser() mycfg_dir = cfg_dir / 'my' + # TODO maybe try importing first and if it's present, don't do anything? + if not mycfg_dir.exists(): warnings.warn(f"my.config package isn't found! (expected at {mycfg_dir}). This might result in issues.") from . import mycfg_stub as mycfg @@ -27,7 +29,6 @@ def setup_config(): mp = str(mycfg_dir) if mp not in sys.path: sys.path.insert(0, mp) - print("UPDATED PATH") # TODO FIXME remove try: import my.config