1 Star 0 Fork 0

Yan-NanJing/jupyterlab

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
buildapi.py 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# Custom build target that removes .js.map files for published
# dist files.
import glob
import json
import os
import subprocess
from hatch_jupyter_builder import npm_builder
from packaging.version import Version
def builder(target_name, version, *args, **kwargs):
# Allow building from sdist without node.
if target_name == "wheel" and not os.path.exists("dev_mode"):
return
npm_builder(target_name, version, *args, **kwargs)
if version == "editable":
return
files = glob.glob("jupyterlab/static/*.js.map")
for path in files:
os.remove(path)
target = glob.glob("jupyterlab/static/package.json")[0]
with open(target) as fid:
npm_version = json.load(fid)["jupyterlab"]["version"]
py_version = subprocess.check_output(["hatchling", "version"]) # noqa S603 S607
py_version = py_version.decode("utf-8").strip()
if Version(npm_version) != Version(py_version):
msg = "Version mismatch, please run `npm run prepare:python-release`"
msg += f"; NPM {npm_version} / Python {py_version}"
raise ValueError(msg)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nanjingling/jupyterlab.git
git@gitee.com:nanjingling/jupyterlab.git
nanjingling
jupyterlab
jupyterlab
main

搜索帮助