Skip to content

Commit d2fae94

Browse files
authored
Merge pull request #111 from avsm/windows-ci
ci: add a windows runner
2 parents f8d8d15 + aa97de4 commit d2fae94

File tree

12 files changed

+868
-314
lines changed

12 files changed

+868
-314
lines changed

β€Ž.github/workflows/conda.ymlβ€Ž

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheels on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [windows-latest]
12+
python-version: [3.11, 3.12, 3.13]
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: conda-incubator/setup-miniconda@v3
18+
with:
19+
auto-update-conda: true
20+
activate-environment: true
21+
environment-file: environment.yml
22+
channels: conda-forge,anaconda,main
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install Local Package
26+
run: pip install -e .
27+
28+
- name: Run CLI Tests
29+
shell: pwsh
30+
env:
31+
TERM: dumb
32+
run: .\tests\cli.ps1 -Verbose

β€Ženvironment.ymlβ€Ž

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: base
2+
channels:
3+
- defaults
4+
- conda-forge
5+
- main
6+
dependencies:
7+
- cram>=0.7
8+
- dask
9+
- geodatasets>=2024.8.0
10+
- geopandas
11+
- matplotlib
12+
- numpy>=1.24.0
13+
- pandas
14+
- pyarrow>=17.0.0
15+
- rasterio
16+
- rich
17+
- rioxarray
18+
- scikit-image>=0.25.2
19+
- scikit-learn>=1.7.1
20+
- sphinx>=8.2.3
21+
- typer
22+
- xarray
23+
- zarr

β€Žgeotessera/cli.pyβ€Ž

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,31 @@ def format_bbox(bbox_coords) -> str:
134134
def emoji(text):
135135
"""Return emoji text for smart terminals, empty string for dumb/piped output.
136136
137-
Uses Rich Console's built-in terminal detection.
137+
Uses Rich Console's built-in terminal detection plus additional checks
138+
for dumb terminals and Windows legacy console encoding issues.
138139
139140
Args:
140141
text: Emoji character(s) to display
141142
142143
Returns:
143144
The emoji text if capable terminal, empty string otherwise
144145
"""
146+
import os
147+
import sys
148+
149+
# Check for dumb terminal
150+
if os.environ.get("TERM", "").lower() == "dumb":
151+
return ""
152+
153+
# Check for Windows legacy console with cp1252 encoding
154+
if sys.platform == "win32":
155+
try:
156+
encoding = sys.stdout.encoding or ""
157+
if encoding.lower() in ("cp1252", "ascii", ""):
158+
return ""
159+
except Exception:
160+
return ""
161+
145162
# Rich Console automatically detects terminal capabilities
146163
# is_terminal is True if stdout is a TTY and not disabled
147164
return text if console.is_terminal else ""
@@ -667,6 +684,7 @@ def country_progress_callback(current: int, total: int, status: str = None):
667684
with tempfile.NamedTemporaryFile(
668685
mode="w", suffix=".geojson", delete=False
669686
) as tmp:
687+
tmp.close()
670688
country_gdf.to_file(tmp.name, driver="GeoJSON")
671689
country_geojson_file = tmp.name
672690

@@ -771,15 +789,15 @@ def country_progress_callback(current: int, total: int, status: str = None):
771789
tile_count = len(
772790
[(y, lon, lat) for y, lon, lat in available_embeddings if y == year]
773791
)
774-
rprint(f"[cyan]πŸ“Š Tiles shown: {tile_count:,} (year {year})[/cyan]")
792+
rprint(f"[cyan]{emoji('πŸ“Š ')}Tiles shown: {tile_count:,} (year {year})[/cyan]")
775793
else:
776794
unique_tiles = len(
777795
set((lon, lat) for _, lon, lat in available_embeddings)
778796
)
779797
years = sorted(set(y for y, _, _ in available_embeddings))
780-
rprint(f"[cyan]πŸ“Š Unique tile locations: {unique_tiles:,}[/cyan]")
798+
rprint(f"[cyan]{emoji('πŸ“Š ')}Unique tile locations: {unique_tiles:,}[/cyan]")
781799
if years:
782-
rprint(f"[cyan]πŸ“… Years covered: {min(years)}-{max(years)}[/cyan]")
800+
rprint(f"[cyan]{emoji('πŸ“… ')}Years covered: {min(years)}-{max(years)}[/cyan]")
783801

784802
# Also generate JSON + HTML globe visualization
785803
rprint("\n[blue]Generating interactive globe visualization...[/blue]")
@@ -1138,7 +1156,7 @@ def format_bytes(b):
11381156
)
11391157

11401158
if not tiles_to_fetch:
1141-
rprint("[yellow]⚠️ No tiles found in the specified region.[/yellow]")
1159+
rprint(f"[yellow]{emoji('⚠️ ')}No tiles found in the specified region.[/yellow]")
11421160
rprint("Try expanding your bounding box or checking data availability.")
11431161
return
11441162

@@ -1488,7 +1506,7 @@ def mark_file_complete(file_key):
14881506
)
14891507

14901508
except Exception as e:
1491-
rprint(f"\n[red]❌ Error: {e}[/red]")
1509+
rprint(f"\n[red]{emoji('❌ ')}Error: {e}[/red]")
14921510
if verbose:
14931511
rprint("\n[dim]Full traceback:[/dim]")
14941512
console.print_exception()

0 commit comments

Comments
Β (0)