Skip to main content

Detect if your script is running inside a virtual environment

Project description

isVirtual is a very simple tool to detect if the current script is within a virtual environment.

Disclaimer

The goal of this project was to play around with the process to publish to Pypi. The code of this module is coming from this stackoverflow thread.

If you find use cases in which it doesn't work please open an issue. I intend to maintain this small package even if it can be seen as "useless".

Install

pip install isvirtual

Usage

Within a python script:

from isvirtual import is_virtual_env

if __name__ == "__main__":
    if is_virtual_env() is True:
        print("You are within a virtual environment")
    else:
        print("You are not in a virtual env")

CLI mode:

$ isvirtual
Yes

License

This project is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isvirtual-1.0.0.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

isvirtual-1.0.0-py3-none-any.whl (8.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page