-
Notifications
You must be signed in to change notification settings - Fork 136
Implement git submodules for specs
#182
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
Implement git submodules for specs
#182
Conversation
|
closes #181 |
|
@anatoly-scherbakov let's give this a try. Can you expand the README in this PR also to explain what the pre-testing steps would include now (i.e. It would be great to simplify testing. Thanks for exploring this idea! |
|
@BigBlueHat @davidlehn My apologies for the delay; I think I have something to show here now. |
|
Hey @anatoly-scherbakov, Sorry for the delay here. I continue to feel a bit squeamish about using git submodules. It's not a pattern we typically use in our other implementations, and it's a rarely used (and oft derided...) git feature. I'm also concerned about the overhead of keeping the sha's pinned accurately. However, I did find that the jsonld.js implementation has a nice approach to this same problem using npm run commands: https://github.com/digitalbazaar/jsonld.js/blob/main/package.json#L96-L101 My thought is that we could do something similar here by providing a simple Python script that would run the Would you be up for taking a crack at that? |
|
@BigBlueHat thank you for your review. I understand the concern but might disagree in certain regards, let me try to elaborate on them. Let's analyze the approach taken at "fetch-json-ld-org-test-suite": "if [ ! -e test-suites/json-ld.org ]; then git clone --depth 1 https://github.com/json-ld/json-ld.org.git test-suites/json-ld.org; fi",What happens if JSON-LD test suite is updated?
I feel these cases can be very annoying and might hurt developer productivity. Update of the spec version is not tied to an explicit human decision, which goes against normal practice for dependencies in many environments.
Git submodules essentially provide the same level of control over the version of dependencies. It is easy to provide a I'll add it in a moment in another commit. This will upgrade each submodule to its latest version; afterwards, the developer can run tests, make sure everything is 🟢, and submit to CI. As to the popularity of git submodules, — quick search on Github returns a few popular projects relying upon them: Let me know what you think! |
|
P. S. To address the concern about testing python tests/runtests.py ~/projects/json-ld-api…as documented in |
|
@anatoly-scherbakov coming back to this again--sorry for the wait. The experience of using the submodules was fine--not much different than the experience of using the approach we took in jsonld.js, so I'm fine with it. @davidlehn unless you're diametrically opposed to this, I'd like to get it merged sooner than later. |
BigBlueHat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small tweak which isn't a blocker--and could be done later--so approving.
|
Thanks for the review @BigBlueHat! I am writing an issue about the This might be also related to me being unable to create a PR in this repository which has another PR as its base. |
| @@ -0,0 +1,11 @@ | |||
| [submodule "specifications/json-ld-api"] | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the specs, but since their sole purpose here is for testing, could this be named test-suites/? That's what the scripts in jsonld.js use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing!
I can rename those. A few things concern me a bit though:
- Each repository we're checking out contains not just tests but the whole specification, which might be confusing and violate the principle of least surprise;
- We will likely add more tests to the
testsdirectory which will not be using the specifications, and the existence of bothtestsandtest-suiteswill be confusing; - At some point, we might want to use the specifications for other purposes than tests, for instance, to aid documentation generation, or something.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the specifications/ folder name, as I do hope/expect we'll get more unit tests added to tests/ at some point, and test-suites/ would certainly be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree keeping specifications/, but should we not place it under tests/?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mielvds this will mean there will be a path like tests/specifications/json-ld-api/tests/, lots of nesting. Also... what if we want to reuse specifications for different purposes other than tests?
For instance, they could be extremely useful for LLM-assisted work on the library because specs are authoritatitve.
| @@ -0,0 +1,2 @@ | |||
| upgrade-submodules: | |||
| git submodule update --remote --init --recursive | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you remove all the checked out dirs without leaving git thinking there are unstaged changes? Put another way, how do you undo this command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to undo the version upgrade of the submodules, you can do:
git reset --hard
If you've modified the submodules locally, after having them upgraded (for debugging purposes perhaps) then you do:
git submodule foreach git reset --hard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add those to the makefile for convenience?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- During a normal workflow, I guess modification of submodules won't happen often.
reset --hardis a destructive operation, not sure if we should create a shortcut for it 🤔
|
|
@anatoly-scherbakov Could you also change the commit message with the fancy "+" and one with ellipses, arrow, and math symbol to use simple ASCII? Nicer to use chars people can easily type. Feel free to argue. :-) |
5798f0b to
440a251
Compare
|
@davidlehn thanks again for the review! I have applied a few requested changes.
Yes! I feel that less documentation and more automation is for the better :)
Tools like Dependabot, which post notifications about out-of-date dependencies and even create PRs automatically, are often leveraged. I think I can easily imagine a rather simple scheduled GitHub actions workflow that will update the specs submodules every week, run the tests, and create a PR with that upgrade. Do you think we should create an issue for that?
I see. The
No argument here: I just like those fancy Unicode characters, especially putting them into commit messages 🙂 , and have setup my Linux to easily type them, but this is purely a matter of taste. Removed ✅ |
Co-authored-by: Anatoly Scherbakov <altaisoft@gmail.com>
Co-authored-by: David I. Lehn <dil@lehn.org>
440a251 to
c195dcd
Compare
|
I've rebased this branch on top of #185. |
This should be the correct location of the old tests suites: So, still needs an updated URL in this (or another) PR. The Sorry I didn't see that earlier! |
Should we replace |
Yeah...I think we need to add |
b9d25d6 to
5dba5aa
Compare
|
I understand @davidlehn 's concerns; submodules can be a hassle. That said, the support for submodules has improved a lot over the years and, in this case, they solve the version alignment between repos. Technically, you can do this with |
01fe0f8 to
f9772ea
Compare
# Conflicts: # .github/workflows/main.yaml # CHANGELOG.md # README.rst
|
I created a replacement PR in the main repo instead of my fork. Closing this one. |
Alleviate the step of manually downloading specifications for tests to use them. Instead, put specifications into a dedicated directory using Git submodules mechanism.