From 9669f05f928d4630e76235767589539aaf8c9ef6 Mon Sep 17 00:00:00 2001 From: "tiago.peres.sousa" Date: Fri, 14 Feb 2025 11:30:56 +0000 Subject: [PATCH] Remove shapely from dependencies --- .github/workflows/main.yaml | 12 ------------ datacosmos/stac/item/models/item_update.py | 12 ++++++++---- pyproject.toml | 3 +-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a2b4edb..0ae32d6 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -14,8 +14,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Install GEOS - run: sudo apt update && sudo apt install libgeos-dev - name: Install uv run: pip install uv - name: Set up uv environment @@ -33,8 +31,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Install GEOS - run: sudo apt update && sudo apt install libgeos-dev - name: Install uv run: pip install uv - name: Set up uv environment @@ -51,8 +47,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Install GEOS - run: sudo apt update && sudo apt install libgeos-dev - name: Install uv run: pip install uv - name: Set up uv environment @@ -69,8 +63,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Install GEOS - run: sudo apt update && sudo apt install libgeos-dev - name: Install uv run: pip install uv - name: Set up uv environment @@ -88,8 +80,6 @@ jobs: needs: [bandit, cognitive, lint, pydocstyle] steps: - uses: actions/checkout@v3 - - name: Install GEOS - run: sudo apt update && sudo apt install libgeos-dev - name: Install uv run: pip install uv - name: Set up uv environment @@ -108,8 +98,6 @@ jobs: if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v3 - - name: Install GEOS - run: sudo apt update && sudo apt install libgeos-dev - name: Install uv run: pip install uv - name: Set up uv environment diff --git a/datacosmos/stac/item/models/item_update.py b/datacosmos/stac/item/models/item_update.py index 338df78..3fbf8cf 100644 --- a/datacosmos/stac/item/models/item_update.py +++ b/datacosmos/stac/item/models/item_update.py @@ -4,7 +4,6 @@ from pydantic import BaseModel, Field, model_validator from pystac import Asset, Link -from shapely.geometry import mapping class ItemUpdate(BaseModel): @@ -21,9 +20,14 @@ class ItemUpdate(BaseModel): assets: Optional[dict[str, Asset]] = None links: Optional[list[Link]] = None - def set_geometry(self, geom) -> None: - """Convert a shapely geometry to GeoJSON format.""" - self.geometry = mapping(geom) + def set_geometry(self, geom_type: str, coordinates: list[Any]) -> None: + """Set the geometry manually without using shapely. + + Args: + geom_type (str): The type of geometry (e.g., 'Point', 'Polygon'). + coordinates (list[Any]): The coordinates defining the geometry. + """ + self.geometry = {"type": geom_type, "coordinates": coordinates} @staticmethod def has_valid_datetime(properties: dict[str, Any]) -> bool: diff --git a/pyproject.toml b/pyproject.toml index f36d303..ab723d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,8 +20,7 @@ dependencies = [ "oauthlib==3.2.0", "requests-oauthlib==1.3.1", "pydantic==2.10.6", - "pystac==1.12.1", - "shapely==1.8.0" + "pystac==1.12.1" ] [project.optional-dependencies]