Skip to content

Commit

Permalink
Merge pull request #3458 from lonvia/python-package
Browse files Browse the repository at this point in the history
Add support for installation via pip
  • Loading branch information
lonvia authored Jul 1, 2024
2 parents b0067a0 + 8dafd8b commit c314a30
Show file tree
Hide file tree
Showing 280 changed files with 2,873 additions and 1,884 deletions.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ contact_links:
- name: Nominatim Discussions
url: https://github.com/osm-search/Nominatim/discussions
about: Ask questions, get support, share ideas and discuss with community members.
- name: Discussions about OpenStreetMap data
url: https://community.openstreetmap.org/
about: Ask questions about the data used by Nominatim and discuss with the OSM community.
39 changes: 29 additions & 10 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ jobs:

- name: Install latest pylint
run: pip3 install -U pylint
if: matrix.flavour != 'oldstuff'
if: matrix.flavour == 'ubuntu-22'

- name: Python linting
run: python3 -m pylint nominatim
run: python3 -m pylint src
working-directory: Nominatim
if: matrix.flavour != 'oldstuff'
if: matrix.flavour == 'ubuntu-22'

- name: Python unit tests
run: python3 -m pytest test/python
Expand All @@ -126,7 +126,7 @@ jobs:
if: matrix.flavour != 'oldstuff'

- name: Python static typechecking
run: python3 -m mypy --strict nominatim
run: python3 -m mypy --strict src
working-directory: Nominatim
if: matrix.flavour != 'oldstuff'

Expand Down Expand Up @@ -227,16 +227,16 @@ jobs:

strategy:
matrix:
name: [Ubuntu-20, Ubuntu-22]
name: [Ubuntu-22, Ubuntu-24]
include:
- name: Ubuntu-20
image: "ubuntu:20.04"
ubuntu: 20
install_mode: install-apache
- name: Ubuntu-22
image: "ubuntu:22.04"
ubuntu: 22
install_mode: install-apache
- name: Ubuntu-24
image: "ubuntu:24.04"
ubuntu: 24
install_mode: install-apache

container:
image: ${{ matrix.image }}
Expand Down Expand Up @@ -292,6 +292,16 @@ jobs:
mkdir data-env-reverse
working-directory: /home/nominatim

- name: Add nominatim to path
run: |
sudo ln -s /home/nominatim/nominatim-venv/bin/nominatim /usr/local/bin/nominatim
if: matrix.ubuntu == 24

- name: Need lua binary
run: |
sudo apt-get install -y lua5.4 lua-dkjson
if: matrix.ubuntu == 24

- name: Print version
run: nominatim --version
working-directory: /home/nominatim/nominatim-project
Expand Down Expand Up @@ -324,9 +334,18 @@ jobs:
run: apt-get install -y python3-pip
shell: bash

- name: Run update
- name: Install osmium (Ubuntu 22)
run: |
pip3 install --user osmium
if: matrix.ubuntu == 22

- name: Install osmium (Ubuntu 24)
run: |
/home/nominatim/nominatim-venv/bin/pip install osmium
if: matrix.ubuntu == 24

- name: Run update
run: |
nominatim replication --init
NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
working-directory: /home/nominatim/nominatim-project
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
*.log
*.pyc
*.swp

docs/develop/*.png

build
dist
.coverage

.vagrant
data/country_osm_grid.sql.gz
22 changes: 12 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ endif()
# python (imports/updates only)
#-----------------------------------------------------------------------------

if (BUILD_IMPORTER)
if (BUILD_IMPORTER OR BUILD_API)
find_package(PythonInterp 3.7 REQUIRED)
endif()

Expand Down Expand Up @@ -221,20 +221,22 @@ if (BUILD_IMPORTER)
DESTINATION ${CMAKE_INSTALL_BINDIR}
RENAME nominatim)

install(DIRECTORY nominatim
DESTINATION ${NOMINATIM_LIBDIR}/lib-python
FILES_MATCHING PATTERN "*.py"
PATTERN "paths.py" EXCLUDE
PATTERN __pycache__ EXCLUDE)

if (EXISTS ${PHP_BIN})
configure_file(${PROJECT_SOURCE_DIR}/cmake/paths-py.tmpl paths-py.installed)
else()
configure_file(${PROJECT_SOURCE_DIR}/cmake/paths-py-no-php.tmpl paths-py.installed)
endif()
install(FILES ${PROJECT_BINARY_DIR}/paths-py.installed
DESTINATION ${NOMINATIM_LIBDIR}/lib-python/nominatim
RENAME paths.py)

foreach (submodule nominatim_db nominatim_api)
install(DIRECTORY src/${submodule}
DESTINATION ${NOMINATIM_LIBDIR}/lib-python
FILES_MATCHING PATTERN "*.py"
PATTERN "paths.py" EXCLUDE
PATTERN __pycache__ EXCLUDE)
install(FILES ${PROJECT_BINARY_DIR}/paths-py.installed
DESTINATION ${NOMINATIM_LIBDIR}/lib-python/${submodule}
RENAME paths.py)
endforeach()

install(DIRECTORY lib-sql DESTINATION ${NOMINATIM_LIBDIR})

Expand Down
Loading

0 comments on commit c314a30

Please sign in to comment.