-
Notifications
You must be signed in to change notification settings - Fork 73
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
Support Git references in subset merger #987
Support Git references in subset merger #987
Conversation
This is good, but:
|
Sure, I can do that. Or we could do pip-like syntax and have repo support something like
They're to be able to use lowercase type hints for collections in Python 3.8 IIRC, e.g. from __future__ import annotations
def foo(bar: dict[str, str]):
pass Instead of needing from typing import Dict
def foo(bar: Dict[str, str]):
pass |
I like that.
Hmm. OK, fair enough! |
Is there any testing that covers the subset merger or I've used it locally through gftools' builder to make sure it works |
The Noto recipe builder uses it, so it's tested through there. But here's a thought. I can see a strong case for there to be an option to download the source of the latest tagged release. We do this already in gftools-packager when uploading a font from a downstream repository to google/fonts: gftools/Lib/gftools/packager/__init__.py Lines 252 to 259 in c14661a
That's an option which would be useful for Noto, and potentially for a project that you might be working on: when a rebuild of the language-based font is triggered, the build automatically picks up any stable updates from the subset donor font, without including any unreleased development state. |
Yes, that could be good. I'll take a look at making a special case for |
Fun niggle: using the GitHub API for the zipball download link downloads a zip that has the inner top-level folder named with a completely different convention to usual Normally, it's Would you rather I make another API call to get the tag SHA and can properly recreate the inner folder name for precise extraction, or shall I just hack something to make it work? (*where if the tag name began with a "v" and looked like a version, the "v" has been stripped) |
There's only one top-level folder, right? So I guess you can just glob for it. |
e380711
to
ba57a45
Compare
In YAML, you can now do: repo: slug: notofonts/latin-greek-cyrillic ref: e7f1736c5ad0dc2abfc4dcd49ebca50abf612b29 Where before repo could only take a string (being the repo slug) This is still supported with the old behaviour of assuming you want the latest of the branch
Keep the repo key as a string, interpret anything after @ as the git ref
Add GitHubClient.get_latest_tag_name() This massively simplifies code paths and doesn't require SubsetMerger.download_for_subsetting to have to do more than it should This also allows us to know the name of the top level folder within the zip file in all scenarios download_for_subsetting code is now a fair bit simpler and far more similar to before the ref feature was added
cbf704e
to
53ee046
Compare
@simoncozens (or @m4rc1e) any going concerns that'd prevent this PR from getting merged soon? I think it's in a good state; just updated the original post description to reflect the current state of the feature |
Closes #986
In YAML, you can now do:
Which can take any git reference, or the special value "latest" which grabs the tag from the latest GitHub release
These are appropriately cached in separate folders for org/repo/ref
Support for this is has also been incorporated into
add-ds-subsets
, and I've sprinkled in some type hints in parts of the codebase I've visitedOld PR description (outdated)
In YAML, you can now do:
Where before repo could only take a string (being the repo slug). This is still supported with the old behaviour of assuming you want the latest of the branch
The cache path was previously just the repo slug, but is now the slug + ref, e.g.
notofonts/latin-greek-cyrillic/main
I've added a corresponding
--git-ref
togftools-add-ds-subsets
to expose this feature to the CLI as wellOpening this PR early without tests etc. to make sure the approach & code style are acceptable - such as the smidge of type hinting I added
Let me know your thoughts!