Git Product home page Git Product logo

Comments (5)

daveverwer avatar daveverwer commented on June 19, 2024

Partly as a quality thing, the fact that people can just add a Package.swift file to any repository seemed like a headache I could avoid. There's also the possibility that people will host elsewhere than GitHub, but honestly I think that's more of a theoretical advantage... πŸ˜‚

But, I also didn't realise that GitHub could be queried like that with GraphQL. It's interesting. In theory the algorithm should make all the terrible packages that the query may find fade away. I'll have a play with it.

My big hope longer term is that the GitHub Package Registry will have an API, and that people will add their packages there, and I can use that as a definitive source for packages. 🀞

from packagelist.

helje5 avatar helje5 commented on June 19, 2024

I would assume that the Registry API is just the GH API.
You should contact @kiliankoe about that, but i think the GH API has severe limitations on how often and how much you can query, don’t remember the details.
(btw: the above is just extracted from Kilians swift catalog ...)

from packagelist.

kiliankoe avatar kiliankoe commented on June 19, 2024

Hi πŸ‘‹

I used the following GraphQL query in apodidae to query for Swift packages on GitHub.

query ($query: String!) {
  search(query: $query, type: REPOSITORY, first: 100) {
  repositoryCount
  repositories: edges {
    node {
      ... on Repository {
        nameWithOwner
        description
        url
        isFork
        parent {
          nameWithOwner
        }
        isPrivate
        pushedAt
        license
        openIssues: issues(first: 0, states: OPEN) {
          totalCount
        }
        stargazers(first: 0) {
          totalCount
        }
        packageManifest: object(expression: "master:Package.swift") {
          ... on Blob {
            text
          }
        }
      }
    }
  }
}

It definitely has a big drawback though. GitHub's GraphQL schema doesn't allow me to specify any filters based on the existence of file types, so the best I can do is query for the existence of a package manifest and filter client-side. This obviously only works (I believe the limit on results was 100 repos) when also specifying Swift as the main repository language in the search query (not shown here), but that assumption doesn't hold up for all SwiftPM packages. Packages in other languages or with lots of bundled documentation will be missing entirely :/

from packagelist.

daveverwer avatar daveverwer commented on June 19, 2024

I would assume that the Registry API is just the GH API.

I think that's possible, but as the GPR is quite a big push for GitHub and that it's so ripe for needing tools built around and on top of it, I'm hoping it gets specific API methods for itself.

from packagelist.

daveverwer avatar daveverwer commented on June 19, 2024

πŸ‘‹ @kiliankoe!

It definitely has a big drawback though. GitHub's GraphQL schema doesn't allow me to specify any filters based on the existence of file types, so the best I can do is query for the existence of a package manifest and filter client-side. This obviously only works (I believe the limit on results was 100 repos) when also specifying Swift as the main repository language in the search query (not shown here), but that assumption doesn't hold up for all SwiftPM packages. Packages in other languages or with lots of bundled documentation will be missing entirely :/

This is such great information, thank you.

I think what I'd like to do is continue with the current JSON approach for now, at least until the Xcode 11 release in September and see what Apple/GitHub put out alongside that.

I have a hundred things I'd like to do with the actual metadata that will continue to make the search results better, and the JSON approach will work for now. I'm going to put this on ice for a bit until it's clearer what the GPR will be.

from packagelist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.