Saravanan666/pypi-org huggingface dataset:
Package: nbdime
Installation|Documentation|Contributing|Development Install|Testing|License|Getting helpnbdimeJupyter Notebook Diff and Merge toolsnbdimeprovides tools for diffing and merging ofJupyter Notebooks.nbdiffcompare notebooks in a terminal-friendly waynbmergethree-way merge of notebooks with automatic conflict resolutionnbdiff-webshows you a rich rendered diff of notebooksnbmerge-webgives you a web-based three-way merge tool for notebooksnbshowpresent a single notebook in a terminal-friendly wayDiffing notebooks in the terminal:Merging notebooks in a browser:InstallationInstall nbdime with pip:pip install nbdimeSeethe installation docsfor more installation details and development installation instructions.DocumentationSee the latest documentation athttps://nbdime.readthedocs.io.See also description and discussion in theJupyter Enhancement Proposal.ContributingIf you would like to contribute to the project, please read ourcontributor documentationand theCONTRIBUTING.md.Development InstallTo install a development version of nbdime, you will neednpm installedand available on your PATH while installing.For adevelopment install, enter on the command line:pipinstall-egit+https://github.com/jupyter/nbdime#egg=nbdimeSeeinstallationdocumentation for additional detail, particularly related to performing
a dev install for working on the browser script code.TestingInstall the test requirements:pip install nbdime[test]To run Python tests locally, enter on the command line:pytestTo run Javascript tests locally, enter:npm testInstall thecodecov browser extensionto view test coverage in the source browser on github.Seetestingdocumentation for additional detail.LicenseWe use a shared copyright model that enables all contributors to maintain the
copyright on their contributions.All code is licensed under the terms of the revised BSD license.Getting helpWe encourage you to ask questions on themailing list.ResourcesReporting IssuesDocumentation for nbdime|PDF (latest)Documentation for Project Jupyter|PDFProject Jupyter website
Package: nbdirs
nbdirsDeveloper GuideSetup# create conda environment$mambaenvcreate-fenv.yml# update conda environment$mambaenvupdate-nnbdirs--fileenv.ymlInstallpipinstall-e.# install from pypipipinstallnbdirsnbdev# activate conda environment$condaactivatenbdirs# make sure the nbdirs package is installed in development mode$pipinstall-e.# make changes under nbs/ directory# ...# compile to have changes apply to the nbdirs package$nbdev_preparePublishing# publish to pypi$nbdev_pypi# publish to conda$nbdev_conda--build_args'-c conda-forge'$nbdev_conda--mambabuild--build_args'-c conda-forge -c dsm-72'UsageInstallationInstall latest from the GitHubrepository:$pipinstallgit+https://github.com/dsm-72/nbdirs.gitor fromconda$condainstall-cdsm-72nbdirsor frompypi$pipinstallnbdirsDocumentationDocumentation can be found hosted on GitHubrepositorypages. Additionally you can find
package manager specific guidelines oncondaandpypirespectively.NBDirs.makedirs(verbose=True)DATA:
    - path  = /Users/solst/Projects/nbdirs/data
    - desc  = The default directory for data files.

EXPL:
    - path  = /Users/solst/Projects/nbdirs/examples
    - desc  = The directory containing all example notebooks.

FIGS:
    - path  = /Users/solst/Projects/nbdirs/figures
    - desc  = The default directory for figures.

NBKS:
    - path  = /Users/solst/Projects/nbdirs/nbs
    - desc  = The directory containing all nbdev notebooks.

root:
    - path  = /Users/solst/Projects/nbdirs/nbs
    - desc  = The root directory

RSLT:
    - path  = /Users/solst/Projects/nbdirs/results
    - desc  = The default directory for results.

{'DATA_DIR': NBDir(/Users/solst/Projects/nbdirs/data),
 'EXPL_DIR': NBDir(/Users/solst/Projects/nbdirs/examples),
 'FIGS_DIR': NBDir(/Users/solst/Projects/nbdirs/figures),
 'NBKS_DIR': NBDir(/Users/solst/Projects/nbdirs/nbs),
 'ROOT_DIR': NBDir(/Users/solst/Projects/nbdirs/nbs),
 'RSLT_DIR': NBDir(/Users/solst/Projects/nbdirs/results)}
