Install azruntime as a CLI program using pipx
azruntime, the Python program I wrote to manage virtual machines in my Azure subscriptions, is more convenient to use when run as a command from the Linux prompt instead of as a Python program in its virtual environment. You can install Python packages as command-line-programs using pipx.
To make azruntime work after using pipx to install it, I had to organize the project into a proper Python package folder structure, add an entry point in the setup.py file, and change the authentication class used by azruntime.
This post describes what I learned about pipx and Python packaging to enable me to install azruntime as a CLI application.
Changing the package directory structure
I originally structured the azruntime package so all its files were in one folder. I know this is not the standard way that packages are organized but I thought it was simpler and it worked with pip. However, pipx requires the correct package folder structure.
Below, I show the new folder structure I created.
azruntime/
├── LICENSE
├── README.md
├── azruntime
│ ├── __init.py__
│ ├── __main__.py
│ └── azruntime.py
├── requirements.txt
└── setup.py
At the top level, I have Continue reading

