Make dump-things-service an optional dependency, named ttl #8

Merged
cmo merged 1 commit from optional-dependencies into master 2026-01-13 09:13:54 +00:00
2 changed files with 15 additions and 6 deletions

View file

@ -5,10 +5,17 @@ import json
import re import re
import sys import sys
# The try-except clause is required because marking scripts as optional does
# not work. That means, even scripts marked as optional are always installed
# (see <https://stackoverflow.com/questions/77501716/pyproject-toml-setuptools-how-can-i-specify-optional-scripts-and-modules>)
try:
from dump_things_service.converter import ( from dump_things_service.converter import (
Format, Format,
FormatConverter, FormatConverter,
) )
except ImportError:
print(f"Please install 'dump-things-pyclient[ttl]' to use this command.")
sys.exit(0)
description = f"""Read JSON records from stdin and convert them to TTL description = f"""Read JSON records from stdin and convert them to TTL

View file

@ -8,11 +8,13 @@ authors = [
{name="Christian Mönch", email="christian.moench@web.de"}, {name="Christian Mönch", email="christian.moench@web.de"},
] ]
dependencies = [ dependencies = [
"dump-things-service>=5.3.0",
"requests>=2.32.5", "requests>=2.32.5",
] ]
[dependency-groups] [project.optional-dependencies]
ttl = [
"dump-things-service>=5.3.0",
]
tests = [ tests = [
"pytest>=9.0.1", "pytest>=9.0.1",
] ]