Package: nbdocgen
nbdocgenis a command line tool to generate documentation for each and every cell in a Jupyter notebook using OpenAI.Getting StartedPrerequisitesPython >=3.8PoetryOpenAI API KeyInstallationgit clone https://github.com/santiadavani/nbdocgen
cd nbdocgen
poetry shell
poetry install
pip install .UsageSet OPENAI_API_KEY environment variable. If you don't have a key please check documentationhereexport OPENAI_API_KEY=<OPENAI_API_KEY>You can check all the options using--help.(nbdocgen-py3.9) bash-3.2$ nbdocgen --help
Usage: nbdocgen [OPTIONS]

Options:
  --input PATH          Input Jupyter Notebook
  --output PATH         Output Jupyter Notebook
  --temperature FLOAT   Temperature for OpenAI  [default: 0.7]
  --top_p FLOAT         Top p for OpenAI  [default: 1.0]
  --max_tokens INTEGER  Max tokens for OpenAI completion  [default: 256]
  --base_prompt TEXT    Base prompt for OpenAI completion  [default: Please
                        generate a two sentence markdown documentation for the
                        given Python code.]
  --help                Show this message and exit.ExamplesBasic Usagenbdocgen --input <input_notebook> --output <output_notebook>Advanced UsageIn this example, we show how to usetemperatureandbase_promptoptions.nbdocgen --input ~/Downloads/input_notebook.ipynb \
--output ./output_notebook.ipynb --temperature 0.3 \
--base_prompt "Please generate 5 sentence markdown documentation for the code below"
Package: nbdump
nbdumpDump files to Jupyter notebook. Restore by running the notebook. Add optional extra commands to run.Installation# userpipinstall-Unbdump# developmentpipinstall-e.
pipinstalltests/requirements.txt
pytestUsageIn this demo, we will usesrc_example/as a fake repo that you want to import to notebook.CLI# see helpnbdump-h# basic usage, this will dump entire `src_example/` to `nb1.ipynb`nbdumpsrc_example-onb1.ipynb# use shell expansion, this will come in handy laternbdumpsrc_example/**/*.py-onb2.ipynb# handle multiple files/dirs, will be deduplicatednbdumpsrc_examplesrc_example/main.py-onb3.ipynb# append extra code cell, e.g. running the `src_example/main.py`nbdumpsrc_example-c'%run src_example/main.py'-onb4.ipynb# extra cells can be more than onenbdumpsrc_example\-c'%run src_example/main.py'\-c'!git status'\-onb5.ipynb# use fd to skip ignored files and hidden filesnbdump$(fd-tf.src_example)-onb6.ipynb# clone metadata from another notebooknbdumpsrc_example/**/*.py-onb7.ipynb-mtests/kaggle/modified/modified-notebook.ipynbThere is a catch,nbdumpwill not respect gitignore because the core functionality is just converting a bunch of files to notebook cells. This means, by using the first example onnb1.ipynb,nbdumpwill try to convert all files recursively, regardless of file format. The problem arises whensrc_example/contains binary files such as pictures or even__pycache__/*.Then shell expansion can be used to only select relevant files, such as the example onnb2.ipynb(make sure to enable globstar in bash to use**). Another solution is to use other tools likefdto list the files while respecting gitignore and skipping hidden files automatically.LibraryfrompathlibimportPathimportnbdumptarget_files=list(Path("src_example").rglob("*.py"))codes=["!ls -lah","!git log --oneline","%run src_example/main.py"]metadata_notebook="tests/kaggle/modified/modified-notebook.ipynb"# save to diskwithopen("nb8.ipynb","w")asf:nbdump.dump(f,target_files,codes,metadata_notebook)# save as stringipynb=nbdump.dumps(target_files,codes,metadata_notebook)print(ipynb[:50])Why?Kaggle kernel withcode competitiontype with disabled internet cannot use git clone inside the notebook.nbdumpallows one to work in a standard environment but the final result can be exported to a single notebook, while still preserving the filesystem tree.This is different than just zipping and unzipping because by using%%writefile, you can see and edit the file inside, even after the notebook creation.
Package: nbenumerate
nbenumerateAutomatically enumerate the markdown titles in jupyter notebooks.Installing nbenumerateInstall nbenumerate with pip:pip install nbenumerateUsing nbenumerateTo run on one or more notebooks:nbenumerate path/to/notebook.ipynbPrecommit HookAdd this section to yourpre-commit-config.yamlso that thenbenumeratescript is executed before each commit with pre-commit.-repo:https://github.com/AnH0ang/nbenumeraterev:0.2.1hooks:-id:nbenumeratename:nbenumerate
Package: nbenv
Store conda environment package list inside Notebook documentsThis package provides a hook for the Jupyter Notebook that saves metadata about the
conda environment (equivalent ofconda env export) inside the Notebook.ipynbfile
everytime that the Notebook is saved.
It also supports packages installed inside the conda environment withpip.Once such Jupyter Notebook is shared, another user can inspect the environment where
it ran:$nbenv--extractmy_notebook.ipynbname:test_input_envchannels:-defaults-conda-forgedependencies:-ca-certificates=2017.08.26=h1d4fec5_0-certifi=2017.7.27.1=py35h19f42a1_0-decorator=4.1.2=py35h3a268aa_0-ipykernel=4.6.1=py35h29d130c_0-ipython=6.1.0=py35h1b71439_1-ipython_genutils=0.2.0=py35hc9e07d0_0-jupyter_client=5.1.0=py35h2bff583_0-pip:-ipython-genutils==0.2.0-jupyter-client==5.1.0And re-create the same environment (includes install of IPython Kernel):$nbenvmy_notebook.ipynb--namereconstructed_env$sourceactivatereconstructed_env$jupyternotebookThe environment metadata will be preserved if the Notebook file is modified by a Jupyter Notebook session
with nonbenvinstalled.InstallInstall the package withpip install nbenvInstall the Jupyter Notebook hook in your.jupyter/jupyter_notebook_config.py:try:fromnbenvimportsave_conda_environmentc.FileContentsManager.pre_save_hook=save_conda_environmentexceptImportError:print("nbenv package not found: automatic saving of conda environment disabled")Implementation detailsThepre_save_hookis automatically triggered by the Jupyter Notebook before saving the Notebook
to disk.
It identifies the conda environment being run checking the KernelSpec and then callsconda env exportand saves the output in["content"]["metadata"]["conda_environment"]in the.ipynbJSON.Thenbenvcommand line tool can then extract that and useconda createto a new environment.CreditsDesign of this package was conceived during discussion at theContainer Analysis Environments Workshopheld at NCSA in August 2017.This package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.
Package: nbev3devsim
nbev3devsimnbev3devsimpackages theEv3DevSimsimulator as anipywidgetfor use in Jupyter notebooks.Click the Binder button to launch a demo:Install as:pip install nbev3devsimLaunch simulator window as:fromnbev3devsim.load_nbev3devwidgetimportroboSim,eds%load_extnbev3devsimAboutev3devsimev3devsimis a "browser based simulator for ev3dev-lang-python" [repo,demo]. The original demostration provides a browser based terminal for writing ev3dev-lang-pyhton code that is then executed in a Javascript based Skulpt Python environment and used to control a simulated robot via a simple 2D simulator implemented using Javascript and HTML canvas elements.Related blog posts:Simple 2D ev3devsim Javascript Simulator Running as an ipywidget in Jupyter Notebooks(ish!)Simple Text to Speech With Skulpt
Package: nbex
Notebook-like ExecutablesPython programs that allow notebook-like development.Free software: MIT licenseDocumentation:https://nbex.readthedocs.io.FeaturesSwitch between development and deployment modesUse development mode to configure smaller data tables, models, etc.Use deployment mode to run full deployment and trainingSwitch between interactive and command-line usageUse interactive mode to interact with the code in a notebook, receive styled IPython output, etc.Use command-line usage to run the code in your CI system, etc.Installation for DevelopmentTo developnbexwith a standard Python environment install it aspipinstall-e.from the root directory of the package.If you are using conda, make sure that you have theconda-buildpackage installed
and then installnbexwithcondadevelop.from the root directory of the package.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2020-11-11)First release on PyPI.0.2.0 (2020-11-12)Try to guess a useful value for is_interactive without user intervention.0.2.4 (2020-11-27)Add support for publishing a conda version0.3.0 (unreleased)Improved algorithm for figuring out whether a session is interactive or not.0.3.1 (2021-01-05)Addsession.forced_interactive_valueproperty to override automatic
detection.0.3.2 (2021-01-05)Improvements to build and release targets, no changes to Python code.
Package: nb-extension-tagstyler
nb_extension_tagstylerStyle Jupyter notebook cells by tag.Content in Jupyter notebook markdown cells can be styled by adding a range ofalertclass attributes todivs contained within the cell.Wouldn't it be easier if we could just tag the cell?Currently, onlyalert-success(green),alert-warning(yellow),alert-danger(pink) andalert-info(blue) tags are supported. You also need to manually reload the notebook in the browser to render the styling.(TO DO: try to mod the tag entry thing so it reflows the cell styling if a cell tag is added?)The extension also increases the notebook load time as it iterates through every cell looking for tags.Install via:pip install git+https://github.com/innovationOUtside/nb_extension_tagstyler.gitpip install nb_extension_tagstylerThe extension should be automatically installed and enabled.If you need to do things manually:jupyter nbextension uninstall tagstyler
jupyter nbextension install tagstyler --user
jupyter nbextension enable tagstyler/index
Package: nbfancy
(C) 2019 Jack Betteridge (j.d.betteridge@bath.ac.uk) and James Grant (r.j.grant@bath.ac.uk)This repository contains NBfancy,
a tool for adding decoration and extended features to Jupyter notebooks.
The code was developed by Jack Betteridge and James Grant
for the development of programming training material:arc-bathandarc-lessons.DocumentationThe install contains the tools which make up the build system for enriching notebooks,
and by way of example, also contains the documentation in the form of a tutorial.
This material will assist users in creating their own courses,
as both a lesson and demonstration of NBfancy's capabilities.Jupyter notebooks were chosen as the medium for out training material as:They use markdown which is simple to use even for those not familiar.Modifying individual codeblocks is intuitive compared with Sphinx/Jekyll builds.We like being able to mix markdown and executable codeblocks in training material.In order to retain these features we created NBfancy to process initial notebooks
into enriched Jupyter notebooks for interactive use by students,
html pages for lesson material
and pdfs for distribution as printouts (coming in a future release).The documentation/tutorial is available online inrendered htmlThe library has recently undergone a signficant refactoring so please raise an issue if you encounter any trouble using nbfancy or incosistencies in the documentation.Contributions to NBfancyIf you would like to contribute to NBfancy please fork the repository and create a pull request against the development branch.
Package: nbfigtulz
nbfigtulznbfigtulzis a small library to show and save visualizations made viamatplotlibwith the aim to let the user conveniently render publication ready images by default while working inJupyterLab. The main features ofnbfigtulzare:Images are generated and stored in thePNGandPGFformat which lends itself perfectly for inclusion inPDF/A-1bdocuments.PNGsare savedBase64encoded within a notebook. This makes the notebook free-standing and one can send raw notebooks to fellow researchers without having to remember to include various additional files such as images. Note thatone does not have to re-run the notebook to display the images.Users are encouraged to render small images with high-resolution. Ideally, these images can be included without rescaling into a document.DocumentationFind our documentationhere.Installationnbfigtulzreleases are available as wheel packages for macOS, Windows and Linux onPyPI.
Install it using pip:python -m pip install -U pip
python -m pip install -U nbfigtulzExamplesIn addition to ourdocumentationwe provide a short notebook with a few examples:example/notebook.ipynb
Package: nb-filelock
1. pip install nb_filelock基于代码所在机器的跨进程 跨解释器的文件互斥锁。兼容windwos和linuxfilelock,which can run on linux and windwos.文件锁的功能意义此文件锁并不是为了解决多个python程序写入同一个txt文件的问题(当然顺便也解决了这个问题)，
而是借助文件锁这种中间件介质(类比redis分布式锁使用redis做中间件介质)，
从而实现当前机器无论启动多少次脚本，只有一个脚本能获得锁从而执行锁里面的代码块。各种锁的能力影响范围大小锁的能力范围大小是  多线程锁  <  多进程锁  <  文件锁  <  redis分布式锁。线程锁只能确保单一进程的不同线程只有一个线程能获得锁从而执行代码块

