Skip to content

Commit

Permalink
reduce from 3 to 2 packages
Browse files Browse the repository at this point in the history
  • Loading branch information
lonvia committed Jun 27, 2024
1 parent 139cea5 commit 0619522
Show file tree
Hide file tree
Showing 148 changed files with 407 additions and 411 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ all:

# Building of wheels

build: build-core build-db build-api
build: clean-build build-db build-api

build-core:
python3 -m build packaging/nominatim-core --outdir dist/
clean-build:
rm -f dist/*

build-db:
python3 -m build packaging/nominatim-db --outdir dist/
Expand All @@ -29,4 +29,4 @@ lint:
bdd:
cd test/bdd; behave -DREMOVE_TEMPLATE=1

.PHONY: tests mypy pytest lint bdd build build-core build-db build-api
.PHONY: tests mypy pytest lint bdd build clean-build build-db build-api
2 changes: 1 addition & 1 deletion docs/admin/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Nominatim is easiest to run from its own virtual environment. To create one, run

To install Nominatim directly from the source tree into the virtual environment, run:

/srv/nominatim-venv/bin/pip install packaging/nominatim-{core,db,api}
/srv/nominatim-venv/bin/pip install packaging/nominatim-{db,api}

#### Building in legacy CMake mode

Expand Down
2 changes: 1 addition & 1 deletion docs/library/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ configuration parameters, see the [Configuration page](../customize/Settings.md)

## `Configuration` class

::: nominatim_core.config.Configuration
::: nominatim_api.Configuration
options:
members:
- get_bool
Expand Down
15 changes: 15 additions & 0 deletions packaging/nominatim-api/extra_src/paths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2024 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Path settings for extra data used by Nominatim.
"""
from pathlib import Path

PHPLIB_DIR = None
DATA_DIR = None
SQLLIB_DIR = None
CONFIG_DIR = (Path(__file__) / '..' / 'resources' / 'settings').resolve()
18 changes: 16 additions & 2 deletions packaging/nominatim-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
"nominatim-core",
"python-dotenv",
"pyYAML>=5.1",
"SQLAlchemy>=1.4.31",
"psycopg",
"PyICU"
Expand All @@ -34,8 +35,21 @@ path = "src/nominatim_api/version.py"
pattern = "NOMINATIM_API_VERSION = '(?P<version>[^']+)'"

[tool.hatch.build.targets.sdist]
include = ["src/nominatim_api"]
include = [
"src/nominatim_api",
"src/nominatim_db/config.py",
"settings",
"extra_src/paths.py"
]

exclude = [
"src/nominatim_api/config.py"
]

[tool.hatch.build.targets.wheel]
packages = ["src/nominatim_api"]

[tool.hatch.build.targets.wheel.force-include]
"src/nominatim_db/config.py" = "nominatim_api/config.py"
"extra_src/paths.py" = "nominatim_api/paths.py"
"settings" = "nominatim_api/resources/settings"
File renamed without changes.
1 change: 0 additions & 1 deletion packaging/nominatim-core/COPYING

This file was deleted.

24 changes: 0 additions & 24 deletions packaging/nominatim-core/README.md

This file was deleted.

1 change: 0 additions & 1 deletion packaging/nominatim-core/data

This file was deleted.

60 changes: 0 additions & 60 deletions packaging/nominatim-core/pyproject.toml

This file was deleted.

1 change: 0 additions & 1 deletion packaging/nominatim-core/src

This file was deleted.

1 change: 1 addition & 0 deletions packaging/nominatim-db/data
File renamed without changes.
30 changes: 28 additions & 2 deletions packaging/nominatim-db/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
"nominatim-core",
"psycopg2-binary",
"python-dotenv",
"jinja2",
"pyYAML>=5.1",
"datrie",
"psutil",
"PyICU"
]
Expand All @@ -24,6 +27,7 @@ dynamic = ["version"]
[project.urls]
Homepage = "https://nominatim.org"
Issues = "https://github.com/osm-search/Nominatim/issues"
Documentation = "https://nominatim.org/release-docs/latest/"

[build-system]
requires = ["hatchling"]
Expand All @@ -34,10 +38,32 @@ path = "src/nominatim_db/version.py"
pattern = "NOMINATIM_VERSION = parse_version.'(?P<version>[^-]+)"

[tool.hatch.build.targets.sdist]
include = ["src/nominatim_db", "scripts"]
include = [
"src/nominatim_db",
"scripts",
"lib-sql/**/*.sql",
"settings",
"data/words.sql",
"extra_src/nominatim_db/paths.py"
]

artifacts = [
"data/country_osm_grid.sql.gz"
]

exclude = [
"src/nominatim_db/paths.py"
]

[tool.hatch.build.targets.wheel]
packages = ["src/nominatim_db"]

[tool.hatch.build.targets.wheel.shared-scripts]
"scripts" = "/"

[tool.hatch.build.targets.wheel.force-include]
"lib-sql" = "nominatim_db/resources/lib-sql"
"settings" = "nominatim_db/resources/settings"
"data/country_osm_grid.sql.gz" = "nominatim_db/resources/country_osm_grid.sql.gz"
"data/words.sql" = "nominatim_db/resources/words.sql"
"extra_src/nominatim_db/paths.py" = "nominatim_db/paths.py"
1 change: 1 addition & 0 deletions packaging/nominatim-db/settings
4 changes: 2 additions & 2 deletions src/nominatim_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# See also https://github.com/PyCQA/pylint/issues/6006
# pylint: disable=useless-import-alias

from nominatim_core.errors import (UsageError as UsageError)
from nominatim_core.config import (Configuration as Configuration)
from .errors import (UsageError as UsageError)
from .config import (Configuration as Configuration)

