add development doc
This commit is contained in:
parent
be7c4d2098
commit
4d33416696
2 changed files with 10 additions and 1 deletions
8
doc/DEVELOPMENT.org
Normal file
8
doc/DEVELOPMENT.org
Normal file
|
@ -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=.
|
|
@ -19,6 +19,8 @@ def setup_config():
|
||||||
cfg_dir = Path('~/.config').expanduser()
|
cfg_dir = Path('~/.config').expanduser()
|
||||||
mycfg_dir = cfg_dir / 'my'
|
mycfg_dir = cfg_dir / 'my'
|
||||||
|
|
||||||
|
# TODO maybe try importing first and if it's present, don't do anything?
|
||||||
|
|
||||||
if not mycfg_dir.exists():
|
if not mycfg_dir.exists():
|
||||||
warnings.warn(f"my.config package isn't found! (expected at {mycfg_dir}). This might result in issues.")
|
warnings.warn(f"my.config package isn't found! (expected at {mycfg_dir}). This might result in issues.")
|
||||||
from . import mycfg_stub as mycfg
|
from . import mycfg_stub as mycfg
|
||||||
|
@ -27,7 +29,6 @@ def setup_config():
|
||||||
mp = str(mycfg_dir)
|
mp = str(mycfg_dir)
|
||||||
if mp not in sys.path:
|
if mp not in sys.path:
|
||||||
sys.path.insert(0, mp)
|
sys.path.insert(0, mp)
|
||||||
print("UPDATED PATH") # TODO FIXME remove
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import my.config
|
import my.config
|
||||||
|
|
Loading…
Add table
Reference in a new issue