Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ dist

.vagrant
data/country_osm_grid.sql.gz

# Not committed per project policy
uv.lock
*.egg-info/
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Please see the development section of the Nominatim documentation for
* [an architecture overview](https://nominatim.org/release-docs/develop/develop/overview/)
and backgrounds on some of the algorithms
* [how to set up a development environment](https://nominatim.org/release-docs/develop/develop/Development-Environment/)
using virtualenv or [uv](https://docs.astral.sh/uv/)
* and background on [how tests are organised](https://nominatim.org/release-docs/develop/develop/Testing/)


Expand Down
33 changes: 28 additions & 5 deletions docs/develop/Development-Environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,21 @@ sudo apt install build-essential libsqlite3-mod-spatialite osm2pgsql \
pkg-config libicu-dev virtualenv
```

To set up the virtual environment with all necessary packages run:
#### Using pip

Create a virtual environment and install all dependencies:

```sh
virtualenv ~/nominatim-dev-venv
~/nominatim-dev-venv/bin/pip install\
psutil 'psycopg[binary]' PyICU SQLAlchemy \
. ~/nominatim-dev-venv/bin/activate
pip install --group runtime --group dev
```

To install dependencies individually:

```sh
pip install \
psutil 'psycopg[binary]' PyICU 'SQLAlchemy[asyncio]' \
python-dotenv jinja2 pyYAML \
mkdocs 'mkdocstrings[python]' mkdocs-gen-files mkdocs-material \
pytest pytest-asyncio pytest-bdd flake8 \
Expand All @@ -76,10 +85,24 @@ virtualenv ~/nominatim-dev-venv
uvicorn mypy osmium aiosqlite mwparserfromhell
```

Now enter the virtual environment whenever you want to develop:
#### Using uv

If you prefer, you can use [uv](https://docs.astral.sh/uv/) for a faster
development setup. Install uv following the
[official instructions](https://docs.astral.sh/uv/getting-started/installation/),
then from the Nominatim source directory:

```sh
. ~/nominatim-dev-venv/bin/activate
uv sync
```

This creates a virtual environment and installs all Python dependencies
automatically. To run commands in the environment:

```sh
uv run nominatim --version
uv run pytest test/python
uv run make lint
```

### Running Nominatim during development
Expand Down
62 changes: 62 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[tool.uv.workspace]
members = ["packaging/*"]

[dependency-groups]
dev = [
{ include-group = "test" },
{ include-group = "lint" },
{ include-group = "types" },
{ include-group = "docs" },
{ include-group = "serve" },
]

test = [
"pytest",
"pytest-asyncio",
"pytest-bdd",
"aiosqlite",
"osmium",
]

lint = [
"flake8",
]

types = [
"mypy",
"types-jinja2",
"types-markupsafe",
"types-psycopg2",
"types-psutil",
"types-Pygments",
"types-PyYAML",
"types-requests",
"types-ujson",
"types-urllib3",
"typing-extensions",
]

docs = [
"mkdocs",
"mkdocstrings[python]",
"mkdocs-gen-files",
"mkdocs-material",
]

serve = [
"falcon",
"starlette",
"uvicorn",
]

runtime = [
"psycopg != 3.3.0",
"async-timeout",
"python-dotenv",
"jinja2",
"pyYAML>=5.1",
"psutil",
"PyICU",
"mwparserfromhell",
"SQLAlchemy[asyncio]>=1.4.31",
]