from .core import (NominatimAPI as NominatimAPI,
NominatimAPIAsync as NominatimAPIAsync)
Expand Down
12 changes: 12 additions & 0 deletions src/nominatim_api/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2024 by the Nominatim developer community.
# For a full list of authors see the git log.

# This file is just a placeholder to make the config module available
# during development. It will be replaced by nominatim_db/config.py on
# installation.
# pylint: skip-file
from nominatim_db.config import *
6 changes: 3 additions & 3 deletions src/nominatim_api/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import sqlalchemy as sa
from sqlalchemy.ext.asyncio import AsyncConnection

from nominatim_core.typing import SaFromClause
from nominatim_core.db.sqlalchemy_schema import SearchTables
from nominatim_core.db.sqlalchemy_types import Geometry
from .typing import SaFromClause
from .sql.sqlalchemy_schema import SearchTables
from .sql.sqlalchemy_types import Geometry
from .logging import log

T = TypeVar('T')
Expand Down
8 changes: 4 additions & 4 deletions src/nominatim_api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import sqlalchemy as sa
import sqlalchemy.ext.asyncio as sa_asyncio

from nominatim_core.errors import UsageError
from nominatim_core.db.sqlalchemy_schema import SearchTables
from nominatim_core.db.async_core_library import PGCORE_LIB, PGCORE_ERROR
from nominatim_core.config import Configuration
from .errors import UsageError
from .sql.sqlalchemy_schema import SearchTables
from .sql.async_core_library import PGCORE_LIB, PGCORE_ERROR
from .config import Configuration
from .sql import sqlite_functions, sqlalchemy_functions #pylint: disable=unused-import
from .connection import SearchConnection
from .status import get_status, StatusResult
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/nominatim_api/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import sqlalchemy as sa

from nominatim_core.typing import SaColumn, SaRow, SaSelect
from .typing import SaColumn, SaRow, SaSelect
from .connection import SearchConnection
from .logging import log
from . import types as ntyp
Expand Down
4 changes: 2 additions & 2 deletions src/nominatim_api/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import sqlalchemy as sa

from nominatim_core.typing import SaSelect, SaRow
from nominatim_core.db.sqlalchemy_types import Geometry
from .typing import SaSelect, SaRow
from .sql.sqlalchemy_types import Geometry
from .types import Point, Bbox, LookupDetails
from .connection import SearchConnection
from .logging import log
Expand Down
6 changes: 3 additions & 3 deletions src/nominatim_api/reverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import sqlalchemy as sa

from nominatim_core.typing import SaColumn, SaSelect, SaFromClause, SaLabel, SaRow,\
SaBind, SaLambdaSelect
from nominatim_core.db.sqlalchemy_types import Geometry
from .typing import SaColumn, SaSelect, SaFromClause, SaLabel, SaRow,\
SaBind, SaLambdaSelect
from .sql.sqlalchemy_types import Geometry
from .connection import SearchConnection
from . import results as nres
from .logging import log
Expand Down
4 changes: 2 additions & 2 deletions src/nominatim_api/search/db_search_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import sqlalchemy as sa

from nominatim_core.typing import SaFromClause, SaColumn, SaExpression
from nominatim_core.utils.json_writer import JsonWriter
from ..typing import SaFromClause, SaColumn, SaExpression
from ..utils.json_writer import JsonWriter
from .query import Token
from . import db_search_lookups as lookups

Expand Down
4 changes: 2 additions & 2 deletions src/nominatim_api/search/db_search_lookups.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import sqlalchemy as sa
from sqlalchemy.ext.compiler import compiles

from nominatim_core.typing import SaFromClause
from nominatim_core.db.sqlalchemy_types import IntArray
from ..typing import SaFromClause
from ..sql.sqlalchemy_types import IntArray

# pylint: disable=consider-using-f-string

Expand Down
6 changes: 3 additions & 3 deletions src/nominatim_api/search/db_searches.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import sqlalchemy as sa

from nominatim_core.typing import SaFromClause, SaScalarSelect, SaColumn, \
SaExpression, SaSelect, SaLambdaSelect, SaRow, SaBind
from nominatim_core.db.sqlalchemy_types import Geometry, IntArray
from ..typing import SaFromClause, SaScalarSelect, SaColumn, \
SaExpression, SaSelect, SaLambdaSelect, SaRow, SaBind
from ..sql.sqlalchemy_types import Geometry, IntArray
from ..connection import SearchConnection
from ..types import SearchDetails, DataLayer, GeometryFormat, Bbox
from .. import results as nres
Expand Down
4 changes: 2 additions & 2 deletions src/nominatim_api/search/icu_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import sqlalchemy as sa

from nominatim_core.typing import SaRow
from nominatim_core.db.sqlalchemy_types import Json
from ..typing import SaRow
from ..sql.sqlalchemy_types import Json
from ..connection import SearchConnection
from ..logging import log
from ..search import query as qmod
Expand Down
2 changes: 1 addition & 1 deletion src/nominatim_api/search/legacy_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import sqlalchemy as sa

from nominatim_core.typing import SaRow
from ..typing import SaRow
from ..connection import SearchConnection
from ..logging import log
from . import query as qmod
Expand Down
2 changes: 1 addition & 1 deletion src/nominatim_api/server/falcon/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from falcon.asgi import App, Request, Response

from nominatim_core.config import Configuration
from ...config import Configuration
from ...core import NominatimAPIAsync
from ... import v1 as api_impl
from ... import logging as loglib
Expand Down
Loading

0 comments on commit 0619522

Please sign in to comment.