general: get rid of example_config & use demo/stub my.config instead

This commit is contained in:
Dima Gerasimov 2020-10-31 05:11:03 +00:00 committed by karlicoss
parent 96be32aa51
commit 1849a66f08
10 changed files with 27 additions and 34 deletions

59
my/config.py Normal file
View file

@ -0,0 +1,59 @@
'''
See https://github.com/karlicoss/HPI/blob/master/doc/SETUP.org#setting-up-modules for info on creating your own config
This file is used for:
- documentation (as an example of the config structure)
- mypy: this file provides some type annotations
- for loading the actual user config
'''
#### vvvv you won't need this VVV in your personal config
from my.core import init
###
from my.core import Paths, PathIsh
class hypothesis:
# expects outputs from https://github.com/karlicoss/hypexport
# (it's just the standard Hypothes.is export format)
export_path: Paths = '/path/to/hypothesis/data'
class instapaper:
export_path: Paths = ''
class pocket:
export_path: Paths = ''
class github:
export_path: Paths = ''
class reddit:
export_path: Paths = ''
class endomondo:
export_path: Paths = ''
class exercise:
workout_log: PathIsh = '/some/path.org'
class bluemaestro:
export_path: Paths = ''
class google:
takeout_path: Paths = ''
from typing import Sequence, Union, Tuple
from datetime import datetime, date
DateIsh = Union[datetime, date, str]
LatLon = Tuple[float, float]
class location:
# todo ugh, need to think about it... mypy wants the type here to be general, otherwise it can't deduce
# and we can't import the types from the module itself, otherwise would be circular. common module?
home: Union[LatLon, Sequence[Tuple[DateIsh, LatLon]]] = (1.0, -1.0)
class time:
class tz:
pass

View file

@ -1,7 +0,0 @@
# TODO ok, this thing should trigger .cfg import presumably??
from ..core import init
# TODO maybe, reuse example_config here?
class stub:
key = 'value'

View file

@ -21,12 +21,9 @@ def modules() -> Iterable[HPIModule]:
def ignored(m: str) -> bool:
excluded = [
# legacy stuff left for backwards compatibility
'core.*',
'config.*',
## todo move these to core
'kython.*',
'mycfg_stub',
##
]
exs = '|'.join(excluded)
return re.match(f'^my.({exs})$', m) is not None