Skip to content

Commit 1a75f55

Browse files
authored
Add URL and description for federated extension data (#154)
* Add url and description for federated extension data * Rename to get_package_url
1 parent 6dbb5b3 commit 1a75f55

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

jupyterlab_server/config.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@
2525
DEFAULT_TEMPLATE_PATH = osp.join(osp.dirname(__file__), 'templates')
2626

2727

28+
def get_package_url(data):
29+
"""Get the url from the extension data
30+
"""
31+
# homepage, repository are optional
32+
if 'homepage' in data:
33+
url = data['homepage']
34+
elif 'repository' in data and isinstance(data['repository'], dict):
35+
url = data['repository'].get('url', '')
36+
else:
37+
url = ''
38+
return url
39+
40+
2841
def get_federated_extensions(labextensions_path):
2942
"""Get the metadata about federated extensions
3043
"""
@@ -39,6 +52,8 @@ def get_federated_extensions(labextensions_path):
3952
data = dict(
4053
name=pkgdata['name'],
4154
version=pkgdata['version'],
55+
description=pkgdata.get('description', ''),
56+
url=get_package_url(pkgdata),
4257
ext_dir=ext_dir,
4358
ext_path=osp.dirname(ext_path),
4459
is_local=False,

0 commit comments

Comments
 (0)