-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add require_dbt_version
to Hub API
#146
Conversation
hubcap/records.py
Outdated
@@ -176,7 +177,7 @@ def make_spec(self, org, repo, package_name, packages, version): | |||
"version": version, | |||
"published_at": "1970-01-01T00:00:00.000000+00:00", | |||
"packages": packages, | |||
"works_with": [], | |||
"works_with": require_dbt_version, |
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.
require-dbt-version
can be a string or a list (docs), so the resulting value in the Hub API can be a string or a list.
I added logic to handle this within dbt-core
, rather than having that logic live here (= turning string
into [string]
).
I'd be keen to call it |
I think so, yeah! |
require-dbt-version
-> works_with
require_dbt_version
to Hub 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.
This looks good!
Note that this will not work unless
require-dbt-version
is a valid semver string/list (as documented), so we probably want to add some validation logic to that effect.
I don't see this anywhere; what are the consequences of an invalid string? Does dbt throw an exception if required version is something non semver, or does it ignore it?
I assume it ignores it and runs as normal? Which is ok to me, the only part that offend me on a principled level is that we might put inaccurate data into a long lived json file.
Throwing an exception is the current behavior in dbt-labs/dbt-core#5651. So if it finds
But I could definitely switch it to just start ignoring FWIW, that's the same exception the package author would see any time they try running that package/project with an invalid Once this PR is merged, I'm not sure of the right way to go about updating / re-deploying all existing package versions. |
Exceptions at development time are even better! The reason I was at peace with it was mostly practical: we don't have a practical way to auto-open an issue against a misbehaving repo to warn them, and I didn't want the dbt team to keep getting pings about packages that we have no control over.
Is it not just this but everywhere? dbt-labs/hub.getdbt.com#1770 ? |
You're right, it is just that but everywhere :) I took some shortcuts / creative liberties to prepare that PR, by running modified components from Hubcap locally. Could do the same thing but more. |
Yep, I think you are exactly right about dbt-labs/hub.getdbt.com#1770 being the exemplar, @joellabes. When a pull request like that is merged in the |
Yes, more (locally modified) cowbell should do the trick here. 🐮 Side note: I suspect the same general strategy will be needed if dbt-labs/hubcap #95 goes forward. |
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 diving into this across like three different repos @jtcohen6 !
To connect the dots for those interested, here are two other related pull requests:
This particular PR will generate JSON blobs like this (require_dbt_version
being the new key+values):
"id": "dbt-labs/dbt_utils/0.8.6",
"name": "dbt_utils",
"version": "0.8.6",
"published_at": "1970-01-01T00:00:00.000000+00:00",
"packages": [],
"require_dbt_version": [
">=1.0.0",
"<2.0.0"
],
"works_with": [],
"_source": {
"type": "github",
I'm going to merge this one first. It won't be breaking for any existing versions of |
resolves dbt-labs/hub.getdbt.com#165
What isworks_with
used for? Is this the old name forpackages
? It's not being used for anything by recent versions ofdbt-core
.I've added a totally new field to the hub API (
require_dbt_version
).I just started by reusing the existing field for expediency.I tested the simple methods locally, against
dbt_project.yml
files that do and don't haverequire-dbt-version
defined. Note that this will not work unlessrequire-dbt-version
is a valid semver string/list (as documented), so we probably want to add some validation logic to that effect.As far as moving forward with this: