Package: nokogiri
nokogiriThis Python library is a sharp "nokogiri" that cuts through the problems that arise in the process of trial and error, such as machine learning.pipinstallnokogirispylusNow you can draw image with stylus pen or drawing tablet such as iPad, Surface and Wacom in JupyterLab/Notebook.Of course it senses pressure so you can control the thickness of the line.Clipboard image copy/paste feature supported! this is super effective for AI painting with clip studio/photoshop.VSCode greatly limits functionality due to policies that prohibit the execution of javascript in notebooks. Please use JupyterLab/Notebook.screenshotTry itHit this button and launch demo via binder.launch demo via binderJust read usage on githubfromnokogiri.spylusimportspylusanyparseDrop-in replacement library for (config)argparse that works anywhere (Jupyter Notebook, JupyterLab, VSCode Python Interactive).
Have you ever met an annying error message like this?usage: ipykernel_launcher.py [-h]
ipykernel_launcher.py: error: unrecognized arguments: -f 
…
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2As shown in the following example.
You can drop-in replace argparse with anyparse.
You can also specify commands to be parsed only on jupyter.from nokogiri import anyparse as argparse # Drop-in replacement
parser = argparse.ArgumentParser()
parser.add_argument('--readlink', type=str, default="")
parser.add_argument('--metrics', type=bool, default=False)
parser.jupyter_argument("--metrics True") # This command is parsed only on jupyter.
args = parser.parse_args()If configargparse is already installed, all features are available!working_dirEnables import of any module not in the project tree from anywhere at any timefromnokogiri.working_dirimportworking_dirwithworking_dir("/path/to/isolated_module"):importisolated_modulewithopen("isolated_data")asf:isolated_data=f.read()tqdm_loadDisplay a progress bar while reading a pickle filefromnokogiri.tqdm_loadimporttqdm_loaddata=tqdm_load("/path/to/data.pkl")defaultdotdictdefaultdict but also dotdictfromnokogiri.defaultdotdictimportdefaultdotdictsounds=defaultdotdict(lambda:"meow")print(sounds.dog)# "meow"sounds["dog"]="bow"# you can also access with []print(sounds.dog)# "bow"currycurrying function. add some syntax sugar for a lot of function arguments.fromnokogiri.curryimportcurry# "pipe" iterable objects@currydeff(x):returnx+1@currydefg(x):return2*xrange(5)|f|g# [2,4,6,8,10]# example of common use case@currydeff(a="a",b="b",c="c",d="d"):returnf"/{a}/{b}/{c}/{d}"f.hoge.fuga.piyo("root")# "/root/hoge/fuga/piyo"# syntaxf.hoge.fuga.piyo==lambdax:f(x,'hoge','fuga','piyo')f[1][None][True]==lambdax:f(x,1,None,True)f._(key="value")==lambdax:f(x,key="value")which_envDetect notebook environment is Jupyter or Terminal or …fromnokogiri.which_envimportwhich_envifwhich_env()==which_env.JUPYTER:fromtqdm.notebookimporttqdmelse:fromtqdmimporttqdmshared_mapshare large size map/dict between notebok kernelspython-mnokogiri.shared_map/path/to/*.pklfromnokogiri.shared_mapimportshared_mapsm=shared_map("/path/to")forxintqdm(range(100)):y=sm.hoge(x)# read from /path/to/hoge.pklcellBring Jupyter cell behavior to VSCode Python Interactivefromnokogiri.cellimportcellA=1B=2@cell()deffunc(A,B):C=A+BD=A*BreturnC,Dprint(C,D)# 3, 2code embeding test (recently I noticed that Readme.md is code-embeddable like this.)https://github.com/nat-chan/nokogiri/blob/e0d438d20d28a36467337bed540a1d2770c65caa/nokogiri/tqdm_load.py#L9-L17