Add your description here
Project description
Package Management
This directory contains code used by the packages option in the CLI that upgrades packages in a project to a Fusion-compatible version. The code is centered on four classes:
- DbtPackageFile: represents a file (currently packages.yml or dependencies.yml) that contains package dependencies for a project
- DbtPackage: represents a package that is installed as a dependency for the project
- DbtPackageVersion: represents a specific version of a package
- DbtPackageTextFile: contains the raw lines of text from package dependency files. This is used when upgrading packages so we can replace just the version strings within a file without affecting the rest of the file layout (such as comments).
How the CLI works
The packages command calls the upgrade_packages function in main.py. This then calls:
generate_package_dependencies: extracts dependencies from project's packages.yml/dependencies.yml file and identifies installed package versions indbt_packages- Returns
DbtPackageFileif a packages.yml/dependencies.yml file is found and specifies at least one package; otherwise, None
- Returns
check_for_package_upgrades: traverses the dependencies inDbtPackageFileand for each package, determines if the current installed versions is Fusion compatible; if not, it looks for any Fusion-compatible versions of the package- Returns list of
PackageVersionUpgradeResult- Length should exactly match the number of packages in the
DbtPackageFile's dependencies
- Length should exactly match the number of packages in the
- Returns list of
upgrade_package_versions: takes thePackageVersionUpgradeResultlist and if any packages need updates, it identifies the required changes in packages.yml. For a dry run, it prints out the new packages.yml; otherwise, it actually makes the changes in the file.- Returns a single
PackageUpgradeResult
- Returns a single
print_to_consoleon thePackageUpgradeResult
upgrade_packages will generate an error if:
- the path specified in
--pathdoes not exist or isn't a directory generate_package_dependenciescan't find a packages.yml or dependencies.ymlgenerate_package_dependenciesfound a packages.yml or dependencies.yml but it didn't contain any package dependencies
Scripts
- Used to extract info used in package upgrade CLI:
get_package_hub_files.py: download package information from package hub (hub.getdbt.com) for all versions of all packages- Output:
package_output.json
- Output:
get_fusion_compatible_versions.py: loadspackage_output.jsonand summarizes Fusion compatibility across all versions for each package- Output:
fusion_version_compatibility_output.jsonandfusion_version_compatibility_output.py
- Output:
- Not used as an input to the package upgrade CLI:
packages_with_fusion_compatibility_changes.py: readsfusion_version_compatibility_output.pyand generates a CSV summary of packages for analytics use- Output:
packages.csv
- Output:
get_package_hub_files.py and get_fusion_compatible_version.py are used to pull data from the public package registry (hub.getdbt.com) and extract Fusion compatibility information from available versions. This is basically a local cache of package information to bootstrap autofix. We need to know the lower bound of Fusion-compatible versions for a package but we also know that older versions of packages will not change, so caching this locally removes a lot of repetitive network calls and text parsing. Which means faster run times and fewer failures due to network issues.
The output from these two scripts produces fusion_version_compatibility_output.py that contains a single constant, FUSION_VERSION_COMPATIBILITY_OUTPUT. This is then used in DbtPackage's merge_fusion_compatibility_output to populate compatible versions.
TODO
- Private packages
- Check require_dbt_version in installed private packages
- Need a way to match the dependency in packages.yml (since it doesn't have the name which is used for public packages)
- Match the version specifier type when upgrading packages
- Currently if the package config specifies a version like ">1.0.1" and we need to upgrade to 1.0.2, it gets replaced with "1.0.2"
- Should instead replace with same format like ">1.0.2"
- Get latest versions from package hub instead of using cache
- Better handling for version in package's dbt_project.yml
- Sometimes the version number in the package's dbt_project.yml doesn't actually match the release version because package hub only checks the release tag on Github, so the installed version check will set an incorrect version
- Added logic in DbtPackageFile will override the installed version if it's less than the config's version range, but this isn't 100% reliable
- Could instead refer to the package lock file to find the exact version
- But probably not a huge problem since we are only looking for the require dbt version anyway and only look for upgrades if it's missing/incompatible
- Move package parsing logic to hubcap or package hub where appropriate
- Explicit overrides at version level
- Currently in scripts/get_fusion_compatible_versions and DbtPackageVersion.is_version_explicitly_disallowed_on_fusion, but should refine logic
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbt_fusion_package_tools-0.20.0a1.tar.gz.
File metadata
- Download URL: dbt_fusion_package_tools-0.20.0a1.tar.gz
- Upload date:
- Size: 45.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2438596604ec5f25d8189b095dafb683be480227ebb3d4ea6032575eeffe1cb3
|
|
| MD5 |
6eab3bd1c4bcfbd1d812243fb0e8e49b
|
|
| BLAKE2b-256 |
9d711f4828a24d636c37e543692a776b3330be5196a459bf7e174a42ce78c2c4
|
Provenance
The following attestation bundles were made for dbt_fusion_package_tools-0.20.0a1.tar.gz:
Publisher:
release.yml on dbt-labs/dbt-autofix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_fusion_package_tools-0.20.0a1.tar.gz -
Subject digest:
2438596604ec5f25d8189b095dafb683be480227ebb3d4ea6032575eeffe1cb3 - Sigstore transparency entry: 963935364
- Sigstore integration time:
-
Permalink:
dbt-labs/dbt-autofix@4a54aa9ee916032b72e25ae039fd6a115b28497b -
Branch / Tag:
refs/tags/v0.20.0-alpha1 - Owner: https://github.com/dbt-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a54aa9ee916032b72e25ae039fd6a115b28497b -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbt_fusion_package_tools-0.20.0a1-py3-none-any.whl.
File metadata
- Download URL: dbt_fusion_package_tools-0.20.0a1-py3-none-any.whl
- Upload date:
- Size: 56.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6af5b88d8c274e5afdca301cb137b72772fe87a5b8db99409deefed7a833d472
|
|
| MD5 |
9d9a98088d2e56d24aabf02d7c2938b2
|
|
| BLAKE2b-256 |
8271e19c72d9365837cf0bb0570efedfd5b7cba3d59afe5c472fab6dbef899c2
|
Provenance
The following attestation bundles were made for dbt_fusion_package_tools-0.20.0a1-py3-none-any.whl:
Publisher:
release.yml on dbt-labs/dbt-autofix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_fusion_package_tools-0.20.0a1-py3-none-any.whl -
Subject digest:
6af5b88d8c274e5afdca301cb137b72772fe87a5b8db99409deefed7a833d472 - Sigstore transparency entry: 963935442
- Sigstore integration time:
-
Permalink:
dbt-labs/dbt-autofix@4a54aa9ee916032b72e25ae039fd6a115b28497b -
Branch / Tag:
refs/tags/v0.20.0-alpha1 - Owner: https://github.com/dbt-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a54aa9ee916032b72e25ae039fd6a115b28497b -
Trigger Event:
push
-
Statement type: