Skip to content

Commit

Permalink
Fix Python compatibility for Fedora 32
Browse files Browse the repository at this point in the history
- Add fallback for pre-Python 3.10 entry_points API
- Handle both old (get) and new (select) entry_points methods
- Update version to 2024.12.30

Fixes #14
  • Loading branch information
ehammond committed Dec 30, 2024
1 parent 5494dc5 commit 0df98cc
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,4 @@ Prompt crafting by Eric Hammond

## Version

Current version: 2024.12.19
Current version: 2024.12.30
14 changes: 10 additions & 4 deletions abc_cli/abc_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# Entry point group for LLM providers
PROVIDER_ENTRY_POINT = 'abc.llm_providers'

VERSION: str = "# 2024.12.19"
VERSION: str = "# 2024.12.30"
PROGRAM_NAME: str = "abc"

# Config file
Expand Down Expand Up @@ -102,9 +102,15 @@ def get_provider(config: Dict[str, str]) -> LLMProvider:
provider_name = config['provider']

try:
# Find the provider entry point
eps = metadata.entry_points().select(group=PROVIDER_ENTRY_POINT)
provider_ep = next(ep for ep in eps if ep.name == provider_name)
# Handle both old (pre-3.10) and new entry_points API
try:
# New API (Python 3.10+)
eps = metadata.entry_points().select(group=PROVIDER_ENTRY_POINT)
provider_ep = next(ep for ep in eps if ep.name == provider_name)
except AttributeError:
# Old API (Python < 3.10)
eps = metadata.entry_points().get(PROVIDER_ENTRY_POINT, [])
provider_ep = next(ep for ep in eps if ep.name == provider_name)

# Load the provider class
provider_class = provider_ep.load()
Expand Down
2 changes: 1 addition & 1 deletion abc_provider_anthropic/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "abc-provider-anthropic"
version = "2024.12.19"
version = "2024.12.30"
description = "Anthropic LLM provider for abc-cli"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

from .llm_provider import AWSBedrockProvider, PROVIDER_NAME

__version__ = "2024.12.19"
__version__ = "2024.12.30"
2 changes: 1 addition & 1 deletion abc_provider_aws_bedrock/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "abc_provider_aws_bedrock"
version = "2024.12.19" # Match current abc-cli version
version = "2024.12.30" # Match current abc-cli version
description = "AWS Bedrock LLM provider plugin for abc-cli"
readme = "README.md"
requires-python = ">=3.8"
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 = "abc-cli"
version = "2024.12.19"
version = "2024.12.30"
description = "AI bash/zsh/tcsh Command"
readme = "README.md"
requires-python = ">=3.8"
Expand Down

0 comments on commit 0df98cc

Please sign in to comment.