Skip to content

Consolidate package metadata and template others #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions conda/recipes/jupyterlab-nvdashboard/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{% set package_json = load_file_data("package.json") %}
{% set pyproject_toml = load_file_data("pyproject.toml") %}
Comment on lines +1 to +2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Conda recipe we can also load from package.json. So we do so here

We fallback to pyproject.toml for anything else


{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}

{% set python_min = "3.9" %}
{% set requires_python = pyproject_toml["project"]["requires-python"] %}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We reuse the Python requirement from pyproject.toml and use this below



package:
Expand All @@ -20,35 +23,32 @@ build:

requirements:
host:
- python {{ python_min }}
- python {{ requires_python }}
- pip
- nodejs
- hatch-jupyter-builder >=0.5
- hatch-nodejs-version >=0.3.2
- hatchling >=1.5.0
- jupyterlab >=4.0.0
{% for r in pyproject_toml["build-system"]["requires"] %}
- {{ r }}
{% endfor %}
Comment on lines 24 to +31
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the exception of some base requirements (python, pip & nodejs), we load all other build requirement from pyproject.toml

run:
- python >={{ python_min }}
- jupyterlab >=4.0.0
- psutil
- pynvml >=12.0.0,<13.0.0a0
- python {{ requires_python }}
{% for r in pyproject_toml["project"]["dependencies"] %}
- {{ r }}
{% endfor %}
Comment on lines 32 to +36
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We repeat the same process loading pyproject.toml's run requirements


test:
requires:
- python {{ python_min }}
- python {{ requires_python }}
- pip
commands:
- pip check
imports:
- jupyterlab_nvdashboard

about:
home: https://rapids.ai
license: BSD-3-Clause
license_family: BSD
home: {{ package_json["homepage"] }}
license: {{ package_json["license"] }}
license_file: ../../../LICENSE
summary: A JupyterLab extension for displaying dashboards of GPU usage
description: |
A JupyterLab extension for displaying dashboards of GPU usage.
doc_url: https://github.com/rapidsai/jupyterlab-nvdashboard
dev_url: https://github.com/rapidsai/jupyterlab-nvdashboard
summary: {{ package_json["description"] }}
description: {{ package_json["description"] }}
doc_url: {{ package_json["homepage"] }}
dev_url: {{ package_json["repository"]["url"] }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metadata is now loaded from package.json

2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies:
packages:
- hatch-jupyter-builder>=0.5
- hatch-nodejs-version>=0.3.2
- hatchling>=1.5.0
- hatchling>=1.27.0
- jupyterlab>=4.0.0
checks:
common:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": {
"url": "https://github.com/rapidsai/jupyterlab-nvdashboard/issues"
},
"license": "",
"license": "BSD-3-Clause",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fill this in as SPDX. This can be loaded with hatch-nodejs-version

"author": "NV Dashboard contributors",
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
Expand Down
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2025, NVIDIA CORPORATION.

[build-system]
requires = [
"hatch-jupyter-builder>=0.5",
"hatch-nodejs-version>=0.3.2",
"hatchling>=1.5.0",
"hatchling>=1.27.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hatch 1.27.0 added support for license files with PR: pypa/hatch#1829

Hence we bump the minimum version accordingly

"jupyterlab>=4.0.0",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit dependencies.yaml and run `rapids-dependency-file-generator`.
build-backend = "hatchling.build"

[project]
name = "jupyterlab_nvdashboard"
readme = "README.md"
license = { file = "LICENSE" }
license-files = [
"LICENSE",
]
Comment on lines -15 to +17
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We drop the license field as it now is pulled in from package.json

Also PEP 639 defined the spec for handling license files. So we use that here

requires-python = ">=3.9"
classifiers = [
"Framework :: Jupyter",
Expand All @@ -33,7 +35,7 @@ dependencies = [
"psutil",
"pynvml>=12.0.0,<13.0.0a0",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit dependencies.yaml and run `rapids-dependency-file-generator`.
dynamic = ["version", "description", "authors", "urls", "keywords"]
dynamic = ["version", "license", "description", "authors", "urls", "keywords"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note we now flag the license field as dynamic since hatch-nodejs-version fills it in for us


[project.optional-dependencies]
test = [
Expand All @@ -47,7 +49,7 @@ test = [
source = "nodejs"

[tool.hatch.metadata.hooks.nodejs]
fields = ["description", "authors", "urls"]
fields = ["license", "description", "authors", "urls"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the license added to package.json, we can now ask hatch-nodejs-version to pull it into pyproject.toml for us


[tool.hatch.build.targets.sdist]
artifacts = ["jupyterlab_nvdashboard/labextension"]
Expand Down