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

fix: Use importlib.metadata.version() to remove implicit dependency on setuptools #399

Merged
merged 2 commits into from
Sep 7, 2023

Conversation

skirino
Copy link
Contributor

@skirino skirino commented Sep 6, 2023

Description

  • Currently dbt-athena implicitly depends on setuptools as it imports pkg_resources.
  • Use importlib.metadata instead to remove the implicit dependency.

Our context

  • We are using bazel with rules_python in our project. We need to tell bazel the exact set of dependencies of our application (including commonly-used libraries such as setuptools).
  • dbt-athena currently does not declare setuptools as a dependency, so bazel and rules_python do not know the fact that setuptools is needed in our application (which depends on dbt-athena). This leads to errors when loading dbt.adapters.athena.
  • Adding setuptools as a dependency of dbt-athena in setup.py is a possible solution, but I think it's simpler to use the stdlib API and remove the dependency.

Models used to test - Optional

None

Checklist

  • You followed contributing section
  • You kept your Pull Request small and focused on a single feature or bug fix.
  • You added unit testing when necessary : (the existing test already covers the changed code)
  • You added functional testing when necessary

@nicor88 nicor88 added the enable-functional-tests Label to trigger functional testing label Sep 7, 2023
@nicor88 nicor88 merged commit 23478ef into dbt-labs:main Sep 7, 2023
8 checks passed
@skirino skirino deleted the use_importlib_metadata branch September 8, 2023 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enable-functional-tests Label to trigger functional testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants