Install package using pip

python3 -m pip install iotcore

Show package details using pip

python3 -m pip show iotcore

Uninstall package using pip

python3 -m pip uninstall iotcore

List installed packages using pip

python3 -m pip list

Upgrade a package using pip

python3 -m pip install --upgrade iotcore
# or
python3 -m pip install -U iotcore

New python project using poetry

poetry new poeetry_demo

Install new package using poetry

poetry add arrow

Show installed packages using poetry

poetry show --tree

Remove installed packages using poetry

poetry remove arrow

Then,

poetry install --sync

virtualenv in poetry

Activate the virtualenv

poetry shell

To exit the virtualenv

exit

Or run with the poetry like;

poetry run python project/script.py

Run python functions or scripts from poetry

Create a new python script inside your project, maybe inside scripts/timer.py.

import time

def main():
    time.sleep(3)
    print("Timer expired")

if __name__=="__main__":
    main()

Now add this to your pyproject.toml file;

[tool.poetry.scripts]
timer = "scripts.timer:main"

Now this command can be invoked as follows;

poetry run timer