diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cded0fe9..6bcea850 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,41 +13,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install node - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - architecture: 'x64' - - - name: Setup pip cache - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip-3.9-${{ hashFiles('setup.cfg') }} - restore-keys: | - pip-3.9- - pip- - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Setup yarn cache - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - yarn- + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Install dependencies run: python -m pip install jupyterlab + - name: Build the extension run: | jlpm diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index 5f6f2322..7ecca4df 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -15,41 +15,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - architecture: 'x64' - - name: Install node - uses: actions/setup-node@v2 - with: - node-version: '14.x' - - name: Get pip cache dir - id: pip-cache - run: | - echo "::set-output name=dir::$(pip cache dir)" - - name: Cache pip - uses: actions/cache@v1 - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Cache checked links - uses: actions/cache@v2 - with: - path: ~/.cache/pytest-link-check - key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links - restore-keys: | - ${{ runner.os }}-linkcheck- - - name: Upgrade packaging dependencies - run: | - pip install --upgrade pip setuptools wheel jupyter-packaging~=0.10 --user - - name: Install Dependencies - run: | - pip install . + uses: actions/checkout@v3 + + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - name: Check Release - uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1 + uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 with: token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Distributions + uses: actions/upload-artifact@v2 + with: + name: jupyterlab-link-share-releaser-dist-${{ '{{ github.run_number }}' }} + path: .jupyter_releaser_checkout/dist diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 77511c1b..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,24 +0,0 @@ -include LICENSE -include *.md -include pyproject.toml -include jupyter-config/jupyter_server_config.d/jupyterlab_link_share.json -include jupyter-config/jupyter_notebook_config.d/jupyterlab_link_share.json - -include package.json -include install.json -include ts*.json - -graft jupyterlab_link_share/labextension - -# Javascript files -graft src -graft style -prune **/node_modules -prune lib - -# Patterns to exclude from any directory -global-exclude *~ -global-exclude *.pyc -global-exclude *.pyo -global-exclude .git -global-exclude .ipynb_checkpoints diff --git a/jupyterlab_link_share/_version.py b/jupyterlab_link_share/_version.py index b96d38b7..322dab51 100644 --- a/jupyterlab_link_share/_version.py +++ b/jupyterlab_link_share/_version.py @@ -1,19 +1,5 @@ -import json -from pathlib import Path - -__all__ = ["__version__"] - -def _fetchVersion(): - HERE = Path(__file__).parent.resolve() - - for settings in HERE.rglob("package.json"): - try: - with settings.open() as f: - return json.load(f)["version"] - except FileNotFoundError: - pass - - raise FileNotFoundError(f"Could not find package.json under dir {HERE!s}") - -__version__ = _fetchVersion() - +# -*- coding: utf-8 -*- +# This file is auto-generated by Hatchling. As such, do not: +# - modify +# - track in version control e.g. be sure to add to .gitignore +__version__ = VERSION = '0.2.4' diff --git a/package.json b/package.json index 1fd174c7..85e30fd9 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,10 @@ "url": "https://github.com/jupyterlab-contrib/jupyterlab-link-share/issues" }, "license": "BSD-3-Clause", - "author": "Project Jupyter Contributors", + "author": { + "name": "Project Jupyter Contributors", + "email": "" + }, "files": [ "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}", "style/**/*.{css,.js,eot,gif,html,jpg,json,png,svg,woff2,ttf}" diff --git a/pyproject.toml b/pyproject.toml index 89d47e4b..df48ea80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,73 @@ [build-system] -requires = ["jupyter_packaging~=0.10", "jupyterlab~=3.0"] -build-backend = "jupyter_packaging.build_api" +requires = ["hatchling>=1.4.0", "jupyterlab>=3.4.7,<4.0.0", "hatch-nodejs-version"] +build-backend = "hatchling.build" -[license] -file="LICENSE" +[project] +name = "jupyterlab_link_share" +readme = "README.md" +license = { file = "LICENSE" } +requires-python = ">=3.7" +classifiers = [ + "Framework :: Jupyter", + "Framework :: Jupyter :: JupyterLab", + "Framework :: Jupyter :: JupyterLab :: 3", + "Framework :: Jupyter :: JupyterLab :: Extensions", + "Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +dependencies = [ + "jupyter_server>=1.6,<3" +] +dynamic = ["version", "description", "authors", "urls", "keywords"] -[tool.jupyter-packaging.options] -skip-if-exists = ["jupyterlab_link_share/labextension/static/style.js"] -ensured-targets = ["jupyterlab_link_share/labextension/static/style.js", "jupyterlab_link_share/labextension/package.json"] +[project.optional-dependencies] +test = [ +] + +[tool.hatch.version] +source = "nodejs" + +[tool.hatch.metadata.hooks.nodejs] +fields = ["description", "authors", "urls"] + +[tool.hatch.build.targets.sdist] +artifacts = ["jupyterlab_link_share/labextension"] +exclude = [".github", "binder"] + +[tool.hatch.build.targets.wheel.shared-data] +"jupyterlab_link_share/labextension" = "share/jupyter/labextensions/jupyterlab-link-share" +"install.json" = "share/jupyter/labextensions/jupyterlab-link-share/install.json" +"jupyter-config/jupyter_server_config.d" = "etc/jupyter/jupyter_server_config.d" +"jupyter-config/jupyter_notebook_config.d" = "etc/jupyter/jupyter_notebook_config.d" -[tool.jupyter-packaging.builder] -factory = "jupyter_packaging.npm_builder" +[tool.hatch.build.hooks.version] +path = "jupyterlab_link_share/_version.py" -[tool.jupyter-packaging.build-args] +[tool.hatch.build.hooks.jupyter-builder] +dependencies = ["hatch-jupyter-builder>=0.5"] +build-function = "hatch_jupyter_builder.npm_builder" +ensured-targets = [ + "jupyterlab_link_share/labextension/static/style.js", + "jupyterlab_link_share/labextension/package.json", +] +skip-if-exists = ["jupyterlab_link_share/labextension/static/style.js"] + +[tool.hatch.build.hooks.jupyter-builder.build-kwargs] build_cmd = "build:prod" npm = ["jlpm"] -[tool.check-manifest] -ignore = [".binder/**", "*.json", "yarn.lock", ".*", "jupyterlab_link_share/labextension/**"] +[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs] +build_cmd = "install:extension" +npm = ["jlpm"] +source_dir = "src" +build_dir = "jupyterlab_link_share/labextension" + +[tool.jupyter-releaser.options] +version_cmd = "hatch version" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8dd3674c..00000000 --- a/setup.cfg +++ /dev/null @@ -1,34 +0,0 @@ -[metadata] -name = jupyterlab-link-share -description = JupyterLab Extension to share the URL to a running Jupyter Server -long_description = file: README.md -long_description_content_type = text/markdown -license_file = LICENSE -author = Projet Jupyter Contributors -url = https://github.com/jupyterlab-contrib/jupyterlab-link-share -platforms = Linux, Mac OS X, Windows -keywords = Jupyter, JupyterLab, Widgets, IPython -classifiers = - Intended Audience :: Developers - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Framework :: Jupyter - Framework :: Jupyter :: JupyterLab - Framework :: Jupyter :: JupyterLab :: 3 - Framework :: Jupyter :: JupyterLab :: Extensions - Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt - -[options] -zip_safe = False -include_package_data = True -packages = find: -python_requires = >=3.7 -install_requires = - jupyter_server>=1.11,<3 diff --git a/setup.py b/setup.py index e9f4d5d9..b6c66813 100644 --- a/setup.py +++ b/setup.py @@ -1,64 +1,2 @@ -""" -jupyterlab-link-share setup -""" -import json -from pathlib import Path - -import setuptools - -HERE = Path(__file__).parent.resolve() - -# The name of the project -name = "jupyterlab-link-share" -package = name.replace('-', '_') - -lab_path = HERE / package / "labextension" - -# Representative files that should exist after a successful build -ensured_targets = [ - str(lab_path / "package.json"), - str(lab_path / "static" / "style.js"), -] - -package_data_spec = {package: ["*"]} - -labext_name = "jupyterlab-link-share" - -data_files_spec = [ - ("share/jupyter/labextensions/%s" % labext_name, str(lab_path), "**"), - ("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"), - ( - "etc/jupyter/jupyter_server_config.d", - "jupyter-config/jupyter_server_config.d", - "jupyterlab_link_share.json", - ), - ( - "etc/jupyter/jupyter_notebook_config.d", - "jupyter-config/jupyter_notebook_config.d", - "jupyterlab_link_share.json", - ), -] - - -# Get the package info from package.json -pkg_json = json.loads((HERE / "package.json").read_bytes()) - -try: - from jupyter_packaging import wrap_installers, npm_builder, get_data_files - - # In develop mode, just run yarn - builder = npm_builder(build_cmd="build", build_dir=lab_path, source_dir="src") - cmdclass = wrap_installers(post_develop=builder, ensured_targets=ensured_targets) - - setup_args = dict( - cmdclass=cmdclass, - data_files=get_data_files(data_files_spec), - ) -except ImportError: - setup_args = dict() - - -setup_args["version"] = pkg_json["version"] - -if __name__ == "__main__": - setuptools.setup(**setup_args) \ No newline at end of file +# setup.py shim for use with applications that require it. +__import__("setuptools").setup()