Skip to content

Use package metadata for pydeequ version#267

Draft
Mirochill wants to merge 1 commit into
awslabs:masterfrom
Mirochill:fix-239-package-version
Draft

Use package metadata for pydeequ version#267
Mirochill wants to merge 1 commit into
awslabs:masterfrom
Mirochill:fix-239-package-version

Conversation

@Mirochill
Copy link
Copy Markdown

Issue #, if available:
Closes #239

Description of changes:

  • derive pydeequ.__version__ from installed package metadata instead of a stale hardcoded string
  • add a regression test that compares pydeequ.__version__ with importlib.metadata.version(pydeequ)

Validation:

  • git diff --check HEAD~1..HEAD
  • static review of pydeequ/__init__.py and tests/test_version.py
  • Tests not run locally

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Generated by AI (model: us.anthropic.claude-opus-4-6-v1, prompt: 416310f3) — may not be fully accurate. Reply if this doesn't help.

Comment thread pydeequ/__init__.py
__version__ = "1.2.0"
from importlib.metadata import version

__version__ = version("pydeequ")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDGE_CASE: importlib.metadata.version("pydeequ") will raise PackageNotFoundError if the package is not installed in the environment (e.g., running from source checkout without pip install -e .). This makes the module completely unimportable in that scenario, whereas the previous hardcoded string always worked. Consider wrapping in a try/except to fall back gracefully.

Line 17: __version__ = version("pydeequ")importlib.metadata.version() raises importlib.metadata.PackageNotFoundError (a subclass of ModuleNotFoundError) when the distribution is not found. A developer cloning the repo and running python -c 'import pydeequ' without installing the package will get an unhandled exception at import time.

Comment thread tests/test_version.py
import pydeequ


def test_package_version_is_exposed():
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DESIGN: The test is tautological — pydeequ.__version__ is defined as version("pydeequ") and the test asserts it equals version("pydeequ"). It can never fail unless the import itself fails. It doesn't guard against regressions (e.g., someone re-hardcoding the version). A more useful test would verify the version string matches a semver pattern or matches pyproject.toml.

In pydeequ/__init__.py line 17: __version__ = version("pydeequ"). In tests/test_version.py line 7-8: assert pydeequ.__version__ == version("pydeequ"). Both sides call the same function with the same argument, so the assertion is x == x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pydeequ __version__ is not updated for recent versions

1 participant