Skip to content

armgit / Aleph

Public Imported from GitHub
0

Give satellite imagery, terrain data, buildings, streetview photos to your LLM

Rename src package to alephgeo

Belluxxb24a23ff6a77
diff --git a/AGENTS.md b/AGENTS.md
index 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 resources
diff --git a/src/__init__.py b/alephgeo/__init__.py
similarity index 100%
rename from src/__init__.py
rename to alephgeo/__init__.py
diff --git a/src/capture.py b/alephgeo/capture.py
similarity index 100%
rename from src/capture.py
rename to alephgeo/capture.py
diff --git a/src/cli.py b/alephgeo/cli.py
similarity index 100%
rename from src/cli.py
rename to alephgeo/cli.py
diff --git a/src/common.py b/alephgeo/common.py
similarity index 100%
rename from src/common.py
rename to alephgeo/common.py
diff --git a/src/dashboard.py b/alephgeo/dashboard.py
similarity index 100%
rename from src/dashboard.py
rename to alephgeo/dashboard.py
diff --git a/src/geo.py b/alephgeo/geo.py
similarity index 100%
rename from src/geo.py
rename to alephgeo/geo.py
diff --git a/src/layers.py b/alephgeo/layers.py
similarity index 100%
rename from src/layers.py
rename to alephgeo/layers.py
diff --git a/aleph.py b/alephgeo/main.py
similarity index 98%
rename from aleph.py
rename to alephgeo/main.py
index 1685313..5631e1a 100644
--- a/aleph.py
+++ b/alephgeo/main.py
@@ -7,10 +7,10 @@ import sys
import textwrap
from 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, vertices
def style(text, code="1"):
@@ -188,7 +188,7 @@ def main(argv=None):
return 0
args = command.parse_args(argv)
if args.command == "dashboard":
- from src import dashboard
+ from . import dashboard
return 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.py
similarity index 100%
rename from src/mesh.py
rename to alephgeo/mesh.py
diff --git a/src/osm.py b/alephgeo/osm.py
similarity index 100%
rename from src/osm.py
rename to alephgeo/osm.py
diff --git a/src/pbf.py b/alephgeo/pbf.py
similarity index 100%
rename from src/pbf.py
rename to alephgeo/pbf.py
diff --git a/src/places.py b/alephgeo/places.py
similarity index 100%
rename from src/places.py
rename to alephgeo/places.py
diff --git a/src/quick.py b/alephgeo/quick.py
similarity index 100%
rename from src/quick.py
rename to alephgeo/quick.py
diff --git a/src/routes.py b/alephgeo/routes.py
similarity index 100%
rename from src/routes.py
rename to alephgeo/routes.py
diff --git a/src/satellite.py b/alephgeo/satellite.py
similarity index 100%
rename from src/satellite.py
rename to alephgeo/satellite.py
diff --git a/src/streetview.py b/alephgeo/streetview.py
similarity index 100%
rename from src/streetview.py
rename to alephgeo/streetview.py
diff --git a/src/terrain.py b/alephgeo/terrain.py
similarity index 100%
rename from src/terrain.py
rename to alephgeo/terrain.py
diff --git a/src/web/app.js b/alephgeo/web/app.js
similarity index 100%
rename from src/web/app.js
rename to alephgeo/web/app.js
diff --git a/src/web/icons/bolt.svg b/alephgeo/web/icons/bolt.svg
similarity index 100%
rename from src/web/icons/bolt.svg
rename to alephgeo/web/icons/bolt.svg
diff --git a/src/web/icons/clock.svg b/alephgeo/web/icons/clock.svg
similarity index 100%
rename from src/web/icons/clock.svg
rename to alephgeo/web/icons/clock.svg
diff --git a/src/web/icons/error.svg b/alephgeo/web/icons/error.svg
similarity index 100%
rename from src/web/icons/error.svg
rename to alephgeo/web/icons/error.svg
diff --git a/src/web/icons/map.svg b/alephgeo/web/icons/map.svg
similarity index 100%
rename from src/web/icons/map.svg
rename to alephgeo/web/icons/map.svg
diff --git a/src/web/icons/mesh.svg b/alephgeo/web/icons/mesh.svg
similarity index 100%
rename from src/web/icons/mesh.svg
rename to alephgeo/web/icons/mesh.svg
diff --git a/src/web/icons/osm.svg b/alephgeo/web/icons/osm.svg
similarity index 100%
rename from src/web/icons/osm.svg
rename to alephgeo/web/icons/osm.svg
diff --git a/src/web/icons/pencil.svg b/alephgeo/web/icons/pencil.svg
similarity index 100%
rename from src/web/icons/pencil.svg
rename to alephgeo/web/icons/pencil.svg
diff --git a/src/web/icons/polygon.svg b/alephgeo/web/icons/polygon.svg
similarity index 100%
rename from src/web/icons/polygon.svg
rename to alephgeo/web/icons/polygon.svg
diff --git a/src/web/icons/rectangle.svg b/alephgeo/web/icons/rectangle.svg
similarity index 100%
rename from src/web/icons/rectangle.svg
rename to alephgeo/web/icons/rectangle.svg
diff --git a/src/web/icons/satellite.svg b/alephgeo/web/icons/satellite.svg
similarity index 100%
rename from src/web/icons/satellite.svg
rename to alephgeo/web/icons/satellite.svg
diff --git a/src/web/icons/sides.svg b/alephgeo/web/icons/sides.svg
similarity index 100%
rename from src/web/icons/sides.svg
rename to alephgeo/web/icons/sides.svg
diff --git a/src/web/icons/sphere.svg b/alephgeo/web/icons/sphere.svg
similarity index 100%
rename from src/web/icons/sphere.svg
rename to alephgeo/web/icons/sphere.svg
diff --git a/src/web/icons/streetview.svg b/alephgeo/web/icons/streetview.svg
similarity index 100%
rename from src/web/icons/streetview.svg
rename to alephgeo/web/icons/streetview.svg
diff --git a/src/web/icons/terrain.svg b/alephgeo/web/icons/terrain.svg
similarity index 100%
rename from src/web/icons/terrain.svg
rename to alephgeo/web/icons/terrain.svg
diff --git a/src/web/icons/turtle.svg b/alephgeo/web/icons/turtle.svg
similarity index 100%
rename from src/web/icons/turtle.svg
rename to alephgeo/web/icons/turtle.svg
diff --git a/src/web/icons/warning.svg b/alephgeo/web/icons/warning.svg
similarity index 100%
rename from src/web/icons/warning.svg
rename to alephgeo/web/icons/warning.svg
diff --git a/src/web/index.html b/alephgeo/web/index.html
similarity index 100%
rename from src/web/index.html
rename to alephgeo/web/index.html
diff --git a/src/web/style.css b/alephgeo/web/style.css
similarity index 100%
rename from src/web/style.css
rename to alephgeo/web/style.css
diff --git a/pyproject.toml b/pyproject.toml
index 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.py
index 4789809..3153685 100644
--- a/tests/test_capture.py
+++ b/tests/test_capture.py
@@ -10,9 +10,9 @@ from urllib.parse import parse_qs, urlsplit
from 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, corners
def 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.py
index a629dac..de027cd 100644
--- a/tests/test_common.py
+++ b/tests/test_common.py
@@ -7,7 +7,7 @@ from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import patch
-from src.common import Client, contained
+from alephgeo.common import Client, contained
def 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 KeyboardInterrupt
with (
- 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.py
index 61c39d8..51e6501 100644
--- a/tests/test_imagery.py
+++ b/tests/test_imagery.py
@@ -12,7 +12,7 @@ from unittest.mock import patch
from PIL import Image
-from src import geo, layers, satellite, terrain
+from alephgeo import geo, layers, satellite, terrain
def 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.py
index 73d9618..f403362 100644
--- a/tests/test_mesh.py
+++ b/tests/test_mesh.py
@@ -9,9 +9,9 @@ from pathlib import Path
from tempfile import TemporaryDirectory
from 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 corners
RADIUS = 6371010.0
AREA = (-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.py
index 67d8663..6cf796c 100644
--- a/tests/test_pbf.py
+++ b/tests/test_pbf.py
@@ -7,8 +7,8 @@ import zlib
from pathlib import Path
from tempfile import TemporaryDirectory
-from src import pbf
-from src.geo import corners
+from alephgeo import pbf
+from alephgeo.geo import corners
def uint(value):
diff --git a/tests/test_routes.py b/tests/test_routes.py
index 1482fe5..8944c35 100644
--- a/tests/test_routes.py
+++ b/tests/test_routes.py
@@ -9,8 +9,8 @@ from unittest.mock import Mock, patch
from PIL import Image
-from src import quick, routes
-from src.geo import Line, destination
+from alephgeo import quick, routes
+from alephgeo.geo import Line, destination
class 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)