diff --git a/doc/SETUP.org b/doc/SETUP.org index 8ac9265..4a49dd8 100644 --- a/doc/SETUP.org +++ b/doc/SETUP.org @@ -59,6 +59,16 @@ This is less convenient, but gives you more control. The benefit of this way is that you get a bit more control, explicitly allowing your scripts to use your data. +** optional packages +You can also install some opional packages + +: pip3 install 'HPI[optional]' + +They aren't necessary, but improve your experience. At the moment these are: + +- [[https://github.com/karlicoss/cachew][cachew]]: automatic caching library, which can greatly speedup data access +- [[https://github.com/metachris/logzero][logzero]]: a nice logging library, supporting colors + * Setting up the modules This is an *optional step* as some modules might work without extra setup. But it depends on the specific module. diff --git a/lint b/lint index b126cfb..8061578 100755 --- a/lint +++ b/lint @@ -60,12 +60,20 @@ def pylint(): def mypy(thing: str): + my_config_stub = DIR / 'mycfg_template'; assert my_config_stub.is_dir(), my_config_stub + env = {**os.environ} + MP = 'MYPYPATH' + if CI: # patch up, because CI doesn't have config... meh, but does the trick for now + mypypath = env.get(MP, None) + mypypath = str(my_config_stub) + ('' if mypypath is None else ':' + str(mypypath)) + env[MP] = mypypath + is_package = Path(thing).suffix != '.py' return run([ 'mypy', '--color-output', # TODO eh? doesn't work.. *(['-p'] if is_package else []), thing, - ], stdout=PIPE, stderr=PIPE) + ], stdout=PIPE, stderr=PIPE, env=env) def mypy_all() -> Iterable[Exception]: diff --git a/mypy.ini b/mypy.ini index b08156c..15f1976 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,4 +1,5 @@ [mypy] +# TODO ugh. I might need to set it dynamically because of macos?? mypy_path=~/.config/my pretty = True show_error_context = True diff --git a/setup.py b/setup.py index d22559b..5672e05 100644 --- a/setup.py +++ b/setup.py @@ -51,6 +51,11 @@ def main(): 'pylint', 'mypy', ], + 'optional': [ + # TODO document these? + 'logzero', + 'cachew', + ] }, ) diff --git a/tox.ini b/tox.ini index 037e85c..8188028 100644 --- a/tox.ini +++ b/tox.ini @@ -30,7 +30,7 @@ commands = ./demo.py [testenv:mypy] skip_install = true commands = - pip install -e .[testing] + pip install -e .[testing] .[optional] ./lint