Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Distribution demo 1

def whoami():
    print(__file__)

if __name__ == "__main__":
    whoami()
from distutils.core import setup

setup(
    name='demo1',
    version='1.0',
)
  • Install from the current folder
pip install .
  • Use it on the command line: (try it in a different folder!)
python -m demo1

/home/gabor/venv3/lib/python3.10/site-packages/demo1.py
  • Use it in the interactive shell
python
>>> import demo1
>>> demo1.whoami()
  • Uninstall (without asking questions)
pip uninstall demo1 --yes
build/
demo1.egg-info/