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)
Built Distribution
Close
Hashes for isvirtual-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59b0dcf00227bb214b1b23fd9beedc81cf783f5935643d24ffdfd97dbeb5c8a5 |
|
MD5 | 870a09eb1fd49b87696c4dc8470b171c |
|
BLAKE2b-256 | 848cb350ff3d112f30a7438c6d9fd42e5ec917f4edbf2b7ca98aa66412a67eb3 |