Skip to content

docs(version): update package-internal version#180

Merged
lukeroantreeONS merged 2 commits into
mainfrom
177-correct-package-__version__
Jun 1, 2026
Merged

docs(version): update package-internal version#180
lukeroantreeONS merged 2 commits into
mainfrom
177-correct-package-__version__

Conversation

@lukeroantreeONS
Copy link
Copy Markdown
Contributor

@lukeroantreeONS lukeroantreeONS commented May 29, 2026

📌 Update package-internal version, add check to release workflow to ensure consistency in future

✨ Summary

The package's build version currently differs from it's internal __version__ attribute.
This PR corrects the internal __version__ attribute, and adds a check to the release workflow to ensure it has been updated correctly before any future releases.

📜 Changes Introduced

  • docs(version): update package internal version
  • chore(CICD): add consistency check for internal version to release workflow

✅ Checklist

Please confirm you've completed these checks before requesting a review.

  • Code passes linting with Ruff
  • Security checks pass using Bandit
  • API and Unit tests are written and pass using pytest
  • Terraform files (if applicable) follow best practices and have been validated (terraform fmt & terraform validate)
  • DocStrings follow Google-style and are added as per Pylint recommendations
  • Documentation has been updated if needed

🔍 How to Test

  1. rebuild the package, install the new version, run
python -c "import classifai; print(classifai.__version__)"
  1. test the validation behaviour via this script (from the package root directory);
    [test_validation.sh]
#!/usr/bin/env bash
set -e
VERSION="1.0.0"
PATTERN="^## \[(v)?${VERSION}\]"
PATTERN_INIT="${VERSION}"
echo "Checking CHANGELOG.md for header: $PATTERN"
MATCH_COUNT=$(grep -c -E "$PATTERN" CHANGELOG.md || true)
if [ "$MATCH_COUNT" -eq 0 ]; then
  echo "ERROR: No changelog section found for v$VERSION" >&2
  exit 1
fi
if [ "$MATCH_COUNT" -gt 1 ]; then
  echo "ERROR: Multiple changelog sections found for v$VERSION" >&2
  exit 1
fi
echo "Changelog validation passed."
echo "Checking src/classifai/__init__.py for __version__: $PATTERN_INIT"
MATCH_COUNT_PACKAGE=$(grep -c -E "$PATTERN_INIT" src/classifai/__init__.py || true)
if [ "$MATCH_COUNT_PACKAGE" -eq 0 ]; then
  echo "ERROR: No match found for $VERSION in package's internals (src/classifai/__init__.py)" >&2
  exit 1
fi
if [ "$MATCH_COUNT_PACKAGE" -gt 1 ]; then
  echo "ERROR: Multiple entries found for $VERSION in package's internals (src/classifai/__init__.py)" >&2
  exit 1
fi
echo "Package internal consistency validation passed."

chmod +x test_validation.sh
./test_validation.sh

@lukeroantreeONS lukeroantreeONS requested a review from a team as a code owner May 29, 2026 15:19
@lukeroantreeONS lukeroantreeONS linked an issue May 29, 2026 that may be closed by this pull request
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 29, 2026
Copy link
Copy Markdown
Contributor

@frayle-ons frayle-ons left a comment

Choose a reason for hiding this comment

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

LGTM, all suggested tests work fine

@lukeroantreeONS lukeroantreeONS merged commit 806dfda into main Jun 1, 2026
6 checks passed
@lukeroantreeONS lukeroantreeONS deleted the 177-correct-package-__version__ branch June 1, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correct package __version__

2 participants