Give satellite imagery, terrain data, buildings, streetview photos to your LLM
Rename src package to alephgeo
Belluxxb24a23ff6a77
diff --git a/AGENTS.md b/AGENTS.mdindex 9086a9c..d2c8492 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -4,8 +4,8 @@Aleph is a Python CLI for capturing Google Street View photos, satellite imagery, and OSM data for AI agents. It requires no browser or API key.-- `aleph.py`: command-line entry point-- `src/`: capture, networking, geometry, Street View, and terrain code+- `alephgeo/main.py`: command-line entry point+- `alephgeo/`: capture, networking, geometry, Street View, and terrain code- `tests/`: unit tests- `README.md`: setup, usage, and troubleshooting.- `resources/`: assets and resourcesdiff --git a/src/__init__.py b/alephgeo/__init__.pysimilarity index 100%rename from src/__init__.pyrename to alephgeo/__init__.pydiff --git a/src/capture.py b/alephgeo/capture.pysimilarity index 100%rename from src/capture.pyrename to alephgeo/capture.pydiff --git a/src/cli.py b/alephgeo/cli.pysimilarity index 100%rename from src/cli.pyrename to alephgeo/cli.pydiff --git a/src/common.py b/alephgeo/common.pysimilarity index 100%rename from src/common.pyrename to alephgeo/common.pydiff --git a/src/dashboard.py b/alephgeo/dashboard.pysimilarity index 100%rename from src/dashboard.pyrename to alephgeo/dashboard.pydiff --git a/src/geo.py b/alephgeo/geo.pysimilarity index 100%rename from src/geo.pyrename to alephgeo/geo.pydiff --git a/src/layers.py b/alephgeo/layers.pysimilarity index 100%rename from src/layers.pyrename to alephgeo/layers.pydiff --git a/aleph.py b/alephgeo/main.pysimilarity index 98%rename from aleph.pyrename to alephgeo/main.pyindex 1685313..5631e1a 100644--- a/aleph.py+++ b/alephgeo/main.py@@ -7,10 +7,10 @@ import sysimport textwrapfrom pathlib import Path-from src import capture, places, quick-from src.cli import parser-from src.common import CachedClient, Client, Progress, RequestError, now-from src.geo import bounds, corners, vertices+from . import capture, places, quick+from .cli import parser+from .common import CachedClient, Client, Progress, RequestError, now+from .geo import bounds, corners, verticesdef style(text, code="1"):@@ -188,7 +188,7 @@ def main(argv=None):return 0args = command.parse_args(argv)if args.command == "dashboard":- from src import dashboard+ from . import dashboardreturn dashboard.serve(args.output, args.port, cache_dir=args.cache_dir, refresh=args.refresh,open_browser=not args.no_browser)diff --git a/src/mesh.py b/alephgeo/mesh.pysimilarity index 100%rename from src/mesh.pyrename to alephgeo/mesh.pydiff --git a/src/osm.py b/alephgeo/osm.pysimilarity index 100%rename from src/osm.pyrename to alephgeo/osm.pydiff --git a/src/pbf.py b/alephgeo/pbf.pysimilarity index 100%rename from src/pbf.pyrename to alephgeo/pbf.pydiff --git a/src/places.py b/alephgeo/places.pysimilarity index 100%rename from src/places.pyrename to alephgeo/places.pydiff --git a/src/quick.py b/alephgeo/quick.pysimilarity index 100%rename from src/quick.pyrename to alephgeo/quick.pydiff --git a/src/routes.py b/alephgeo/routes.pysimilarity index 100%rename from src/routes.pyrename to alephgeo/routes.pydiff --git a/src/satellite.py b/alephgeo/satellite.pysimilarity index 100%rename from src/satellite.pyrename to alephgeo/satellite.pydiff --git a/src/streetview.py b/alephgeo/streetview.pysimilarity index 100%rename from src/streetview.pyrename to alephgeo/streetview.pydiff --git a/src/terrain.py b/alephgeo/terrain.pysimilarity index 100%rename from src/terrain.pyrename to alephgeo/terrain.pydiff --git a/src/web/app.js b/alephgeo/web/app.jssimilarity index 100%rename from src/web/app.jsrename to alephgeo/web/app.jsdiff --git a/src/web/icons/bolt.svg b/alephgeo/web/icons/bolt.svgsimilarity index 100%rename from src/web/icons/bolt.svgrename to alephgeo/web/icons/bolt.svgdiff --git a/src/web/icons/clock.svg b/alephgeo/web/icons/clock.svgsimilarity index 100%rename from src/web/icons/clock.svgrename to alephgeo/web/icons/clock.svgdiff --git a/src/web/icons/error.svg b/alephgeo/web/icons/error.svgsimilarity index 100%rename from src/web/icons/error.svgrename to alephgeo/web/icons/error.svgdiff --git a/src/web/icons/map.svg b/alephgeo/web/icons/map.svgsimilarity index 100%rename from src/web/icons/map.svgrename to alephgeo/web/icons/map.svgdiff --git a/src/web/icons/mesh.svg b/alephgeo/web/icons/mesh.svgsimilarity index 100%rename from src/web/icons/mesh.svgrename to alephgeo/web/icons/mesh.svgdiff --git a/src/web/icons/osm.svg b/alephgeo/web/icons/osm.svgsimilarity index 100%rename from src/web/icons/osm.svgrename to alephgeo/web/icons/osm.svgdiff --git a/src/web/icons/pencil.svg b/alephgeo/web/icons/pencil.svgsimilarity index 100%rename from src/web/icons/pencil.svgrename to alephgeo/web/icons/pencil.svgdiff --git a/src/web/icons/polygon.svg b/alephgeo/web/icons/polygon.svgsimilarity index 100%rename from src/web/icons/polygon.svgrename to alephgeo/web/icons/polygon.svgdiff --git a/src/web/icons/rectangle.svg b/alephgeo/web/icons/rectangle.svgsimilarity index 100%rename from src/web/icons/rectangle.svgrename to alephgeo/web/icons/rectangle.svgdiff --git a/src/web/icons/satellite.svg b/alephgeo/web/icons/satellite.svgsimilarity index 100%rename from src/web/icons/satellite.svgrename to alephgeo/web/icons/satellite.svgdiff --git a/src/web/icons/sides.svg b/alephgeo/web/icons/sides.svgsimilarity index 100%rename from src/web/icons/sides.svgrename to alephgeo/web/icons/sides.svgdiff --git a/src/web/icons/sphere.svg b/alephgeo/web/icons/sphere.svgsimilarity index 100%rename from src/web/icons/sphere.svgrename to alephgeo/web/icons/sphere.svgdiff --git a/src/web/icons/streetview.svg b/alephgeo/web/icons/streetview.svgsimilarity index 100%rename from src/web/icons/streetview.svgrename to alephgeo/web/icons/streetview.svgdiff --git a/src/web/icons/terrain.svg b/alephgeo/web/icons/terrain.svgsimilarity index 100%rename from src/web/icons/terrain.svgrename to alephgeo/web/icons/terrain.svgdiff --git a/src/web/icons/turtle.svg b/alephgeo/web/icons/turtle.svgsimilarity index 100%rename from src/web/icons/turtle.svgrename to alephgeo/web/icons/turtle.svgdiff --git a/src/web/icons/warning.svg b/alephgeo/web/icons/warning.svgsimilarity index 100%rename from src/web/icons/warning.svgrename to alephgeo/web/icons/warning.svgdiff --git a/src/web/index.html b/alephgeo/web/index.htmlsimilarity index 100%rename from src/web/index.htmlrename to alephgeo/web/index.htmldiff --git a/src/web/style.css b/alephgeo/web/style.csssimilarity index 100%rename from src/web/style.cssrename to alephgeo/web/style.cssdiff --git a/pyproject.toml b/pyproject.tomlindex f419c8f..3dd23e3 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -11,11 +11,10 @@ requires-python = ">=3.11"dependencies = ["Pillow>=10", "numpy>=1.25", "truststore>=0.10"][project.scripts]-alephgeo = "aleph:main"+alephgeo = "alephgeo.main:main"-[tool.setuptools]-py-modules = ["aleph"]-packages = ["src"]+[tool.setuptools.packages.find]+include = ["alephgeo*"][tool.setuptools.package-data]-src = ["web/*", "web/icons/*"]+alephgeo = ["web/*", "web/icons/*"]diff --git a/tests/test_capture.py b/tests/test_capture.pyindex 4789809..3153685 100644--- a/tests/test_capture.py+++ b/tests/test_capture.py@@ -10,9 +10,9 @@ from urllib.parse import parse_qs, urlsplitfrom PIL import Image-from src import capture, quick, streetview-from src.common import MissingImagery-from src.geo import coordinate, corners+from alephgeo import capture, quick, streetview+from alephgeo.common import MissingImagery+from alephgeo.geo import coordinate, cornersdef image_bytes(size=(256, 256)):@@ -112,7 +112,7 @@ class CaptureTests(unittest.TestCase):client = Mock()client.get.return_value = image_bytes()with (- patch("src.capture.satellite.merge", side_effect=OSError("disk full")),+ patch("alephgeo.capture.satellite.merge", side_effect=OSError("disk full")),self.assertRaisesRegex(OSError, "disk full"),):capture.download(run, self.folder, client, self.progress)diff --git a/tests/test_common.py b/tests/test_common.pyindex a629dac..de027cd 100644--- a/tests/test_common.py+++ b/tests/test_common.py@@ -7,7 +7,7 @@ from pathlib import Pathfrom tempfile import TemporaryDirectoryfrom unittest.mock import patch-from src.common import Client, contained+from alephgeo.common import Client, containeddef response(data, length):@@ -22,9 +22,9 @@ class DownloadTests(unittest.TestCase):target = Path(directory) / "region.pbf"target.write_bytes(b"previous snapshot")with (- patch("src.common.urlopen", side_effect=lambda *a, **k: response(b"short", 20)) as get,- patch("src.common.time.sleep"),- patch("src.common.time.monotonic", side_effect=count(step=10)),+ patch("alephgeo.common.urlopen", side_effect=lambda *a, **k: response(b"short", 20)) as get,+ patch("alephgeo.common.time.sleep"),+ patch("alephgeo.common.time.monotonic", side_effect=count(step=10)),self.assertRaisesRegex(OSError, "Incomplete download"),):Client().get("https://example.test/region", destination=target)@@ -41,9 +41,9 @@ class DownloadTests(unittest.TestCase):self.assertEqual(target.read_bytes(), b"previous snapshot")with (- patch("src.common.urlopen", side_effect=[response(b"short", 20), response(b"complete", 8)]),- patch("src.common.time.sleep"),- patch("src.common.time.monotonic", side_effect=count(step=10)),+ patch("alephgeo.common.urlopen", side_effect=[response(b"short", 20), response(b"complete", 8)]),+ patch("alephgeo.common.time.sleep"),+ patch("alephgeo.common.time.monotonic", side_effect=count(step=10)),):result = Client().get("https://example.test/region", destination=target, progress=progress)self.assertEqual(result, target)@@ -59,7 +59,7 @@ class DownloadTests(unittest.TestCase):raise KeyboardInterruptwith (- patch("src.common.urlopen", return_value=response(b"new snapshot", 12)) as get,+ patch("alephgeo.common.urlopen", return_value=response(b"new snapshot", 12)) as get,self.assertRaises(KeyboardInterrupt),):Client().get("https://example.test/region", destination=target, progress=interrupt)@@ -73,9 +73,9 @@ class DownloadTests(unittest.TestCase):raise ValueError("Unreadable response.")with (- patch("src.common.urlopen", side_effect=[response(b"garbage", 7), response(b"good", 4)]) as get,- patch("src.common.time.sleep"),- patch("src.common.time.monotonic", side_effect=count(step=10)),+ patch("alephgeo.common.urlopen", side_effect=[response(b"garbage", 7), response(b"good", 4)]) as get,+ patch("alephgeo.common.time.sleep"),+ patch("alephgeo.common.time.monotonic", side_effect=count(step=10)),):self.assertEqual(Client().get("https://example.test/meta", check=check), b"good")self.assertEqual(get.call_count, 2)diff --git a/tests/test_imagery.py b/tests/test_imagery.pyindex 61c39d8..51e6501 100644--- a/tests/test_imagery.py+++ b/tests/test_imagery.py@@ -12,7 +12,7 @@ from unittest.mock import patchfrom PIL import Image-from src import geo, layers, satellite, terrain+from alephgeo import geo, layers, satellite, terraindef quiet(*args):@@ -63,7 +63,7 @@ class SatelliteTests(unittest.TestCase):with canvas.crop((3, 7, 304, 266)) as expected:# Force BigTIFF using a small file; never allocate gigabytes.for limit, magic in ((2**32, b"II*\0"), (1, b"II+\0")):- with self.subTest(format=magic), patch("src.satellite.TIFF_LIMIT", limit):+ with self.subTest(format=magic), patch("alephgeo.satellite.TIFF_LIMIT", limit):satellite.merge(stage, folder, quiet, area)self.assertEqual((folder / "satellite.tif").read_bytes()[:4], magic)with Image.open(folder / "satellite.png") as png:diff --git a/tests/test_mesh.py b/tests/test_mesh.pyindex 73d9618..f403362 100644--- a/tests/test_mesh.py+++ b/tests/test_mesh.py@@ -9,9 +9,9 @@ from pathlib import Pathfrom tempfile import TemporaryDirectoryfrom unittest.mock import Mock, patch-from src import capture, mesh-from src.common import MissingImagery, write_bytes-from src.geo import corners+from alephgeo import capture, mesh+from alephgeo.common import MissingImagery, write_bytes+from alephgeo.geo import cornersRADIUS = 6371010.0AREA = (-1e-4, -1e-4, 1e-4, 1e-4) # About 22 m square around latitude 0, longitude 0.diff --git a/tests/test_pbf.py b/tests/test_pbf.pyindex 67d8663..6cf796c 100644--- a/tests/test_pbf.py+++ b/tests/test_pbf.py@@ -7,8 +7,8 @@ import zlibfrom pathlib import Pathfrom tempfile import TemporaryDirectory-from src import pbf-from src.geo import corners+from alephgeo import pbf+from alephgeo.geo import cornersdef uint(value):diff --git a/tests/test_routes.py b/tests/test_routes.pyindex 1482fe5..8944c35 100644--- a/tests/test_routes.py+++ b/tests/test_routes.py@@ -9,8 +9,8 @@ from unittest.mock import Mock, patchfrom PIL import Image-from src import quick, routes-from src.geo import Line, destination+from alephgeo import quick, routes+from alephgeo.geo import Line, destinationclass RouteSamplingTests(unittest.TestCase):@@ -103,10 +103,10 @@ class BranchedStreetTests(unittest.TestCase):({"stops": 1, "route": 2}, [2], 1, [2])]for options, section_ids, requested, photographed in cases:with (self.subTest(options=options), TemporaryDirectory() as directory,- patch("src.quick.places.choose", return_value=self.place),- patch("src.quick.coverage", return_value=list(views.values())) as coverage,- patch("src.quick.streetview.metadata_url", side_effect=lambda pano_id: pano_id),- patch("src.quick.streetview.parse_metadata", side_effect=lambda data, **kwargs: data)):+ patch("alephgeo.quick.places.choose", return_value=self.place),+ patch("alephgeo.quick.coverage", return_value=list(views.values())) as coverage,+ patch("alephgeo.quick.streetview.metadata_url", side_effect=lambda pano_id: pano_id),+ patch("alephgeo.quick.streetview.parse_metadata", side_effect=lambda data, **kwargs: data)):result = quick.street_photos(self.client, directory, lambda *args: None,street="Test Street", view="both", **options)self.assertEqual([section["route"] for section in result["routes"]], section_ids)