Skip to content

Refactor into opencartograph package with enhancements#2

Merged
rramboer merged 6 commits into
mainfrom
refactor/opencartograph-package
Apr 4, 2026
Merged

Refactor into opencartograph package with enhancements#2
rramboer merged 6 commits into
mainfrom
refactor/opencartograph-package

Conversation

@rramboer
Copy link
Copy Markdown
Owner

@rramboer rramboer commented Apr 4, 2026

Summary

  • Merge upstream PR Refactor monolithic script into maptoposter package originalankur/maptoposter#209: extract monolithic create_map_poster.py into a proper Python package with 17 modules, frozen dataclasses, composable render pipeline, and 85 unit tests
  • Rename package from maptoposter to opencartograph
  • Remove backward-compat shims (create_map_poster.py, font_management.py)
  • Add --no-text flag for generating posters without text overlay
  • Enable OSMnx caching (ox.settings.use_cache) for faster repeat runs
  • Expand park/green space tags to include cemeteries and woodland
  • Update CLI branding, examples, and help text for OpenCartograph
  • Rewrite README for new package structure

Test plan

  • All 85 unit tests pass
  • opencartograph --list-themes works
  • opencartograph --help shows --no-text flag
  • uv sync installs as opencartograph==0.3.0
  • No remaining references to maptoposter in .py, .toml, or .yml files

originalankur and others added 6 commits March 4, 2026 22:59
Extract the 1051-line create_map_poster.py into a proper Python package
with clear module boundaries, frozen dataclasses, a composable rendering
pipeline, and 85 unit tests — while keeping all CLI arguments identical.

Key changes:
- New maptoposter/ package with 17 modules organized by responsibility
- Frozen dataclasses (Theme, PosterConfig, Coordinates, FontSet) replace
  raw dicts, eliminating global mutable state (THEME, FONTS)
- Composable render pipeline: adding a new map layer = one function
- Duplicate road classification merged into single-pass compute_edge_styles()
- 85 pytest tests covering models, cache, text, themes, CLI, road styles
- Full type annotations (mypy clean), flake8 clean
- Backward-compatible shims: python create_map_poster.py still works
- python -m maptoposter and pip-installed `maptoposter` CLI entry point
- CI updated with pytest step

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Merge upstream PR originalankur#209: extract monolithic create_map_poster.py into
  a proper Python package with 17 modules, frozen dataclasses, composable
  render pipeline, and 85 unit tests
- Rename package from maptoposter to opencartograph
- Remove backward-compat shims (create_map_poster.py, font_management.py)
- Add --no-text flag for generating posters without text overlay
- Enable OSMnx caching (ox.settings.use_cache) for faster repeat runs
- Expand park/green space tags to include cemeteries and woodland
- Update CLI branding, examples, and help text for OpenCartograph
- Rewrite README for new package structure
Narrow broad exception handlers to specific exception types across osm,
fonts, layers, and theme modules. Bump version to 0.4.0 to avoid
collision with upstream 0.3.0. Add missing tests for --no-text flag and
compose_poster typography conditional. Fix stale user_agent, CHANGELOG,
README pip instructions, and consolidate duplicate dev dependencies.
The exceptions exist in osmnx._errors but aren't re-exported at the
top-level namespace in osmnx 2.0.7.
Replace only os.sep with a full character sanitizer that keeps
alphanumerics, dots, hyphens, and underscores. This prevents forward
slashes in cache keys from creating nested paths on Windows.
@rramboer rramboer merged commit 447f32a into main Apr 4, 2026
11 checks passed
@rramboer rramboer deleted the refactor/opencartograph-package branch May 8, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants