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

point latest version check to dbt-core package #4434

Merged
merged 1 commit into from
Dec 3, 2021

Conversation

nathaniel-may
Copy link
Contributor

Description

Because we renamed our package from dbt to dbt-core when we split out the adapters, our latest version check is wrong. Users will see this in the following message for v1.0.0:

% dbt --version
installed version: 1.0.0
   latest version: 0.21.1

Your version of dbt is ahead of the latest release!

Plugins:
  - snowflake: 1.0.0

You can manually check that this change works with the following python shell commands:

>>> import requests
>>> requests.get("https://pypi.org/pypi/dbt/json").json()['info']['version']
'0.21.1'
>>> requests.get("https://pypi.org/pypi/dbt-core/json").json()['info']['version']
'1.0.0'

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change

@cla-bot cla-bot bot added the cla:yes label Dec 3, 2021
@leahwicz
Copy link
Contributor

leahwicz commented Dec 3, 2021

CC: @jtcohen6 we probably want to patch this right away

@jtcohen6
Copy link
Contributor

jtcohen6 commented Dec 5, 2021

@leahwicz @nathaniel-may As soon as we push dbt==1.0.0 to PyPi — the one that will start raising a descriptive error on pip install dbt — then requests.get("https://pypi.org/pypi/dbt/json").json()['info']['version'] will start returning v1.0.0, right? And the resulting message (with current logic, before this change) will say Up to date!?

So:

  • I'm glad we've already fixed this for all future versions
  • We should actually be in ok shape for v1.0.0 specifically (we're not planning to update the package named dbt beyond that)
  • Now that plugin version numbers can differ slightly from dbt-core version numbers, this feels like a good opportunity to also add a compatibility check to dbt --version. Imagine something like:
% dbt --version
installed version: 1.0.1
   latest version: 1.0.1

Up to date!

Plugins:
  - snowflake: 1.0.0 — compatible

vs.

% dbt --version
installed version: 1.0.1
   latest version: 1.0.1

Up to date!

Plugins:
  - snowflake: 0.21.1 — not compatible!

@nathaniel-may
Copy link
Contributor Author

nathaniel-may commented Dec 6, 2021

@jtcohen6

then requests.get("https://pypi.org/pypi/dbt/json").json()['info']['version'] will start returning v1.0.0, right?

No. We pushed dbt-core@1.0.0 not dbt@1.0.0 so that line will return '0.21.1'. The python code in the description was run after we pushed to pypi. The reason we fixed it so fast is that when people download 1.0.0 today (try it!) it will say that their version is ahead of the latest. In order for it to say it's up-to-date we have to push 1.0.1 with this tiny change.

That being said, I definitely want to add the compatibility messaging.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Dec 6, 2021

@nathaniel-may Let's check in again after we push dbt==1.0.0 to PyPi (happening today). We didn't do this on Friday because it will break pipelines that (a) depend on unbounded pip install dbt, and (b) haven't heeded our warnings to date.

I'm thinking that, when we do, this (un-patched) code will start returning 1.0.0:

PYPI_VERSION_URL = 'https://pypi.org/pypi/dbt/json'
def get_latest_version():
try:
resp = requests.get(PYPI_VERSION_URL)
data = resp.json()
version_string = data['info']['version']
except (json.JSONDecodeError, KeyError, requests.RequestException):
return None
return dbt.semver.VersionSpecifier.from_version_string(version_string)

@nathaniel-may
Copy link
Contributor Author

@jtcohen6 we did it Friday. Is there something we should have done to handle unbounded pip install dbt that we should instead do today?

@jtcohen6
Copy link
Contributor

jtcohen6 commented Dec 6, 2021

@nathaniel-may
Copy link
Contributor Author

OH. You mean we plan on pushing 1.0.0 code to BOTH dbt and dbt-core. Unusual choice, but yes that will work. Sorry for the confusion.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Dec 6, 2021

Yeah! There's backstory for this in #4100

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

Successfully merging this pull request may close these issues.

3 participants