多进程锁针对不同进程，但有个前提是，进程必须是这么饿启动的，
例如 a.py 文件，在a.py文件里面的代码需要引用muliprossing包的Process(target=func).start()来启动多进程
如果是把 a.py反复手动运行两次，而不是用了muliprossing包来一次性启动的，两次a.py的进程完全毫不相关，
这种不同的脚本进程彼此没法知道另一个进程里面的变量，此时需要引入一种中间介质，每个脚本都去读取这个中间件介质来获得锁才可以，
可以使用redis分布式锁，但这种比较烦需要安装一个redis，没安装redis的环境代码就无法运行了。所以就是要开发一种文件锁，不需要安装中间件。

文件锁, 影响范围是当前机器，能够跨不同批次的启动脚本的解释器，确保代码里面只有一个地方能获得文件锁，从而执行代码块。
比如希望在当前机器只能同时运行某一个代码块，完全豪不相关的两次启动xx.py，没有办法使用进程锁，
压根就不是使用multiprossing包同时启动的多个子进程而是手动两次运行了python xx.py，
好的方式是使用redis分布式锁，可以保证所有机器只提示一个获得锁，但如果没安装redis切要保证当前机器只有一个能执行代码块，就需要这个。


redis分布式锁，能影响的范围最强力最广泛，不进能够跨本机的解释器，还能跨机器，可以确保几百台电脑只有一个地方能获得锁从而执行代码块，但要安装redis。测试例子。把下面的python文件复制到一个文件中叫test.py,然后重复启动两次 python test.py，
当第一个脚本还没执行完代码块时候，另一个脚本会等待第一个脚本执行完成代码块的语句才会开始print hi。importnb_logimporttimefromnb_filelockimportFileLockprint('wait filelock')withFileLock('testx.lock'):print('hi')time.sleep(20)print('hello')实现代码importosimportabcifos.name=='nt':importwin32con,win32file,pywintypesLOCK_EX=win32con.LOCKFILE_EXCLUSIVE_LOCKLOCK_SH=0# The default valueLOCK_NB=win32con.LOCKFILE_FAIL_IMMEDIATELY_overlapped=pywintypes.OVERLAPPED()# noqaelse:importfcntlclassBaseLock(metaclass=abc.ABCMeta):def__init__(self,lock_file_path:str):self.f=open(lock_file_path,'a')@abc.abstractmethoddef__enter__(self):raiseNotImplemented@abc.abstractmethoddef__exit__(self,exc_type,exc_val,exc_tb):raiseNotImplementedclassWindwosFileLock(BaseLock):def__enter__(self):hfile=win32file._get_osfhandle(self.f.fileno())win32file.LockFileEx(hfile,LOCK_EX,0,0xffff0000,_overlapped)def__exit__(self,exc_type,exc_val,exc_tb):hfile=win32file._get_osfhandle(self.f.fileno())win32file.UnlockFileEx(hfile,0,0xffff0000,_overlapped)classLinuxFileLock(BaseLock):def__enter__(self):fcntl.flock(self.f,fcntl.LOCK_EX)def__exit__(self,exc_type,exc_val,exc_tb):fcntl.flock(self.f,fcntl.LOCK_UN)FileLock=WindwosFileLockifos.name=='nt'elseLinuxFileLockif__name__=='__main__':""" 把这个脚本连续反复启动多个可以测试文件锁，只有获得文件锁，代码块才能执行"""importnb_logimporttimeprint('等待获得锁')withFileLock('testx.lock'):print('hi')time.sleep(20)print('hello')
Package: nbfilter
nbfilterFilter.ipynb(nbformat) files to improve integration with version control systems (VCS), specifically git.SetupInstall fromPyPI:pipinstallnbfilterUse from the command line:python-mnbfilter.clean<research.ipynb|spongeresearch.ipynbIntegrate intogit:From your repository's root directory:Run the following command to define a filter calledipynbfilterin your.git/configsettings:gitconfigfilter.ipynbfilter.clean'python -m nbfilter.clean'Then run one of the following command sequences to trigger it for all files with the.ipynbextension:printf'*.ipynb filter=ipynbfilter\n'>>.gitattributes# Apply filter for all contributorsgitadd.gitattributesor:printf'*.ipynb filter=ipynbfilter\n'>>.git/info/attributes# Apply filter for just meTo apply it to files that are already under source control (for example, so that diffing subsequent changes produces more intelligible results):gitadd--renormalize.# (re-)apply filters to all files currently under source controlor:gitadd--renormalizeresearch.ipynb# (re-)apply filters to a single fileReferences / alternativesMin RK'snbstripoutgistthat started it all (licensed as "Public Domain").git pre-commit hook for stripping output from IPython notebooksnbstripoutis aPyPI-publishedpackage that provides all its functionality through anbstripoutconsole script.StackOverflow question:Using IPython notebooks under version controlMaking Git and Jupyter Notebooks play niceusesjqinstead of Python to do the JSON modifications, for the sake of speed.Jupyter notebooks and version controldiscusses alternatives to the.ipynbfile format that would natively improvegit diff'ing
(specifically, YAML with some additional constraints).LicenseCopyright (c) 2018 Christopher Brown.MIT Licensed.
Package: nb-filter-cells
nb-filter-cellsnb-filter-cellsfilters Jupyter notebooks cells by tag.Installationpipinstallnb-filter-cellsnb-filter-cellsrequires Python 3.6 or later.UsageTo remove all cells with 'exercise' tag:nb-filter-cells-inotebook.ipynb-onotebook-solutions.ipynb-texerciseCopyrightCopyright © 2019 Liam Coatman.nb-filter-cellsis distributed under the terms of theISC licence.
Package: nbfixme
Utility to fix basic notebook validation errorsThis project offers a command line tool to fix jupyter notebook files that have some type of validation errors.
These errors may happen when editing a notebook in non standard jupyter clients like PyCharm or other editors
and they can stop the notebook from being properly processed or displayed in github for example.Currently the script only deals with one type of error that appears asNotebookValidationError: 'execution_count' is a required property.
This error usually happens when a notebook is saved and its last cell has not been executed.
As a fix the script will add a keyexecution_countwith a value ofnullto the cell data
if the key is not already present.By default the script will change the files in place when there is a fix, but you can specify an OUTDIR
parameter if you prefer to save output files in a different directory.UsageUsage: nbfixme [OPTIONS] [PATH]...Utility to fix basic notebook validation errorsPATH is the path to a notebook file or adirectory containing *.ipynb files.By default the script will change the files inplace when there is a fix, but you can specifyan OUTDIR parameter if you prefer to save outputfiles in a different directory.Options:-o, --outdir OUTDIR  Save output in directory.-c, --check-only     Only check for errors.-r, --recurse        Recurse to sub directories.Example❯ nbfixme extras -o outputextras/notebook-valid.ipynb okextras/notebook-broken.ipynb errorextras/notebook-tofix.ipynb fixedInstallationYou can install the latest version of this module withpiporpipxpip install git+ssh://git@github.com/furechan/nbfixme.gitRelated Resources-The Jupyter Notebook Format
Package: nbg
NBG Python SDKThenbgPython packageenables developers to build applications that use the public APIs of the National Bank of Greece.InstallationWe suggest using a package manager likePoetryorPipenvto installnbg. This guarantees that the intended version ofnbgwill be installed every time, through content hash checks:poetry add nbgAlternatively you can use Pipenv:pipenv install nbgIn case you cannot use Poetry or Pipenv, you can always installnbgwithpip:pip install nbgDocumentationThe full documentation for the NBG Python SDK is hosted at Read the Docs:https://readthedocs.org/projects/nbg-python-sdk.API clientsThe National Bank of Greece provides a set of multiple APIs. To use each one of these APIs, you should pick the corresponding client from thenbgpackage.Accounts Information PSD2 APIfromnbgimportaccount_information# Step 1 - Set up client and authenticationclient_id="your_client_id"client_secret="your_client_secret"client=account_information.AccountInformationPSD2Client(client_id=client_id,client_secret=client_secret,production=False,)client.set_access_token("access_token_of_your_user")# Step 2 - Set up a sandbox, when in developmentsandbox_id=f"{client_id}_sandbox"client.create_sandbox(sandbox_id)client.set_sandbox(sandbox_id)# Step 3 - Start working with the Account information APIaccounts=client.accounts(user_id="your_user_id")print(accounts)