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
18 changes: 0 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Extract version from tag
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
# Strip the 'v' prefix from the tag
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
fi

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Update version in pyproject.toml
run: |
VERSION=${{ steps.version.outputs.VERSION }}
echo "Setting version to $VERSION"
sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
echo "Updated pyproject.toml:"
grep "^version" pyproject.toml

- name: Install build tools
run: python -m pip install --upgrade build

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ sqlit-notifications/
# Integration test artifacts
tests/integration/python_packages/artifacts/

sqlit/_version.py

# Local assets (except logo for README)
assets/*
!assets/favorites/
Expand Down
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "sqlit-tui"
version = "0.5.1"
description = "A terminal UI for SQL Server, PostgreSQL, MySQL, SQLite, Oracle, and more"
readme = "README.md"
license = "MIT"
Expand Down Expand Up @@ -33,6 +32,7 @@ dependencies = [
"keyring>=24.0.0",
"docker>=7.0.0", # Docker container auto-detection (lazy loaded)
]
dynamic = ["version"]

[project.optional-dependencies]
all = [
Expand Down Expand Up @@ -86,6 +86,12 @@ dev = [
"pre-commit>=3.0",
]

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "sqlit/_version.py"

[tool.ruff]
target-version = "py310"
line-length = 120
Expand Down
24 changes: 5 additions & 19 deletions sqlit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,20 @@
"ConnectionConfig",
]

try:
from ._version import __version__
except ImportError:
__version__ = "0.0.0.dev"

if TYPE_CHECKING:
from .app import SSMSTUI
from .cli import main
from .config import AuthType, ConnectionConfig
from importlib.metadata import PackageNotFoundError # noqa: F401


_VERSION_CACHE: str | None = None


def _get_version() -> str:
global _VERSION_CACHE
if _VERSION_CACHE is not None:
return _VERSION_CACHE
try:
from importlib.metadata import PackageNotFoundError, version

_VERSION_CACHE = version("sqlit-tui")
except PackageNotFoundError:
# Package not installed (development mode without editable install)
_VERSION_CACHE = "0.0.0.dev"
return _VERSION_CACHE


def __getattr__(name: str) -> Any:
"""Lazy import for heavy modules to keep package import side-effect free."""
if name == "__version__":
return _get_version()
if name == "main":
from .cli import main

Expand Down
1 change: 0 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.