f4eamogj2e
It's true packages exist to make it "easy" to use Django inside of a jupyter notebook. I seem to always run into issues successfully running these packages. I've found the below method useful although I cannot recall how I discovered how this works (aka attribution needed).
- Virtual Environment (
virtualenv,venv,pipenv, etc) - Django installed & project created (we'll use the project name
cfehome) - Jupyter installed at least in the virtual environment
I hereby claim:
- I am linuxiscool on github.
- I am ygg_odin (https://keybase.io/ygg_odin) on keybase.
- I have a public key ASAyiq1D9Xh1wB3cC9OrzdrA2p0GoPnx6sgqFA2kaYCLlwo
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pip install pandas hvplot==0.7.1 holoviews==1.14.3 bokeh panel==0.11.3 | |
| # panel serve holoviz_linked_brushing.py --auto --show | |
| import hvplot.pandas | |
| import holoviews as hv | |
| import panel as pn | |
| from bokeh.sampledata.iris import flowers | |
| pn.extension(sizing_mode="stretch_width") | |
| hv.extension("bokeh") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| In jupyter notebook simple logging to console | |
| """ | |
| import logging | |
| import sys | |
| logging.basicConfig(stream=sys.stdout, level=logging.INFO) | |
| # Test | |
| logger = logging.getLogger('LOGGER_NAME') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from holoviews import Element, Store | |
| from bokeh.models import Column | |
| from holoviews.plotting.bokeh import ElementPlot | |
| class BokehFigure(Element): | |
| """Wraps bokeh figure""" | |
| class BokehFigurePlot(ElementPlot): | |
| def initialize_plot(self, ranges=None, plot=None, plots=None, source=None): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """CONVENTIONS: | |
| positions are done row-column from the bottom left and are both numbers. This corresponds to the alpha-number system in traditional chess while being computationally useful. they are specified as tuples | |
| """ | |
| import itertools | |
| WHITE = "white" | |
| BLACK = "black" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function pacmd-loopback --description 'Loop a pacmd source into a pacmd sink interactively.' | |
| if test (set source (pacmd list-sources | grep name: | awk '{ print $2 }' | cut -d'<' -f2 | cut -d'>' -f1 | fzf-tmux --header="Select a source" --phony); set sink (pacmd list-sinks | grep name: | awk '{ print $2 }' | cut -d'<' -f2 | cut -d'>' -f1 | fzf-tmux --header="Select a sink:"); printf "No\nYes" | fzf-tmux --header="CONFIRM: <$source> -> <$sink>") = "Yes" | |
| pacmd load-module module-loopback source=$source sink=$sink | |
| else | |
| echo "Aborted." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function _virtualfish | |
| if set -q VIRTUAL_ENV | |
| echo -n -s (set_color white) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal) " " | |
| end | |
| end | |
| function fish_prompt | |
| set fish_greeting | |
| set -l cyan (set_color -o cyan) | |
| set -l red (set_color -o red) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Inspiration from: https://github.com/jorgebucaran/cookbook.fish#how-do-i-find-and-run-commands-in-fish | |
| # Set $all_commands to a list of all commands available on $PATH | |
| set -l all_commands (ls $PATH | column) | |
| # Use `whatis` to append a one-line description of each command to a file | |
| for p in $all_commands | |
| whatis $p | tee -a all_command_descriptions | |
| end |