]> git.openstreetmap.org Git - nominatim.git/commitdiff
add packaging for the different subprojects
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 6 Jun 2024 16:08:56 +0000 (18:08 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 26 Jun 2024 09:52:47 +0000 (11:52 +0200)
Makefile [new file with mode: 0644]
packaging/nominatim-api/README.md [new file with mode: 0644]
packaging/nominatim-api/pyproject.toml [new file with mode: 0644]
packaging/nominatim-core/README.md [new file with mode: 0644]
packaging/nominatim-core/pyproject.toml [new file with mode: 0644]
packaging/nominatim-core/src/nominatim_core/paths.py [moved from wheel_build/nominatim/paths.py with 100% similarity]
packaging/nominatim-db/README.md [new file with mode: 0644]
packaging/nominatim-db/pyproject.toml [new file with mode: 0644]
packaging/nominatim-db/scripts/nominatim [moved from wheel_build/shared/scripts/nominatim with 70% similarity]
pyproject.toml [deleted file]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..03ddafa
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+all:
+
+# Building of wheels
+
+build: build-core build-db build-api
+
+build-core:
+       cd packaging/nominatim-core; python3 -m build . --outdir ../dist/
+
+build-db:
+       cd packaging/nominatim-db; python3 -m build . --outdir ../dist/
+
+build-api:
+       cd packaging/nominatim-api; python3 -m build . --outdir ../dist/
+
+# Tests
+
+tests: mypy lint pytest
+
+mypy:
+       python3 -m mypy --strict src
+
+pytest:
+       python3 -m pytest test/python
+
+lint:
+       python3 -m pylint src
+
+bdd:
+       cd test/bdd; behave -DREMOVE_TEMPLATE=1
+
+.PHONY: tests mypy pytest lint bdd build build-core build-db build-api
diff --git a/packaging/nominatim-api/README.md b/packaging/nominatim-api/README.md
new file mode 100644 (file)
index 0000000..2711e50
--- /dev/null
@@ -0,0 +1,21 @@
+Nominatim - frontend library
+=========
+
+Nominatim is a tool to search OpenStreetMap data
+by name and address (geocoding) and to generate synthetic addresses of
+OSM points (reverse geocoding).
+
+This module implements the library for searching in a Nominatim database
+imported with the `nominatim-db` package.
+
+Documentation
+=============
+
+The documentation of the latest development version is in the
+`docs/` subdirectory. A HTML version can be found at
+https://nominatim.org/release-docs/develop/ .
+
+License
+=======
+
+The source code is available under a GPLv3 license.
diff --git a/packaging/nominatim-api/pyproject.toml b/packaging/nominatim-api/pyproject.toml
new file mode 100644 (file)
index 0000000..7e9230e
--- /dev/null
@@ -0,0 +1,45 @@
+[project]
+name = "nominatim-api"
+description = "A tool for building a database of OpenStreetMap for geocoding and for searching the database. Search library."
+readme = "README.md"
+requires-python = ">=3.7"
+license = 'GPL-3.0-or-later'
+maintainers = [
+  { name = "Sarah Hoffmann", email = "lonvia@denofr.de" }
+]
+keywords = [ "geocoding", "OpenStreetMap", "search" ]
+classifiers = [
+    "Programming Language :: Python :: 3",
+    "License :: OSI Approved :: GNU General Public License (GPL)",
+    "Operating System :: OS Independent",
+]
+dependencies = [
+    "nominatim-core",
+    "SQLAlchemy>=1.4.31",
+    "psycopg",
+    "PyICU"
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "https://nominatim.org"
+Issues = "https://github.com/osm-search/Nominatim/issues"
+
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[tool.hatch.version]
+source = "code"
+path = "../../src/nominatim_api/version.py"
+expression = "NOMINATIM_API_VERSION"
+
+[tool.hatch.build.targets.sdist.force-include]
+"../../src/nominatim_db" = "nominatim_api"
+
+[tool.hatch.build.targets.sdist.sources]
+"src/nominatim_core" = "nominatim_api"
+
+[tool.hatch.build.targets.wheel]
+packages = ["nominatim_api"]
+
diff --git a/packaging/nominatim-core/README.md b/packaging/nominatim-core/README.md
new file mode 100644 (file)
index 0000000..abc040f
--- /dev/null
@@ -0,0 +1,22 @@
+Nominatim - Core Package
+=========
+
+Nominatim is a tool to search OpenStreetMap data
+by name and address (geocoding) and to generate synthetic addresses of
+OSM points (reverse geocoding).
+
+This is the core pacakage containing resources and code shared by
+Nominatim's frontend `nominatim_api` and backend `nominatim_db`. You
+usually don't want to install this package directly.
+
+Documentation
+=============
+
+The documentation of the latest development version is in the
+`docs/` subdirectory. A HTML version can be found at
+https://nominatim.org/release-docs/develop/ .
+
+License
+=======
+
+The source code is available under a GPLv2 license.
diff --git a/packaging/nominatim-core/pyproject.toml b/packaging/nominatim-core/pyproject.toml
new file mode 100644 (file)
index 0000000..931c857
--- /dev/null
@@ -0,0 +1,49 @@
+[project]
+name = "nominatim-core"
+description = "A tool for building a database of OpenStreetMap for geocoding and for searching the database. Base package for common resources for the project."
+readme = "README.md"
+requires-python = ">=3.7"
+license = 'GPL-3.0-or-later'
+maintainers = [
+  { name = "Sarah Hoffmann", email = "lonvia@denofr.de" }
+]
+keywords = [ "geocoding", "OpenStreetMap", "search" ]
+classifiers = [
+    "Programming Language :: Python :: 3",
+    "License :: OSI Approved :: GNU General Public License (GPL)",
+    "Operating System :: OS Independent",
+]
+dependencies = [
+    "python-dotenv",
+    "jinja2",
+    "pyYAML>=5.1",
+    "datrie"
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "https://nominatim.org"
+Issues = "https://github.com/osm-search/Nominatim/issues"
+
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[tool.hatch.version]
+source = "code"
+path = "../../src/nominatim_core/version.py"
+expression = "NOMINATIM_CORE_VERSION"
+
+[tool.hatch.build.targets.sdist.force-include]
+"../../src/nominatim_core" = "nominatim_core"
+"../../lib-sql" = "nominatim_core/resources/lib-sql"
+"../../settings" = "nominatim_core/resources/settings"
+"../../data/country_osm_grid.sql.gz" = "nominatim_core/resources/country_osm_grid.sql.gz"
+"../../data/words.sql" = "nominatim_core/resources/words.sql"
+"src/nominatim_core/paths.py" = "nominatim_core/paths.py"
+
+[tool.hatch.build.targets.sdist.sources]
+"src/nominatim_core" = "nominatim_core"
+
+[tool.hatch.build.targets.wheel]
+packages = ["nominatim_core"]
diff --git a/packaging/nominatim-db/README.md b/packaging/nominatim-db/README.md
new file mode 100644 (file)
index 0000000..bf34935
--- /dev/null
@@ -0,0 +1,21 @@
+Nominatim - DB Backend
+=========
+
+Nominatim is a tool to search OpenStreetMap data
+by name and address (geocoding) and to generate synthetic addresses of
+OSM points (reverse geocoding).
+
+This module implements the database backend for Nominatim and the
+command-line tool for importing and maintaining the database.
+
+Documentation
+=============
+
+The documentation of the latest development version is in the
+`docs/` subdirectory. A HTML version can be found at
+https://nominatim.org/release-docs/develop/ .
+
+License
+=======
+
+The source code is available under a GPLv3 license.
diff --git a/packaging/nominatim-db/pyproject.toml b/packaging/nominatim-db/pyproject.toml
new file mode 100644 (file)
index 0000000..4cad2b8
--- /dev/null
@@ -0,0 +1,49 @@
+[project]
+name = "nominatim-db"
+description = "A tool for building a database of OpenStreetMap for geocoding and for searching the database. Database backend."
+readme = "README.md"
+requires-python = ">=3.7"
+license = 'GPL-3.0-or-later'
+maintainers = [
+  { name = "Sarah Hoffmann", email = "lonvia@denofr.de" }
+]
+keywords = [ "geocoding", "OpenStreetMap", "search" ]
+classifiers = [
+    "Programming Language :: Python :: 3",
+    "License :: OSI Approved :: GNU General Public License (GPL)",
+    "Operating System :: OS Independent",
+]
+dependencies = [
+    "nominatim-core",
+    "psycopg2",
+    "psutil",
+    "PyICU"
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "https://nominatim.org"
+Issues = "https://github.com/osm-search/Nominatim/issues"
+
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[tool.hatch.version]
+source = "code"
+path = "../../src/nominatim_db/version.py"
+expression = "NOMINATIM_VERSION.release_version()"
+
+[tool.hatch.build.targets.sdist.force-include]
+"../../src/nominatim_db" = "nominatim_db"
+
+[tool.hatch.build.targets.sdist.sources]
+"src/nominatim_core" = "nominatim_db"
+"scripts" = "scripts"
+
+[tool.hatch.build.targets.wheel]
+packages = ["nominatim_db"]
+
+[tool.hatch.build.targets.wheel.shared-scripts]
+"scripts" = "/"
+
similarity index 70%
rename from wheel_build/shared/scripts/nominatim
rename to packaging/nominatim-db/scripts/nominatim
index e12f77d18468ad469b7f117166b1f4507ec32c0d..39e703dc20916afe4fa3826cd2239a99ed209129 100755 (executable)
@@ -1,5 +1,5 @@
 #!python3
 
-from nominatim import cli
+from nominatim_db import cli
 
 exit(cli.nominatim(module_dir=None, osm2pgsql_path=None))
diff --git a/pyproject.toml b/pyproject.toml
deleted file mode 100644 (file)
index 3433f69..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-[project]
-name = "nominatim"
-description = "A tool for building a database of OpenStreetMap for geocoding and for searching the database."
-readme = "README.md"
-requires-python = ">=3.7"
-license = 'GPL-3.0-or-later'
-maintainers = [
-  { name = "Sarah Hoffmann", email = "lonvia@denofr.de" }
-]
-keywords = [ "geocoding", "OpenStreetMap", "search" ]
-classifiers = [
-    "Programming Language :: Python :: 3",
-    "License :: OSI Approved :: GNU General Public License (GPL)",
-    "Operating System :: OS Independent",
-]
-dependencies = [
-    "psycopg2",
-    "python-dotenv",
-    "psutil",
-    "jinja2",
-    "SQLAlchemy>=1.4.31",
-    "asyncpg>=0.8",
-    "PyICU",
-    "pyYAML>=5.1",
-    "datrie"
-]
-dynamic = ["version"]
-
-[project.urls]
-Homepage = "https://nominatim.org"
-Issues = "https://github.com/osm-search/Nominatim/issues"
-
-[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
-
-[tool.hatch.version]
-source = "code"
-path = "nominatim/version.py"
-expression = "NOMINATIM_VERSION.release_version()"
-
-[tool.hatch.build.targets.sdist]
-only-include = ["nominatim", "lib-sql", "settings",
-                "docs", "man", "data", "munin",
-                "test/python", "test/bdd", "test/testdata", "test/testdb"]
-artifacts = ["data/country_osm_grid.sql.gz"]
-
-[tool.hatch.build.targets.wheel]
-only-include = ["nominatim", "lib-sql", "settings",
-                "data/words.sql", "data/country_osm_grid.sql.gz",
-                "wheel_build/nominatim"]
-exclude = ["nominatim/paths.py"]
-
-[tool.hatch.build.targets.wheel.shared-scripts]
-"wheel_build/shared/scripts" = "/"
-
-[tool.hatch.build.targets.wheel.sources]
-"wheel_build/nominatim" = "nominatim"
-"lib-sql" = "nominatim/resources/lib-sql"
-"settings" = "nominatim/resources/settings"
-"data" = "nominatim/resources"