Skip to content

Commit

Permalink
Better dbt packages version logging to aid in upgrading outdated pack…
Browse files Browse the repository at this point in the history
…ages (#3759)

* start blueprinting changes

* extend registry handler for latest package version

* conditional logging for latest version

* remove todo

* add conditional logging

* Upgrades is clearer

* update if elif conditions and log msg

* remove TODO

* fix flake8 errors

* blueprint unit tests

* conditions specific to hub registry

* 1 passing test for get latest version

* DRY method calls

* move version latest to hub only

* add a new line

* remove other draft tests

* update changelog

* update log language for clarity

* pass flake8

* fix changelog

* Update test/unit/test_deps.py

Co-authored-by: Jeremy Cohen <jeremy@fishtownanalytics.com>

* update changelog

* remove hub language

* sort for latest version and include prereleases

* fix flake8

* resolves another issue

* fix prerelease string formatting

* fix broken test

* update logging to past tense

* built-in version sorting

* handle prereleases for latest version checks

* get version latest unit test based on prerelease

* update unit test for sorting functionality

* consistent test names

* fix flake8

* clean up contributors list

* simplify if else logic

Co-authored-by: Jeremy Cohen <jeremy@fishtownanalytics.com>

automatic commit by git-black, original commits:
  51a76d0
  • Loading branch information
sungchun12 authored and iknox-fa committed Feb 8, 2022
1 parent 4bd0687 commit 09cbfd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 4 additions & 6 deletions core/dbt/deps/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ def source_type(self) -> str:


class RegistryPinnedPackage(RegistryPackageMixin, PinnedPackage):
def __init__(self,
package: str,
version: str,
version_latest: str) -> None:
def __init__(self, package: str, version: str, version_latest: str) -> None:
super().__init__(package)
self.version = version
self.version_latest = version_latest
Expand Down Expand Up @@ -148,5 +145,6 @@ def resolved(self) -> RegistryPinnedPackage:
target = semver.resolve_to_specific_version(range_, installable)
if not target:
package_version_not_found(self.package, range_, installable)
return RegistryPinnedPackage(package=self.package, version=target,
version_latest=available_latest)
return RegistryPinnedPackage(
package=self.package, version=target, version_latest=available_latest
)
7 changes: 3 additions & 4 deletions core/dbt/task/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run(self):
fire_event(DepsStartPackageInstall(package_name=package_name))
package.install(self.config, renderer)
fire_event(DepsInstallInfo(version_name=package.nice_version_name()))
if source_type == 'hub':
if source_type == "hub":
version_latest = package.get_version_latest()
if version_latest != version:
packages_to_upgrade.append(package_name)
Expand All @@ -75,9 +75,8 @@ def run(self):
fire_event(DepsListSubdirectory(subdirectory=package.get_subdirectory()))

self.track_package_install(
package_name=package_name,
source_type=source_type,
version=version)
package_name=package_name, source_type=source_type, version=version
)
if packages_to_upgrade:
fire_event(EmptyLine())
fire_event(DepsNotifyUpdatesAvailable(packages=packages_to_upgrade))
Expand Down

0 comments on commit 09cbfd2

Please sign in to comment.