Skip to content
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

Add repository info when getting federated extensions #417

Merged

Conversation

nbowditch-einblick
Copy link
Contributor

References

#416 Add repository url to extension info

Code changes

  • Adds missing repository field to values returned by get_federated_extensions if it's available in relevant package.json (and if it contains a "url" field)

Copy link

welcome bot commented Oct 31, 2023

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@fcollonval fcollonval added the bug label Nov 7, 2023
@fcollonval
Copy link
Member

Thanks @nbowditch-einblick

Is the url defined there not properly set up and used there?

@nbowditch-einblick
Copy link
Contributor Author

nbowditch-einblick commented Nov 7, 2023

Thanks @nbowditch-einblick

Is the url defined there not properly set up and used there?

Thanks for the response!

The url field is indeed correctly set with the value of homepage in our package.json file. However, the issue is that we have a non-github url for our homepage. In our case, we have a landing page we're going to host on our company's site to use as a homepage, but I've also seen other extensions use their pypi page as a homepage. It seems reasonable that these urls might be different, i.e., that the package's homepage might be different from its github/repo url.

In the logic on the front-end side, it should be able to use either a homepage or repository_url field to get a github user uri:

function getExtensionGitHubUser(entry: IEntry) {
  if (
    entry.homepage_url &&
    entry.homepage_url.startsWith('https://github.com/')
  ) {
    return entry.homepage_url.split('/')[3];
  } else if (
    entry.repository_url &&
    entry.repository_url.startsWith('https://github.com/')
  ) {
    return entry.repository_url.split('/')[3];
  }
  return null;
}

The object being read in that front-end logic from there is constructed in manager.py in jupyterlab's repo, here. Note that to assign the value of homepage, it uses url, and to assign the value of repository_url, it attempts to read from a repository.url dict, which given the current logic of the function here, won't ever be set.

The url field seems a bit ambiguous, I'm not sure I agree with how it can pull from either the homepage or repository.url in a given package.json file. It seems useful to have distinct definitions for each url. That being said, I don't what other logic uses this as a dependency; it might be more appropriate in other contexts.

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Thanks @nbowditch-einblick for this and the very detailed information.

@fcollonval fcollonval enabled auto-merge (squash) November 8, 2023 10:58
@fcollonval fcollonval merged commit 641ddbe into jupyterlab:main Nov 8, 2023
27 checks passed
Copy link

welcome bot commented Nov 8, 2023

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants