-
Notifications
You must be signed in to change notification settings - Fork 79
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
Conversation
cffe168
to
f6e34b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added some notes below to describe the changes here
Generally the goal is to have metadata in a central place (mainly package.json
followed by pyproject.toml
)
This should make it easier to keep things in sync across package formats. Making maintenance of package metadata simpler
@@ -11,7 +11,7 @@ | |||
"bugs": { | |||
"url": "https://github.com/rapidsai/jupyterlab-nvdashboard/issues" | |||
}, | |||
"license": "", | |||
"license": "BSD-3-Clause", |
There was a problem hiding this comment.
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
@@ -47,7 +49,7 @@ test = [ | |||
source = "nodejs" | |||
|
|||
[tool.hatch.metadata.hooks.nodejs] | |||
fields = ["description", "authors", "urls"] | |||
fields = ["license", "description", "authors", "urls"] |
There was a problem hiding this comment.
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
@@ -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"] |
There was a problem hiding this comment.
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
license = { file = "LICENSE" } | ||
license-files = [ | ||
"LICENSE", | ||
] |
There was a problem hiding this comment.
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
|
||
[build-system] | ||
requires = [ | ||
"hatch-jupyter-builder>=0.5", | ||
"hatch-nodejs-version>=0.3.2", | ||
"hatchling>=1.5.0", | ||
"hatchling>=1.27.0", |
There was a problem hiding this comment.
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
{% set package_json = load_file_data("package.json") %} | ||
{% set pyproject_toml = load_file_data("pyproject.toml") %} |
There was a problem hiding this comment.
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"] %} |
There was a problem hiding this comment.
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
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 %} |
There was a problem hiding this comment.
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 %} |
There was a problem hiding this comment.
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
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"] }} |
There was a problem hiding this comment.
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
* Add more metadata into `package.json` * Rely on hatch nodejs plugins to fill in `pyproject.toml` * Template Conda recipe with metadata * Prefer `package.json` first (primary source of truth) * Fallback to `pyproject.toml` second * Manually write the rest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks @jakirkham
Thanks all! 🙏 |
package.json
pyproject.toml
package.json
first (primary source of truth)pyproject.toml
second