briandconnelly / ami-py

Simple functions to detect various runtime environments

Repository from Github https://github.combriandconnelly/ami-pyRepository from Github https://github.combriandconnelly/ami-py

ami

Development Status PyPI - Python Version PyPI - License PyPI - Version Codecov test coverage

ami (Am I...?) is a collection of simple functions that allow your Python code to detect and adapt to the environment in which it is being run.

Examples

import ami

# Am I using Linux?
ami.using_linux()


# On an ARM CPU?
ami.using_arm_cpu()


# Am I running a virtual environment?
ami.using_virtualenv()


# Am I running in a container?
ami.using_container()


# Am I connected to the internet?
ami.online()


# Am I on battery power?
ami.using_battery_power()

Installation

Install the latest stable version of ami from PyPI:

pip install ami

If you'd like to add ami to a project managed with uv:

uv add ami

Requirements

  • Python 3.11 or higher

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Simple functions to detect various runtime environments

License:MIT License


Languages

Language:Python 100.0%