Repository navigation
Conversation
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
98ad5ea to
4317734
Compare
|
Is this something where we should actually request an |
| self.crate.mainEntity.append_to( | ||
| "url", f"https://nf-co.re/{self.crate.name.replace('nf-core/', '')}/{url}/", compact=True | ||
| ) | ||
| self.crate.mainEntity.append_to("url", f"{org_website}/{pipeline_short_name}/{url}/", compact=True) |
There was a problem hiding this comment.
Are we happy to assume that non-nf-core pipeline webistes use this structure and have a pipelines.json file?
There was a problem hiding this comment.
Converting back to draft because I've got an idea to tackle this
By the way there's a fallback in the code.
Those are the main questions indeed. There are two URL fields in the manifest: |
eduard-watchmaker
left a comment
There was a problem hiding this comment.
One regression and a few small things:
rocrate.py:194and:218: the template doesn't setdocsUrl, so nf-core pipelines use the default..rstrip("/")turns it intohttps://nf-co.re, so the Organization@id/urlandsdPublisherchange fromhttps://nf-co.re/. Every pipeline'sro-crate-metadata.jsonwould change at the next sync. Could the default stay as is, and the slash only be stripped when building paths?manifest.get(key, default)only falls back when the key is missing.docsUrl = ''ororganization = ''gives an empty@id. Usingmanifest.get("docsUrl") or "https://nf-co.re/"and computing it once would cover both.rocrate.py:239:topics = ["nf-core", "nextflow"]still tags every crate withnf-core.org_namewould fit the goal of the PR.- The new test checks only the Organization name and url. Assertions on
sdPublisher,mainEntity.url, the topics fetched from the mockedpipelines.json, and the default case would catch point 1.
This was generated assisted by Claude code and checked by me.
9bbca77 to
f5005aa
Compare
165fba8 to
d35a60b
Compare
|
Thanks @eduard-watchmaker !
|
eduard-watchmaker
left a comment
There was a problem hiding this comment.
Thanks, all points are addressed. Fair point on the trailing slash, as the crates change on every sync anyway.
This was generated assisted by Claude code and checked by me.
|
Hi. Requesting a new review as I've reworked the use of those two keys. |
eduard-watchmaker
left a comment
There was a problem hiding this comment.
Thanks Matthieu, pulling topics from GitHub is a nice simplification. The URL check doesn't filter anything yet, and the tests make real network calls. Details inline.
This was generated assisted by Claude code and checked by me.
| url = "/".join((org_website, pipeline_short_name, "dev" if self.version.endswith("dev") else self.version)) | ||
| try: | ||
| # Check that the URL is valid | ||
| response = requests.head(url, allow_redirects=True, timeout=10) |
There was a problem hiding this comment.
requests.head only raises on a connection error, not on a 404, so the URL is always added when the host is reachable. Something like if requests.head(url, allow_redirects=True, timeout=10).ok: would do what the PR says.
The tests don't mock requests.head, so test_rocrate_creation_uses_manifest_org_details makes a real HEAD to https://www.example.com/testpipeline/dev. That page is a 404, so the test only passes because of the missing status check. It would also fail offline. Could requests.head be mocked next to requests.get?
There was a problem hiding this comment.
Added if response.ok and updated the tests to mock HEAD too
| topics.append(org_short_name) | ||
| try: | ||
| response = requests.get("https://nf-co.re/pipelines.json", timeout=10) | ||
| response = requests.get(f"https://api.github.com/repos/{self.crate.name}/topics") |
There was a problem hiding this comment.
This has no timeout, unlike the other calls, and it's unauthenticated, so it's limited to 60 requests an hour. That limit is easy to hit on a sync across many pipelines. gh_api.safe_get from nf_core.github_api uses the token when one is set. If you switch to it, the test mock needs to follow.
There was a problem hiding this comment.
I've switched over to gh_api.safe_get here and in the name lookups !
| response = requests.get(f"https://api.github.com/repos/{self.crate.name}/topics") | ||
| response.raise_for_status() | ||
| remote_workflows = response.json()["remote_workflows"] | ||
| for topic in response.json().get("names"): |
There was a problem hiding this comment.
If the response has no names key, .get("names") returns None and the loop raises a TypeError. The except doesn't catch that. response.json()["names"] would go to the existing KeyError fallback.
…s.json hanging around
048e6d7 to
8b40cd7
Compare
|
Thank you for the review. I have addressed all the comments |
Alternative to #4146
My goal here is to make the RO-Crates more accurate by using actual correct org details (URL and name) for 3rd-party orgs that use the nf-core tooling. RO-Crates are indeed automatically updated by nf-core at every template update and version bump. Fixing them every time is quite time consuming.
This time, rather than introducing template parameters, I hijack existing manifest values:
/in the pipeline name (nf-core/testpipeline→nf-core) is used as the short name of the org.<docsUrl>/$pipeline_name/$version. The code tests those URLs with a http HEAD request and only includes it in the RO-Crate if valid.And simply use them instead of
https://nf-co.reandnf-core, while still defaulting to these values when the keys are not present in the manifest. This way, in usual nf-core pipelines, since these are not used, nothing changes. And external orgs now have the possibility to define them as they wish.This makes the change much shorter, with far less maintenance burden than my previous attempt.
PR checklist
CHANGELOG.mdis updateddocsis updated