Skip to content

Commit 9f9f40b

Browse files
authored
Merge pull request #20 from addok/modernize
Modernize Python packaging and CI
2 parents 0ff3048 + 3a8ba00 commit 9f9f40b

File tree

9 files changed

+164
-76
lines changed

9 files changed

+164
-76
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ['3.9', '3.14']
15+
fail-fast: false
16+
services:
17+
redis:
18+
image: redis
19+
options:
20+
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s
21+
--health-retries 5
22+
ports:
23+
- 6379:6379
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install -e ".[dev]"
37+
38+
- name: Run tests with pytest
39+
run: |
40+
pytest --cov=addok_france --cov-report=term-missing

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ __pycache__
22
*.pyc
33
.cache
44
*.egg-info
5+
.venv
6+
venv
7+
build
8+
dist

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 DINSIC/Etalab
3+
Copyright (c) 2016 République Française
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
develop:
2+
pip install -e ".[dev]"
3+
4+
test:
5+
python -m pytest
6+
7+
testcoverage:
8+
python -m pytest --cov-report lcov --cov=addok_france tests/
9+
10+
clean:
11+
rm -rf dist/ build/
12+
13+
dist: clean test
14+
python -m build
15+
16+
upload: dist
17+
@if [ -z "$$(ls dist/*.whl dist/*.tar.gz 2>/dev/null)" ]; then \
18+
echo "Error: No distribution files found. Run 'make dist' first."; \
19+
exit 1; \
20+
fi
21+
twine upload dist/*

README.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,56 @@
1-
# Addok plugin for France specifics
1+
# addok-france
22

3-
## Installation
3+
Addok plugin for France-specific address geocoding with advanced query processing and result formatting.
4+
5+
## Features
46

5-
pip install addok-france
7+
- **Query preprocessing**: Extract and clean French address components
8+
- **Ordinal number handling**: Proper processing of ordinal numbers (1er, 2ème, etc.)
9+
- **House number flagging**: Specialized handling of French house numbers
10+
- **French labels**: France-specific result label formatting
11+
12+
## Installation
613

14+
```bash
15+
pip install addok-france
16+
```
717

818
## Configuration
919

10-
- Add QUERY_PROCESSORS_PYPATHS
20+
### Query processors
21+
22+
Add France-specific query processors to handle address extraction and cleaning:
23+
24+
```python
25+
QUERY_PROCESSORS_PYPATHS = [
26+
…,
27+
"addok_france.extract_address",
28+
"addok_france.clean_query",
29+
]
30+
```
31+
32+
### String processors
33+
34+
Add processors for ordinal numbers and house number handling:
1135

12-
QUERY_PROCESSORS_PYPATHS = [
13-
…,
14-
"addok_france.extract_address",
15-
"addok_france.clean_query",
16-
]
36+
```python
37+
PROCESSORS_PYPATHS = [
38+
…,
39+
"addok_france.glue_ordinal",
40+
"addok_france.fold_ordinal",
41+
"addok_france.flag_housenumber",
42+
…,
43+
]
44+
```
1745

18-
- Add PROCESSORS_PYPATHS
46+
### Result processors
1947

20-
PROCESSORS_PYPATHS = [
21-
…,
22-
"addok_france.glue_ordinal",
23-
"addok_france.fold_ordinal",
24-
"addok_france.flag_housenumber",
25-
…,
26-
]
48+
Replace default `make_labels` with France-specific label formatting:
2749

28-
- Replace default `make_labels` by France dedicated one:
50+
```python
51+
SEARCH_RESULT_PROCESSORS_PYPATHS = [
52+
'addok_france.make_labels',
53+
…,
54+
]
55+
```
2956

30-
SEARCH_RESULT_PROCESSORS_PYPATHS = [
31-
'addok_france.make_labels',
32-
…,
33-
]

pyproject.toml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[build-system]
2+
requires = ["setuptools>=65.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "addok-france"
7+
version = "1.1.3"
8+
description = "Addok plugin for France-specific address geocoding."
9+
readme = "README.md"
10+
authors = [
11+
{name = "Yohan Boniface", email = "yohan.boniface@data.gouv.fr"}
12+
]
13+
license = "MIT"
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"Intended Audience :: Developers",
17+
"Topic :: Scientific/Engineering :: GIS",
18+
"Programming Language :: Python :: 3",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
23+
"Programming Language :: Python :: 3.13",
24+
"Programming Language :: Python :: 3.14",
25+
]
26+
keywords = ["addok", "geocoding", "france", "plugin"]
27+
requires-python = ">=3.9"
28+
dependencies = [
29+
"addok",
30+
]
31+
32+
[project.optional-dependencies]
33+
dev = [
34+
"pytest~=8.3",
35+
"pytest-cov~=6.1",
36+
"build~=1.2",
37+
"twine==6.1.0",
38+
]
39+
40+
[project.urls]
41+
Homepage = "https://github.com/etalab/addok-france"
42+
43+
[project.entry-points."addok.ext"]
44+
france = "addok_france"
45+
46+
[tool.setuptools]
47+
include-package-data = true
48+
49+
[tool.setuptools.packages.find]
50+
exclude = ["tests*", "venv*", ".venv*", "build*", "dist*"]
51+
52+
[tool.pytest.ini_options]
53+
addopts = "-x"

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)