···77# The full license is in the file LICENSE, distributed with this software. #
88#############################################################################
991010+import json
1111+from pathlib import Path
1212+1013import click
1114from jupyter_releaser.util import get_version, run
1215from pkg_resources import parse_version
···5356 if force:
5457 lerna_cmd += " --yes"
5558 run(lerna_cmd)
5959+6060+ HERE = Path(__file__).parent.parent.resolve()
6161+ path = HERE.joinpath("package.json")
6262+ if path.exists():
6363+ with path.open(mode="r") as f:
6464+ data = json.load(f)
6565+6666+ data["version"] = js_version
6767+6868+ with path.open(mode="w") as f:
6969+ json.dump(data, f, indent=2)
7070+7171+ else:
7272+ raise FileNotFoundError(f"Could not find package.json under dir {path!s}")
567357745875if __name__ == "__main__":
+2-97
setup.py
···11-"""
22-jupyterlab_blockly setup
33-"""
44-import json
55-import sys
66-from pathlib import Path
77-88-import setuptools
99-1010-HERE = Path(__file__).parent.resolve()
1111-1212-# The name of the project
1313-name = "jupyterlab_blockly"
1414-1515-lab_path = (HERE / name.replace("-", "_") / "labextension")
1616-1717-# Representative files that should exist after a successful build
1818-ensured_targets = [
1919- str(lab_path / "package.json"),
2020- str(lab_path / "static/style.js")
2121-]
2222-2323-labext_name = "jupyterlab-blockly-extension"
2424-2525-data_files_spec = [
2626- ("share/jupyter/labextensions/%s" % labext_name, str(lab_path.relative_to(HERE)), "**"),
2727- ("share/jupyter/labextensions/%s" % labext_name, str("."), "install.json"),
2828-]
2929-3030-long_description = (HERE / "README.md").read_text()
3131-3232-# Get the package info from package.json
3333-pkg_json = json.loads((HERE / "packages/blockly-extension/package.json").read_bytes())
3434-version = (
3535- pkg_json["version"]
3636- .replace("-alpha.", "a")
3737- .replace("-beta.", "b")
3838- .replace("-rc.", "rc")
3939-)
4040-4141-setup_args = dict(
4242- name=name,
4343- version=version,
4444- url=pkg_json["homepage"],
4545- author=pkg_json["author"]["name"],
4646- author_email=pkg_json["author"]["email"],
4747- description=pkg_json["description"],
4848- license=pkg_json["license"],
4949- license_file="LICENSE",
5050- long_description=long_description,
5151- long_description_content_type="text/markdown",
5252- packages=setuptools.find_packages(),
5353- install_requires=[],
5454- extras_require={
5555- 'dev': ['click','jupyter_releaser==0.22']
5656- },
5757- zip_safe=False,
5858- include_package_data=True,
5959- python_requires=">=3.7",
6060- platforms="Linux, Mac OS X, Windows",
6161- keywords=["Jupyter", "JupyterLab", "JupyterLab3"],
6262- classifiers=[
6363- "License :: OSI Approved :: BSD License",
6464- "Programming Language :: Python",
6565- "Programming Language :: Python :: 3",
6666- "Programming Language :: Python :: 3.7",
6767- "Programming Language :: Python :: 3.8",
6868- "Programming Language :: Python :: 3.9",
6969- "Programming Language :: Python :: 3.10",
7070- "Framework :: Jupyter",
7171- "Framework :: Jupyter :: JupyterLab",
7272- "Framework :: Jupyter :: JupyterLab :: 3",
7373- "Framework :: Jupyter :: JupyterLab :: Extensions",
7474- "Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
7575- ],
7676-)
7777-7878-try:
7979- from jupyter_packaging import (
8080- wrap_installers,
8181- npm_builder,
8282- get_data_files
8383- )
8484- post_develop = npm_builder(
8585- build_cmd="install:extension", source_dir="src", build_dir=lab_path, npm='jlpm'
8686- )
8787- setup_args["cmdclass"] = wrap_installers(post_develop=post_develop, ensured_targets=ensured_targets)
8888- setup_args["data_files"] = get_data_files(data_files_spec)
8989-except ImportError as e:
9090- import logging
9191- logging.basicConfig(format="%(levelname)s: %(message)s")
9292- logging.warning("Build tool `jupyter-packaging` is missing. Install it with pip or conda.")
9393- if not ("--name" in sys.argv or "--version" in sys.argv):
9494- raise e
9595-9696-if __name__ == "__main__":
9797- setuptools.setup(**setup_args)
11+# setup.py shim for use with applications that require it.
22+__import__('setuptools').setup()