Repository navigation
feat(python): add PMTiles archive helper - #870
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Explicit archive layer styling crates/tiles/src/source.rs |
archive_style now generates layers for explicitly selected vector source layers after checking for a custom style. Tests cover generated fill, line, and point layers, and custom-style precedence. |
Python PMTiles API and coverage apps/rustgis-python/python/rustgis/__init__.py, apps/rustgis-python/tests/*, apps/rustgis-python/README.md, docs/python.md |
add_pmtiles accepts a URL or path and optional source layers, style, and tile parameters. Tests cover serialization, local archive bounds, undo, invalid styles, and widget updates. The example and documentation describe PMTiles usage and requirements. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant Caller
participant PythonAPI as _Api.add_pmtiles
participant MapTiles as map.addTiles
participant ArchiveStyle as archive_style
Caller->>PythonAPI: add PMTiles URL or path
PythonAPI->>MapTiles: forward PMTiles kind and optional style parameters
MapTiles->>ArchiveStyle: provide archive style specification
ArchiveStyle->>MapTiles: return selected or generated style
Suggested reviewers: giswqs
Merge Risk: 
Minimal · up to 8526c
-
No specific issue remains that calls for a fix before merging. Normal validation is appropriate.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title "feat(python): add PMTiles archive helper" matches the main change. The PR adds Session.add_pmtiles and Map.add_pmtiles for PMTiles archives by URL or local path. It also includes a related fix to the shared tile archive style resolver, which the title does not mention. The title is specific and concise, and it follows the conventional commit style.
Full details: Description check
-
Explanation
The description follows the repository template. It has a Summary section that explains the new Session.add_pmtiles and Map.add_pmtiles helpers, the notebook project synchronization, the resolver change for explicit source layers, and the documented browser-accessible URL limitation. It has a Testing section that lists the Python test run, the offline regressions, the tiles library tests, cargo xtask ci, pre-commit, and the wasm build, along with the platforms not exercised. It has a Related issue section that references Part of
#557and states that only the Python item is covered.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 4 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit adds an atlas tile,
A map now reads the archive file.
Source layers bloom in lines and fill,
Styles take shape by caller’s will.
The notebook shows the path ahead,
And tests check what the layers said.
Comment @coderabbitai help to get the list of available commands.
Code reviewI found nothing that needs fixing in this PR, and I posted no inline comments. It adds Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 1890b5a to PR head 8526c27).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
Summary
Python currently needs raw
map.addTilescalls to add a PMTiles archive. AddSession.add_pmtilesandMap.add_pmtilesfor PMTiles archives by URL or local path. The shared helper usesmap.addTiles, mapssource_layersandstyleto its existing parameters, and preserves the notebook's project synchronization. No dependency, engine command or project-format changes.The shared tile archive style resolver also honors explicitly selected source layers, reusing the existing named-layer style generator. Previously the setting was saved but ignored in favor of archive metadata or the basemap guess. Custom styles retain precedence, as they do for vector tile templates.
Document the helper and the existing notebook limitation: a local archive is not embedded in the browser, so use a browser-accessible URL there.
Testing
Built and installed the current Python package with maturin; all 33 Python tests pass with notebook and GeoPandas dependencies installed.
New offline regressions cover extensionless URLs, source layers, structured/JSON-text styles, project reopening, a generated local archive passed as a Path, default naming, archive bounds, undo, rejected styles and notebook project synchronization.
All 168 tiles library tests pass. The new archive-style regression fails on the unmodified resolver (32 basemap style layers instead of the chosen layer's 3), and passes with the fix; it also covers explicitly chosen basemap-like names and custom-style precedence.
cargo xtask ci: formatting, Clippy with warnings denied, 2,176 tests passed (16 ignored), andlayers: ok.uvx pre-commit run --all-files.cargo build --locked --target wasm32-unknown-unknown -p rustgis-web.Local validation uses Linux and Python 3.12; Windows, macOS and live browser rendering were not exercised locally.
Related issue
Part of #557: the Python item only. The tracking issue's remaining PMTiles parity items stay open.
Summary by CodeRabbit
New Features
Documentation