本文整理汇总了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 ###