#!/usr/bin/env python3 """ This file is used for specifying pathes for 'my' package and potentially private configuration. E.g. so you can run something like: with_my python3 -c 'import my.books.kobo as kobo; print(kobo.get_todos())' Feel free to use your preferred way of managing these packages otherwise. """ ###### set this v # can be empty if you're not planning to use modules that use private configuration # otherwise see readme to learn how to set it MYCFG_DIR = '' ###### # you shouldn't have the need to modify rest; but let me know if you miss anything! from pathlib import Path # directory where 'my' package is present MY_DIR = str(Path(__file__).absolute().parent) if __name__ == '__main__': import os import sys def upd(envvar, path): if len(path) == 0: return val = os.environ.get(envvar, '') if val == '': val = path else: val = val + ':' + path os.environ[envvar] = val # TODO wonder why py.typed file in mycfg didn't help? for v in ['MYPYPATH', 'PYTHONPATH']: upd(v, MY_DIR) upd(v, MYCFG_DIR) rest = sys.argv[1:] os.execvp(rest[0], rest)