diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/example1/library1.py | 1 | ||||
-rw-r--r-- | examples/example1/library2.py | 2 | ||||
-rw-r--r-- | examples/example1/main.py | 4 | ||||
-rw-r--r-- | examples/example2/library1.py | 12 | ||||
-rw-r--r-- | examples/example2/main.py | 13 | ||||
-rw-r--r-- | examples/example3/README.md | 26 | ||||
-rw-r--r-- | examples/example3/foo.py | 3 |
7 files changed, 61 insertions, 0 deletions
diff --git a/examples/example1/library1.py b/examples/example1/library1.py new file mode 100644 index 0000000..dfcc0c1 --- /dev/null +++ b/examples/example1/library1.py @@ -0,0 +1 @@ +print('Libary 1 Loading') diff --git a/examples/example1/library2.py b/examples/example1/library2.py new file mode 100644 index 0000000..fb7cc63 --- /dev/null +++ b/examples/example1/library2.py @@ -0,0 +1,2 @@ +if __name__ == "__main__": + print("Library 2 loading") diff --git a/examples/example1/main.py b/examples/example1/main.py new file mode 100644 index 0000000..2ef6802 --- /dev/null +++ b/examples/example1/main.py @@ -0,0 +1,4 @@ +import library1 +import library2 + +print("main complete") diff --git a/examples/example2/library1.py b/examples/example2/library1.py new file mode 100644 index 0000000..a47a6da --- /dev/null +++ b/examples/example2/library1.py @@ -0,0 +1,12 @@ +import logging +import sys + +logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) +logger = logging.getLogger(__name__) + + +def foo(): + logger.debug("Library1") + +if __name__ == "__main__": + foo() diff --git a/examples/example2/main.py b/examples/example2/main.py new file mode 100644 index 0000000..12b8343 --- /dev/null +++ b/examples/example2/main.py @@ -0,0 +1,13 @@ +import logging +import sys + +import library1 + +logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) +logger = logging.getLogger(__name__) + +# Uncomment below to mute Library1's debug +# logging.getLogger("library1").setLevel(logging.INFO) +library1.foo() + +logger.debug("Main File") diff --git a/examples/example3/README.md b/examples/example3/README.md new file mode 100644 index 0000000..d7363e5 --- /dev/null +++ b/examples/example3/README.md @@ -0,0 +1,26 @@ +Launch ipython + +``` +ipython +``` + +Turn on autoreloading + +``` +%load_ext autoreload +%autoreload 2 +``` + +Import the bar command from foo + +``` +from foo import bar +``` + +Run bar + +``` +bar() +``` + +Make changes what bar prints, save and run again diff --git a/examples/example3/foo.py b/examples/example3/foo.py new file mode 100644 index 0000000..0768844 --- /dev/null +++ b/examples/example3/foo.py @@ -0,0 +1,3 @@ + +def bar(): + print("bar") |