How might I discover which version of fabric I have installed - through the API?
I understand that I can just run
$ fab --version
but I'd rather be doing something like
>>> import fabric
>>> fabric.version
'1.4.1'
There's the version submodule in fabric:
>>>import fabric.version
>>>fabric.version.get_version()
'1.2.2'
You don't need to even do that, it's in the docs:
from fabric.api import *
print env.version
Sadly with Fabric 2 you have now to do something like
import fabric
if hasattr(fabric, '__version__'):
# For fabric2
print(fabric.__version_info__)
print(fabric.__version__) # for a version tuple
else:
# for fabric1
from fabric.api import *
print(env.version)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With