Skip to content

Conversation

@bokelley
Copy link
Contributor

Summary

Fixed get_adcp_version() returning "v1" fallback instead of "2.5.0" when installed from PyPI. The file was packaged in the wrong location, making it inaccessible at runtime.

Changes

  • Moved ADCP_VERSION into package directory (src/adcp/)
  • Updated package-data config in pyproject.toml
  • Switched to importlib.resources for robust file access
  • Removed silent "v1" fallback to fail fast if missing

Test plan

  • ✓ Verified local import returns "2.5.0"
  • ✓ Verified installed package from wheel returns "2.5.0"

🤖 Generated with Claude Code

bokelley and others added 2 commits November 24, 2025 06:00
Previously, get_adcp_version() returned "v1" (fallback) when installed
from PyPI because ADCP_VERSION was packaged in the wrong location
(adcp-2.12.0.data/data/) and couldn't be found at runtime.

Changes:
- Move ADCP_VERSION into src/adcp/ package directory
- Update pyproject.toml to include it as package data
- Update get_adcp_version() to read from package location
- Remove "v1" fallback to fail fast if file is missing

Now returns "2.5.0" correctly when installed from PyPI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Switch from Path(__file__) to importlib.resources.files() for more
robust package data access across different installation methods
(editable installs, zip imports, etc.).

This is the modern, recommended way to access package data files
in Python 3.9+.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bokelley bokelley merged commit 161656d into main Nov 24, 2025
7 checks passed
@bokelley bokelley deleted the fix-version-file-packaging branch November 24, 2025 11:10
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.

2 participants