Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html

## [Unreleased]

## [0.4.2] — 2026-06-08

### Fixed

- **`__version__` was hardcoded and stale** (`__init__.py`). It read `"0.2.0"`
regardless of the installed release, since nothing tied it to the version in
`pyproject.toml`. It is now derived from the installed distribution metadata
via `importlib.metadata.version("table-stitcher")`, so it always reflects the
actual release (falling back to `"0.0.0+unknown"` when run from an
uninstalled source tree). The release gate now also asserts
`__version__` matches the `pyproject.toml` version, so the two can't drift
again.

## [0.4.1] — 2026-06-08

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "table-stitcher"
version = "0.4.1"
version = "0.4.2"
description = "Reassemble tables split across page boundaries in PDF extraction"
readme = "README.md"
license = "MIT"
Expand Down
8 changes: 8 additions & 0 deletions scripts/release_gate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,23 @@ else
fi

echo "==> Smoke-testing installed wheel outside checkout"
EXPECTED_VERSION="$(grep -E '^version = ' pyproject.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/')"
export EXPECTED_VERSION
(
cd "$TMP_ENV"
"$TMP_ENV/venv/bin/python" - <<'PY'
import os
import pathlib

import table_stitcher

package_path = pathlib.Path(table_stitcher.__file__).resolve()
expected = os.environ["EXPECTED_VERSION"]
assert "site-packages" in str(package_path), package_path
assert table_stitcher.__version__, "missing __version__"
assert table_stitcher.__version__ == expected, (
f"__version__ {table_stitcher.__version__!r} != pyproject version {expected!r}"
)
assert callable(table_stitcher.stitch_tables)
print(f"installed {table_stitcher.__version__} from {package_path}")
PY
Expand Down
9 changes: 8 additions & 1 deletion src/table_stitcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ def inject(self, doc, logical_tables): ...

import logging
import time
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as _pkg_version
from typing import Any, Optional

from .adapters.base import TableStitcherAdapter
from .merger import merge_multipage_tables
from .models import LogicalTable, MergeTrace, MultiPageConfig, TableMeta

__version__ = "0.2.0"
# Single source of truth: the installed distribution's version (from
# pyproject.toml). Derived rather than hardcoded so it can never drift.
try:
__version__ = _pkg_version("table-stitcher")
except PackageNotFoundError: # running from a source tree without an install
__version__ = "0.0.0+unknown"
__all__ = [
"stitch_tables",
"extract_table_meta",
Expand Down
Loading