本文整理匯總了Python中param.version方法的典型用法代碼示例。如果您正苦於以下問題:Python param.version方法的具體用法?Python param.version怎麽用?Python param.version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類param
的用法示例。
在下文中一共展示了param.version方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: embed_version
# 需要導入模塊: import param [as 別名]
# 或者: from param import version [as 別名]
def embed_version(basepath, ref='v0.2.2'):
"""
Autover is purely a build time dependency in all cases (conda and
pip) except for when you use pip's remote git support [git+url] as
1) you need a dynamically changing version and 2) the environment
starts off clean with zero dependencies installed.
This function acts as a fallback to make Version available until
PEP518 is commonly supported by pip to express build dependencies.
"""
import io, zipfile, importlib
try: from urllib.request import urlopen
except: from urllib import urlopen
try:
url = 'https://github.com/ioam/autover/archive/{ref}.zip'
response = urlopen(url.format(ref=ref))
zf = zipfile.ZipFile(io.BytesIO(response.read()))
ref = ref[1:] if ref.startswith('v') else ref
embed_version = zf.read('autover-{ref}/autover/version.py'.format(ref=ref))
with open(os.path.join(basepath, 'version.py'), 'wb') as f:
f.write(embed_version)
return importlib.import_module("version")
except:
return None
示例2: get_setup_version
# 需要導入模塊: import param [as 別名]
# 或者: from param import version [as 別名]
def get_setup_version(reponame):
"""
Helper to get the current version from either git describe or the
.version file (if available).
"""
import json
basepath = os.path.split(__file__)[0]
version_file_path = os.path.join(basepath, reponame, '.version')
try:
from param import version
except:
version = embed_version(basepath)
if version is not None:
return version.Version.setup_version(basepath, reponame, archive_commit="$Format:%h$")
else:
print("WARNING: param>=1.6.0 unavailable. If you are installing a package, this warning can safely be ignored. If you are creating a package or otherwise operating in a git repository, you should install param>=1.6.0.")
return json.load(open(version_file_path, 'r'))['version_string']
########## examples ##########
示例3: get_setup_version
# 需要導入模塊: import param [as 別名]
# 或者: from param import version [as 別名]
def get_setup_version(reponame):
"""
Helper to get the current version from either git describe or the
.version file (if available).
"""
basepath = os.path.split(__file__)[0]
version_file_path = os.path.join(basepath, reponame, '.version')
try:
from param import version
except:
version = None
if version is not None:
return version.Version.setup_version(basepath, reponame, archive_commit="0a8a19c1bf")
else:
print("WARNING: param>=1.6.0 unavailable. If you are installing a package, this warning can safely be ignored. If you are creating a package or otherwise operating in a git repository, you should install param>=1.6.0.")
return json.load(open(version_file_path, 'r'))['version_string']
示例4: get_setup_version
# 需要導入模塊: import param [as 別名]
# 或者: from param import version [as 別名]
def get_setup_version(reponame):
"""
Helper to get the current version from either git describe or the
.version file (if available).
"""
basepath = os.path.split(__file__)[0]
version_file_path = os.path.join(basepath, reponame, '.version')
try:
from param import version
except Exception:
version = None
if version is not None:
return version.Version.setup_version(basepath, reponame, archive_commit="$Format:%h$")
else:
print("WARNING: param>=1.6.0 unavailable. If you are installing a package, "
"this warning can safely be ignored. If you are creating a package or "
"otherwise operating in a git repository, you should install param>=1.6.0.")
return json.load(open(version_file_path, 'r'))['version_string']
示例5: get_setup_version
# 需要導入模塊: import param [as 別名]
# 或者: from param import version [as 別名]
def get_setup_version(reponame):
"""
Helper to get the current version from either git describe or the
.version file (if available).
"""
basepath = os.path.split(__file__)[0]
version_file_path = os.path.join(basepath, reponame, '.version')
try:
from param import version
except:
version = None
if version is not None:
return version.Version.setup_version(basepath, reponame, archive_commit="2632874b")
else:
print("WARNING: param>=1.6.0 unavailable. If you are installing a package, this warning can safely be ignored. If you are creating a package or otherwise operating in a git repository, you should install param>=1.6.0.")
return json.load(open(version_file_path, 'r'))['version_string']
#######################
### bokeh extension ###