remove garbage org files, move example config down the hierarchy

This commit is contained in:
Dima Gerasimov 2020-05-14 22:04:58 +01:00 committed by karlicoss
parent d0427855e8
commit 8d998146e2
8 changed files with 23 additions and 76 deletions

View file

@ -1,17 +0,0 @@
https://github.com/crowoy/Health-Analysis
https://github.com/joytafty-work/SleepModel
https://github.com/search?l=Jupyter+Notebook&q=s_awakenings&type=Code&utf8=%E2%9C%93
https://github.com/oshev/colifer/blob/592cc6b4d1ac9005c52fccdfb4e207513812baaa/colifer.py
https://github.com/oshev/colifer/blob/592cc6b4d1ac9005c52fccdfb4e207513812baaa/reportextenders/jawbone/jawbone_sleep.py
https://github.com/GlenCrawford/ruby_jawbone
* https://nyquist212.wordpress.com/2015/06/22/visualizing-jawbone-up-data-with-d3-js/
* TODO ok, so shoud really do a week of consistent bedtime/waking up to make some final decision on jawbone?
* TODO figure out timezones
* TODO post on reddit? release and ask people to run against their data?
* TODO [2019-12-19 Thu 19:53] hmm, if package isn't using mycfg then we don't really need it?

View file

@ -31,7 +31,7 @@ def run():
# #
# 4. point my.config to the Hypothesis data # 4. point my.config to the Hypothesis data
mycfg_root = abspath('my_repo/mycfg_template') mycfg_root = abspath('my_repo/doc/example_config')
init_file = Path(mycfg_root) / 'my/config/__init__.py' init_file = Path(mycfg_root) / 'my/config/__init__.py'
init_file.write_text(init_file.read_text().replace( init_file.write_text(init_file.read_text().replace(
'/path/to/hypothesis/data', '/path/to/hypothesis/data',

View file

@ -142,17 +142,16 @@ Since it's a Python package, generally it's very *flexible* and there are many w
~/.config/my/my/config/repos/rexport ~/.config/my/my/config/repos/rexport
#+end_example #+end_example
- Another example is in [[file:../mycfg_template][mycfg_template]]: - Another example is in [[file:example_config][example_config]]:
#+begin_src bash :exports results :results output #+begin_src bash :exports results :results output
cd .. for x in $(find example_config/ | grep -v -E 'mypy_cache|.git|__pycache__|scignore'); do
for x in $(find mycfg_template/ | grep -v -E 'mypy_cache|.git|__pycache__|scignore'); do
if [[ -L "$x" ]]; then if [[ -L "$x" ]]; then
echo "l $x -> $(readlink $x)" echo "symlink | $x -> $(readlink $x)"
elif [[ -d "$x" ]]; then elif [[ -d "$x" ]]; then
echo "d $x" echo "dir | $x"
else else
echo "f $x" echo "file | $x"
(echo "---"; cat "$x"; echo "---" ) | sed 's/^/ /' (echo "---"; cat "$x"; echo "---" ) | sed 's/^/ /'
fi fi
done done
@ -160,10 +159,10 @@ Since it's a Python package, generally it's very *flexible* and there are many w
#+RESULTS: #+RESULTS:
#+begin_example #+begin_example
d mycfg_template/ dir | example_config/
d mycfg_template/my dir | example_config/my
d mycfg_template/my/config dir | example_config/my/config
f mycfg_template/my/config/__init__.py file | example_config/my/config/__init__.py
--- ---
""" """
Feel free to remove this if you don't need it/add your own custom settings and use them Feel free to remove this if you don't need it/add your own custom settings and use them
@ -174,8 +173,8 @@ Since it's a Python package, generally it's very *flexible* and there are many w
# (it's just the standard Hypothes.is export format) # (it's just the standard Hypothes.is export format)
export_path = '/path/to/hypothesis/data' export_path = '/path/to/hypothesis/data'
--- ---
d mycfg_template/my/config/repos dir | example_config/my/config/repos
l mycfg_template/my/config/repos/hypexport -> /tmp/my_demo/hypothesis_repo symlink | example_config/my/config/repos/hypexport -> /tmp/my_demo/hypothesis_repo
#+end_example #+end_example
As you can see, generally you specify fixed paths (e.g. to your backups directory) in ~__init__.py~. As you can see, generally you specify fixed paths (e.g. to your backups directory) in ~__init__.py~.

View file

@ -1,35 +0,0 @@
Various thoughts on organizing
* Importing external models
- First alternative:
@lru_cache()
def hypexport():
... import_file
# doesn't really work either..
# hypexport = import_file(Path(paths.hypexport.repo) / 'model.py')
+ TODO check pytest friendliness if some paths are missing? Wonder if still easier to control by manually excluding...
- not mypy/pylint friendly at all?
- Second alternative:
symlinks in mycfg and direct import?
+ mypy/pylint friendly
? keeping a symlink to model.py is not much worse than hardcoding path. so it's ok I guess
* Thoughts on organizing imports
- First way:
import mycfg.hypexport_model as hypexport
works, but mycfg is scattered across the repository?
Second way:
from . import mycfg?
doesn't seem to work with subpackages?
right, perhaps symlinking is a good idea after all?...
Third way:
import mycfg.repos.hypexport.model as hypexport
works, but MYPYPATH doesn't seem to be happy...
ok, --namespace-packages solves it..

View file

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