Sometimes you want to share functions across notebooks and scripts. You can do this by putting your common functions in a package. Compared to a public package, you do not need to specify as much information for a private package.
from setuptools import setup setup()
Here is an example
setup.cfg for a private package. Note that we specified the
sources folder as containing our package(s).
[metadata] name = your-package version = 1.2.3 [options] packages = find: install_requires = crosscompute >= 0.9.4.9 zip_safe = True [options.extras_require] development = pre-commit [options.packages.find] where = sources [options.package_data] your_package = assets/*.html [flake8] max-line-length = 79 select = B,C,E,F,W ignore = W503
# Make package folder mkdir sources/your_package -p # Make package importable touch sources/your_package/__init__.py # Put your common functions into the package vim sources/your_package/routines.py def f(x, y): return x + y
pip install -e .
from your_package.routines import f f(1, 2)