build-backend = "hatchling.build"
[tool.hatch.version]
-source = "code"
path = "../../src/nominatim_api/version.py"
-expression = "NOMINATIM_API_VERSION"
+pattern = "NOMINATIM_API_VERSION = '(?P<version>[^']+)'"
[tool.hatch.build.targets.sdist.force-include]
"../../src/nominatim_db" = "nominatim_api"
build-backend = "hatchling.build"
[tool.hatch.version]
-source = "code"
path = "../../src/nominatim_core/version.py"
-expression = "NOMINATIM_CORE_VERSION"
+pattern = "NOMINATIM_CORE_VERSION = '(?P<version>[^']+)'"
[tool.hatch.build.targets.sdist.force-include]
"../../src/nominatim_core" = "nominatim_core"
build-backend = "hatchling.build"
[tool.hatch.version]
-source = "code"
path = "../../src/nominatim_db/version.py"
-expression = "NOMINATIM_VERSION.release_version()"
+pattern = "NOMINATIM_VERSION = parse_version.'(?P<version>[^-]+)"
[tool.hatch.build.targets.sdist.force-include]
"../../src/nominatim_db" = "nominatim_db"
parser.add_subcommand('admin', clicmd.AdminFuncs())
- parser.add_subcommand('export', clicmd.QueryExport())
- parser.add_subcommand('convert', clicmd.ConvertDB())
- parser.add_subcommand('serve', AdminServe())
-
- parser.add_subcommand('search', clicmd.APISearch())
- parser.add_subcommand('reverse', clicmd.APIReverse())
- parser.add_subcommand('lookup', clicmd.APILookup())
- parser.add_subcommand('details', clicmd.APIDetails())
- parser.add_subcommand('status', clicmd.APIStatus())
+ try:
+ exportcmd = importlib.import_module('nominatim_db.clicmd.export')
+ apicmd = importlib.import_module('nominatim_db.clicmd.api')
+ convertcmd = importlib.import_module('nominatim_db.clicmd.convert')
+
+ parser.add_subcommand('export', exportcmd.QueryExport())
+ parser.add_subcommand('convert', convertcmd.ConvertDB())
+ parser.add_subcommand('serve', AdminServe())
+
+ parser.add_subcommand('search', apicmd.APISearch())
+ parser.add_subcommand('reverse', apicmd.APIReverse())
+ parser.add_subcommand('lookup', apicmd.APILookup())
+ parser.add_subcommand('details', apicmd.APIDetails())
+ parser.add_subcommand('status', apicmd.APIStatus())
+ except ModuleNotFoundError as ex:
+ if not ex.name or 'nominatim_api' not in ex.name: # pylint: disable=E1135
+ raise ex
+
+ parser.parser.epilog = \
+ '\n\nNominatim API package not found. The following commands are not available:'\
+ '\n export, convert, serve, search, reverse, lookup, details, status'\
+ "\n\nRun 'pip install nominatim-api' to install the package."
+
return parser
from .setup import SetupAll as SetupAll
from .replication import UpdateReplication as UpdateReplication
-from .api import (APISearch as APISearch,
- APIReverse as APIReverse,
- APILookup as APILookup,
- APIDetails as APIDetails,
- APIStatus as APIStatus)
from .index import UpdateIndex as UpdateIndex
from .refresh import UpdateRefresh as UpdateRefresh
from .add_data import UpdateAddData as UpdateAddData
from .admin import AdminFuncs as AdminFuncs
from .freeze import SetupFreeze as SetupFreeze
from .special_phrases import ImportSpecialPhrases as ImportSpecialPhrases
-from .export import QueryExport as QueryExport
-from .convert import ConvertDB as ConvertDB
import argparse
import random
-import nominatim_api as napi
+from nominatim_core.errors import UsageError
from nominatim_core.db.connection import connect
from .args import NominatimArgs
def _warm(self, args: NominatimArgs) -> int:
+ try:
+ import nominatim_api as napi
+ except ModuleNotFoundError as exp:
+ raise UsageError("Warming requires nominatim API. "
+ "Install with 'pip install nominatim-api'.") from exp
LOG.warning('Warming database caches')
api = napi.NominatimAPI(args.project_dir)
from nominatim_core.version import (NominatimVersion as NominatimVersion,
parse_version as parse_version)
-NOMINATIM_VERSION = NominatimVersion(4, 4, 99, 1)
+NOMINATIM_VERSION = parse_version('4.4.99-1')
POSTGRESQL_REQUIRED_VERSION = (9, 6)
POSTGIS_REQUIRED_VERSION = (2, 2)