Skip to content

Commit

Permalink
fix: drivers have been separated out of the gdal conda, bump min pyth…
Browse files Browse the repository at this point in the history
…on to 3.10 (#480)

* fix: drivers have been separated out of the gdal conda

* fix: bump min python to 3.10

* fix: reformat, remove tests that check behavior of other libs

* feat: update pre-commit

* fix: remove more broken stuff
  • Loading branch information
gadomski authored Dec 23, 2024
1 parent 059856e commit fd9a6a5
Show file tree
Hide file tree
Showing 56 changed files with 75 additions and 329 deletions.
25 changes: 4 additions & 21 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
defaults:
run:
shell: bash -l {0}
Expand All @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
defaults:
run:
shell: bash -l {0}
Expand All @@ -52,7 +52,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
defaults:
run:
shell: bash -l {0}
Expand All @@ -73,7 +73,7 @@ jobs:
continue-on-error: true
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
defaults:
run:
shell: bash -l {0}
Expand All @@ -88,23 +88,6 @@ jobs:
run: pip install -U --pre pystac rasterio --no-binary rasterio
- name: Run tests
run: scripts/test
codecov:
name: Codecov
needs:
- standard
- extra-requires
- minimum-versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Execute linters and test suites
run: ./docker/cibuild
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
docker:
name: Docker
needs:
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@

repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.265
rev: v0.8.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.3.0
hooks:
- id: codespell
args: [--ignore-words=.codespellignore]
types_or: [jupyter, markdown, python, shell]
- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
rev: v1.1.2
hooks:
- id: doc8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.14.0
hooks:
- id: mypy
# TODO lint test and scripts too
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,6 @@ Once the container is built, you can run the `scripts/` scripts inside a docker
docker/console
```

A complete build and test can be run with:

```sh
docker/cibuild
```

In scenarios where you want to run scripts in `docker/` but don't want to run the build, images can be downloaded via the `pull` script:

```sh
Expand Down
23 changes: 0 additions & 23 deletions docker/cibuild

This file was deleted.

2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ See the `stactools-packages website <https://stactools-packages.github.io>`_ and
Requirements
============

* `Python 3.8 or greater <https://www.python.org/>`_
* `Python 3.10 or greater <https://www.python.org/>`_

STAC version support
====================
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ channels:
- conda-forge
- defaults
dependencies:
- conda-forge::gdal>=3.3
- conda-forge::gdal>=3.10
- conda-forge::geos>=3.3
- conda-forge::rasterio>=1.3
- conda-forge::libstdcxx-ng # gdal dependency. Make sure it's from the same channel as gdal
- conda-forge::libarchive # gdal dependency. Make sure it's from the same channel as gdal
- conda-forge::libgdal-hdf5
- conda-forge::libgdal-jp2openjpeg
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ keywords = ["pystac", "imagery", "raster", "catalog", "STAC"]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.8"
requires-python = ">=3.10"
dependencies = [
"antimeridian>=0.2.6",
"click>=8.1.3",
Expand Down Expand Up @@ -54,7 +54,7 @@ dev = [
"pytest-cov~=3.0",
"pytest~=7.3",
"requests>=2.27.1",
"ruff==0.0.265",
"ruff~=0.8.0",
"types-certifi~=2021.10.8",
"types-orjson~=3.6",
"types-python-dateutil~=2.8",
Expand Down Expand Up @@ -82,7 +82,7 @@ version = { attr = "stactools.core.__version__" }

[tool.ruff]
line-length = 88
select = ["E", "F", "I"]
lint.select = ["E", "F", "I"]

[tool.mypy]
mypy_path = "src"
Expand Down
23 changes: 0 additions & 23 deletions scripts/cibuild

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/rewrite_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def remap_property(item: Item, before: str, after: str) -> None:
for i, interval in enumerate(collection.extent.temporal.intervals):
for j, datetime in enumerate(interval):
if datetime:
collection.extent.temporal.intervals[i][
j
] = datetime.astimezone(UTC)
collection.extent.temporal.intervals[i][j] = (
datetime.astimezone(UTC)
)

if object.STAC_OBJECT_TYPE == "Feature":
item = cast(Item, object)
Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Union

import click

from stactools.cli import registry


Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import click
from pystac import Catalog, Item, read_file

from stactools.core import add_item


Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/add_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import click
import pystac
import pystac.utils

from stactools.core import add_asset


Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/add_raster.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import click
import pystac

from stactools.core import add_raster_to_item


Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import click
import pystac
from pystac.utils import make_absolute_href

from stactools.core.copy import copy_catalog, move_all_assets


Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import List

import click

from stactools.core import create


Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/layout.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import click
import pystac

from stactools.core import layout_catalog


Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import click
import pystac

from stactools.core import merge_all_items


Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/migrate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import click
import pystac

from stactools.core import migrate_object


Expand Down
2 changes: 1 addition & 1 deletion src/stactools/cli/commands/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def format_summary(summary: Dict[str, Any], indent: int = 4) -> str:
out = ""
for var in summary:
if type(summary[var]) == dict:
if summary[var] is dict:
out += var + ": \n" + " " * indent + str(summary[var]) + "\n"
else:
out += var + ": " + str(summary[var]) + "\n"
Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/update_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import click
from click import Command, Group
from pystac import Item

from stactools.core.utils import raster_footprint


Expand Down
1 change: 1 addition & 0 deletions src/stactools/cli/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from click import echo
from click.core import Command, Group
from pystac.version import get_stac_version

from stactools.core import __version__


Expand Down
1 change: 1 addition & 0 deletions src/stactools/core/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from pystac import Catalog, Collection, Item
from pystac.layout import BestPracticesLayoutStrategy

from stactools.core.copy import move_assets as do_move_assets


Expand Down
1 change: 1 addition & 0 deletions src/stactools/core/add_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from pystac import Asset, Collection, Item
from pystac.utils import is_absolute_href, make_relative_href

from stactools.core.copy import move_asset_file

logger = logging.getLogger(__name__)
Expand Down
5 changes: 4 additions & 1 deletion src/stactools/core/add_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def _read_bands(href: str, statistics: bool, histogram: bool) -> List[RasterBand
data, range=(minimum, maximum), bins=BINS
)
band.histogram = Histogram.create(
BINS, minimum, maximum, hist_data.tolist()
BINS,
minimum,
maximum,
hist_data.tolist(), # type: ignore
)
bands.append(band)
return bands
3 changes: 2 additions & 1 deletion src/stactools/core/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import rasterio
import shapely.geometry
import stactools.core.projection
from pystac import Asset, Item
from pystac.extensions.projection import ProjectionExtension

import stactools.core.projection

from .io import ReadHrefModifier


Expand Down
3 changes: 1 addition & 2 deletions src/stactools/core/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ class GeoInterface(Protocol):
extract geometries from objects.
"""

def __geo_interface__(self) -> Dict[str, Any]:
...
def __geo_interface__(self) -> Dict[str, Any]: ...
1 change: 1 addition & 0 deletions src/stactools/core/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import fsspec
from pystac.link import HREF
from pystac.stac_io import StacIO

from stactools.core import utils

ReadHrefModifier = Callable[[str], str]
Expand Down
1 change: 1 addition & 0 deletions src/stactools/core/io/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from lxml import etree
from lxml.etree import _Element as lxmlElement

from stactools.core.io import ReadHrefModifier, read_text


Expand Down
1 change: 1 addition & 0 deletions src/stactools/core/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pystac import Catalog
from pystac.layout import TemplateLayoutStrategy

from stactools.core import move_all_assets


Expand Down
1 change: 1 addition & 0 deletions src/stactools/core/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pystac.layout import BestPracticesLayoutStrategy
from pystac.utils import is_absolute_href, make_relative_href
from shapely.geometry import mapping, shape

from stactools.core.copy import copy_catalog, move_asset_file
from stactools.core.copy import move_assets as do_move_assets

Expand Down
Loading

0 comments on commit fd9a6a5

Please sign in to comment.