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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,7 @@ pyrightconfig.json
.vscode
output
tmp
extract
extract

# File(s) fetched by hatch-openzim plugin
scraper/src/maps2zim/assets/mapbox-gl-rtl-text.js
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Remove pin button with display of coordinates and zoom (#58)
- Remove style selector (#57)
- Switch to automatically chosen map style based on prefer-colors-scheme (#56)
- Fix support of RTL strings in the map (#54)
- Move from --assets to --dl CLI param for code clarity (#68)
- Fix bad favicon paths (#68)

## [0.1.1] - 2026-03-10

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ WORKDIR /output

# Copy pyproject.toml and its dependencies
COPY README.md /src/
COPY scraper/pyproject.toml /src/scraper/
COPY scraper/pyproject.toml scraper/openzim.toml /src/scraper/
COPY scraper/src/maps2zim/__about__.py /src/scraper/src/maps2zim/__about__.py

# Install Python dependencies
Expand Down
7 changes: 7 additions & 0 deletions scraper/openzim.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[files.assets.config]
target_dir="src/maps2zim/assets"

[files.assets.actions."mapbox-gl-rtl-text"]
action="get_file"
source="https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.4.0/dist/mapbox-gl-rtl-text.js"
target_file="mapbox-gl-rtl-text.js"
2 changes: 2 additions & 0 deletions scraper/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ dynamic = ["authors", "classifiers", "keywords", "license", "version", "urls"]
kind = "scraper"
additional-keywords = ["openstreetmap"]

[tool.hatch.build.hooks.openzim-build]

[project.optional-dependencies]
scripts = ["invoke==2.2.1"]
lint = ["black==26.1.0", "ruff==0.15.0"]
Expand Down
6 changes: 3 additions & 3 deletions scraper/src/maps2zim/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class Context:
# info passed in User-Agent header of web requests
contact_info: str = "https://www.kiwix.org"

# temporary folder to store temporary assets (e.g. cached API response)
# temporary folder to store temporary files (e.g. cached API response)
tmp_folder: Path

# folder to fetch / store downloaded assets (can be reused across runs)
assets_folder: Path
# folder to fetch / store downloaded files (can be reused across runs)
dl_folder: Path

# folder where the ZIM will be built
output_folder: Path = Path(os.getenv("MAPS_OUTPUT", "output"))
Expand Down
10 changes: 5 additions & 5 deletions scraper/src/maps2zim/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ def prepare_context(raw_args: list[str], tmpdir: str) -> None:
)

parser.add_argument(
"--assets",
help="Folder folder to fetch / store downloaded assets (can be reused across "
"--dl",
help="Folder folder to fetch / store downloaded files (can be reused across "
"runs)",
type=Path,
dest="assets_folder",
dest="dl_folder",
)

parser.add_argument("--debug", help="Enable verbose output", action="store_true")
Expand Down Expand Up @@ -225,8 +225,8 @@ def prepare_context(raw_args: list[str], tmpdir: str) -> None:
else:
args_dict["tmp_folder"] = Path(tmpdir)

if not args_dict.get("assets_folder", None):
args_dict["assets_folder"] = args_dict["tmp_folder"] / "assets"
if not args_dict.get("dl_folder", None):
args_dict["dl_folder"] = args_dict["tmp_folder"] / "dl"

args_dict["_current_thread_workitem"] = threading.local()
args_dict["web_session"] = get_session()
Expand Down
Loading