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

Why Loopback? #362

Open
cadojo opened this issue Oct 10, 2024 · 3 comments
Open

Why Loopback? #362

cadojo opened this issue Oct 10, 2024 · 3 comments

Comments

@cadojo
Copy link

cadojo commented Oct 10, 2024

I have recently moved a bunch of Julia packages into monorepo-like projects, and I've consequently had to submit PRs to the General registry to change the project repository locations, specify subdirectories, etc. I realized that all of the published versions for a given package are listed in the Versions.toml file in the registry, and I wondered why TagBot.jl uses a loop-back mechanism when all of the version hashes are available in the file?

For example, user @yakir12 on Discourse posted code which only depends on Pkg.jl which reads available package versions. With minimal modification I think this function does what we would need!

function available_versions(pkgname::AbstractString)
   registry = only(filter(r -> r.name == "General", Pkg.Registry.reachable_registries()))
   pkg = only(filter(pkg -> pkg.name == pkgname, collect(values(registry.pkgs))))
   vs = [ 
      pair.first => pair.second.git_tree_sha1 
      for pair in Pkg.Registry.registry_info(pkg).version_info 
   ]
   
   sort!(vs, by=x->x.first)
   
   return vs
end

I apologize if this is the wrong place to ask this question. If folks agree that reading Versions.toml would be more convenient, I would be interested in helping to contribute this feature / change.

@ericphanson
Copy link
Member

I believe the issue is that the hashes there are tree hashes, not commit hashes. There can be more than one commit that contains the given tree, so tagbot finds the right commit by looking up the registration PR. Tagbot needs the commit hash in order to make the git tag.

@DilumAluthge
Copy link
Member

Yeah, that's my understanding.

@cadojo
Copy link
Author

cadojo commented Dec 14, 2024

Yeah, I realized this as I tried to rewrite TagBot in Julia: ExperimentalTagBot.jl. I think I landed on using the PR title in the General registry to find the right commit. That isn't fully implemented yet, but the core functionality is there I think!

At some point in early 2025 I hope to give that another shot, if only to learn more about registries. If any of that code is useful here, that would be great. I think TagBot could be written in Julia with some slightly ugly manual parsing to replace jinja.

Edit: ExperimentalTagbot.jl is now a minimum-viable-implementation!

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

No branches or pull requests

3 participants