Skip to content

Commit

Permalink
chore(CI/CD): bump version 0.7.5 -> 0.7.6 (#463)
Browse files Browse the repository at this point in the history
* chore(CI/CD): bump version 0.7.5 -> 0.7.6

* docs: update CHANGELOG.md

* chore: remove geopandas datasets from tests

* chore: apply refurb suggestions

* chore: change test typing

* chore: set minimal versions for dependencies

* chore: bumped scipy version

* chore: remove pytest-xdist dependency

* chore: set minimal versions for dependencies

* ci: change pdm groups installation

* chore: change lightning fabrik import

* chore: bumped pytorch-lightning and pytest versions

* chore: bumped kaleido and plotly version

* chore: bumped pillow version

* chore: bumped pillow version

* chore: bumped h3ronpy version

* chore: set minimal versions for dependencies

* chore: bumped mapclassify version

* chore: bumped mapclassify version

* chore: bumped scikit-learn version

* chore: bumped scikit-learn version

* chore: bumped folium and spherical-geometry version

* chore: bumped topojson version

* chore: set minimal versions for dependencies

* chore: bump scikit learn and scipy versions

* chore: add numpy divide error ignore

---------

Co-authored-by: Kamil Raczycki <[email protected]>
  • Loading branch information
kraina-cicd and RaczeQ authored Aug 30, 2024
1 parent d6e70ba commit b02f78c
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 172 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Regenerate lock with environment markers
run: pdm lock --update-reuse --strategy inherit_metadata
- name: Generate requirements.txt
run: pdm export --no-default -G osm -G voronoi -G gtfs -G plotting -G torch -dG docs -dG visualization -f requirements -o requirements.txt
run: pdm export --no-default -G all -dG docs -dG visualization -f requirements -o requirements.txt
- name: Install dependencies
run: pip install --no-deps -r requirements.txt
- name: Install nbconvert dependency
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Regenerate lock with environment markers
run: pdm lock --update-reuse --strategy inherit_metadata
- name: Generate requirements.txt
run: pdm export --no-default -G osm -G voronoi -G gtfs -G plotting -G torch -dG docs -dG visualization -f requirements -o requirements.txt
run: pdm export --no-default -G all -dG docs -dG visualization -f requirements -o requirements.txt
- name: Install dependencies
run: pip install --no-deps -r requirements.txt
- name: Install nbconvert dependency
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-dev-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Regenerate lock with environment markers
run: pdm lock --update-reuse --strategy inherit_metadata
- name: Generate requirements.txt
run: pdm export --no-default -G docs -G visualization -f requirements -o requirements.txt
run: pdm export --no-default -dG docs -dG visualization -f requirements -o requirements.txt
- name: Install dependencies
run: pip install --no-deps -r requirements.txt
- name: Install nbconvert dependency
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/manual_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
- name: Install pdm
run: pip install pdm
- name: Generate lock with newest dependencies
run: pdm lock --lockfile pdm.newest.lock --strategy no_cross_platform -G osm -G voronoi -G gtfs -G plotting -G torch -dG test
run: pdm lock --lockfile pdm.newest.lock --strategy no_cross_platform -G all -dG test
- name: Install srai and tests dependencies
run: pdm install --lockfile pdm.newest.lock -G osm -G voronoi -G gtfs -G plotting -G torch -dG test --skip=post_install
run: pdm install --lockfile pdm.newest.lock -G all -dG test --skip=post_install
- name: Run tests with pytest
run: pdm run pytest -v --durations=20 tests

Expand All @@ -56,8 +56,8 @@ jobs:
- name: Install pdm
run: pip install pdm
- name: Generate lock with oldest dependencies
run: pdm lock --lockfile pdm.oldest.lock --strategy no_cross_platform,direct_minimal_versions -G osm -G voronoi -G gtfs -G plotting -G torch -dG test
run: pdm lock --lockfile pdm.oldest.lock --strategy no_cross_platform,direct_minimal_versions -G all -dG test
- name: Install srai and tests dependencies
run: pdm install --lockfile pdm.oldest.lock -G osm -G voronoi -G gtfs -G plotting -G torch -dG test --skip=post_install
run: pdm install --lockfile pdm.oldest.lock -G all -dG test --skip=post_install
- name: Run tests with pytest
run: pdm run pytest -v --durations=20 tests
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.7.6] - 2024-08-29

### Fixed

- Changed a typo in the `BASE_OSM_GROUPS_FILTER` (implemented by [@starsep](https://github.com/starsep)).
Expand Down Expand Up @@ -290,7 +292,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Intersection Joiner
- Geoparquet Loader

[Unreleased]: https://github.com/kraina-ai/srai/compare/0.7.5...HEAD
[Unreleased]: https://github.com/kraina-ai/srai/compare/0.7.6...HEAD

[0.7.6]: https://github.com/kraina-ai/srai/compare/0.7.5...0.7.6

[0.7.5]: https://github.com/kraina-ai/srai/compare/0.7.4...0.7.5

Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ keywords:
- geospatial
- spatial-analysis
license: Apache-2.0
version: 0.7.5
version: 0.7.6
date-released: '2022-11-23'
preferred-citation:
type: conference-paper
Expand Down
177 changes: 54 additions & 123 deletions pdm.lock

Large diffs are not rendered by default.

40 changes: 19 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "srai"
version = "0.7.5"
version = "0.7.6"
description = "A set of python modules for geospatial machine learning and data mining"
authors = [
{ name = "Piotr Gramacki", email = "[email protected]" },
Expand All @@ -12,18 +12,17 @@ authors = [
dependencies = [
"pandas",
"geopandas>=0.6",
"shapely>=2",
"shapely>=2.0.1",
"h3>=4.0.0b1",
"numpy>=1.26.0",
"geoparquet",
"pyfunctional",
"pyfunctional>=1.0.0",
"pyarrow>=13.0.0",
"topojson",
"topojson>=1.6",
"tqdm>=4.42.0",
"s2>=0.1.9",
"typeguard>=3.0.0",
"requests",
"h3ronpy>=0.18.0",
"h3ronpy>=0.20.1",
"osmnx>=1.3.0",
]
requires-python = ">=3.9"
Expand Down Expand Up @@ -59,25 +58,26 @@ Changelog = "https://github.com/kraina-ai/srai/blob/main/CHANGELOG.md"

# pdm add -G osm <library>
osm = [
"overpass",
"pillow",
"overpass>=0.7",
"pillow>=8.0.0",
"beautifulsoup4",
"quackosm>=0.9.1",
]
# pdm add -G voronoi <library>
voronoi = ["pymap3d", "haversine", "scipy", "spherical-geometry"]
voronoi = ["pymap3d>=3.0.0", "haversine>=2.0.0", "scipy>=1.10.0", "spherical-geometry>=1.3.2"]
# pdm add -G gtfs <library>
gtfs = ["gtfs-kit"]
# pdm add -G plotting <library>
plotting = [
"folium",
"mapclassify",
"folium>=0.14.0",
"mapclassify>=2.4.0",
"scikit-learn>=1.2.0",
"matplotlib>=3.2.0",
"plotly",
"kaleido<=0.2.1",
"plotly>=4.6.0",
"kaleido<=0.2.1,>=0.2.0",
] # kaleido<=0.2.1 because installation breaks on 0.2.1.post1
# pdm add -G torch <library>
torch = ["pytorch-lightning", "torch"]
torch = ["pytorch-lightning>=2.0.0", "torch"]
all = ["srai[osm,voronoi,gtfs,plotting,torch]"]


Expand All @@ -94,17 +94,15 @@ dev = ["bumpver", "types-requests"]
lint = ["pre-commit", "mypy", "docformatter[tomli]", "ruff"]
# pdm add -dG test <library>
test = [
"pytest>=7.0.0",
"pytest>=8.0.0",
"tox-pdm>=0.7.2",
"pytest-mock>=3.3.0",
"requests-mock>=1.12.1",
"pytest-check>=2.3.1",
"pytest-parametrization>=2022.2.1",
"pytest-doctestplus>=1.2.1",
"pytest-xdist",
"pyogrio",
"six",
"pytest-snapshot",
"six>=1.9.0",
"pytest-snapshot>=0.9.0",
]
# pdm add -dG visualization <library>
visualization = ["keplergl", "matplotlib"]
Expand All @@ -119,7 +117,7 @@ docs = [
"mkdocs-gen-files",
"mkdocs-awesome-pages-plugin",
"mike>=1,<2",
"scikit-learn",
"scikit-learn>=1.2.0",
"umap-learn",
]
# performance = ["scalene"]
Expand Down Expand Up @@ -192,7 +190,7 @@ close-quotes-on-newline = true
wrap-one-line = true

[tool.bumpver]
current_version = "0.7.5"
current_version = "0.7.6"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "chore(CI/CD): bump version {old_version} -> {new_version}"
commit = true
Expand Down
2 changes: 1 addition & 1 deletion srai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
for complete documentation.
"""

__version__ = "0.7.5"
__version__ = "0.7.6"
23 changes: 15 additions & 8 deletions srai/regionalizers/_spherical_voronoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ def _generate_sphere_parts() -> None:
POINT_LEFT = (0.0, -1.0, 0.0) # LON: -90; LAT: 0
POINT_RIGHT = (0.0, 1.0, 0.0) # LON: 90; LAT: 0

SPHERE_PARTS = [
SphericalPolygon([POINT_FRONT, POINT_TOP, POINT_BACK, POINT_RIGHT, POINT_FRONT]),
SphericalPolygon([POINT_FRONT, POINT_RIGHT, POINT_BACK, POINT_BOTTOM, POINT_FRONT]),
SphericalPolygon([POINT_FRONT, POINT_BOTTOM, POINT_BACK, POINT_LEFT, POINT_FRONT]),
SphericalPolygon([POINT_FRONT, POINT_LEFT, POINT_BACK, POINT_TOP, POINT_FRONT]),
]
with np.errstate(invalid="ignore"):
SPHERE_PARTS = [
SphericalPolygon([POINT_FRONT, POINT_TOP, POINT_BACK, POINT_RIGHT, POINT_FRONT]),
SphericalPolygon([POINT_FRONT, POINT_RIGHT, POINT_BACK, POINT_BOTTOM, POINT_FRONT]),
SphericalPolygon([POINT_FRONT, POINT_BOTTOM, POINT_BACK, POINT_LEFT, POINT_FRONT]),
SphericalPolygon([POINT_FRONT, POINT_LEFT, POINT_BACK, POINT_TOP, POINT_FRONT]),
]
SPHERE_PARTS_BOUNDING_BOXES = [
box(minx=0, miny=0, maxx=180, maxy=90),
box(minx=0, miny=-90, maxx=180, maxy=0),
Expand Down Expand Up @@ -185,7 +186,11 @@ def generate_voronoi_regions(

regions_parts: dict[int, list[tuple[int, list[EdgeHash]]]] = {}

for region_id, sphere_part_id, spherical_polygon_points in spherical_polygons_parts:
for (
region_id,
sphere_part_id,
spherical_polygon_points,
) in spherical_polygons_parts:
if region_id not in regions_parts:
regions_parts[region_id] = []

Expand Down Expand Up @@ -326,7 +331,9 @@ def _parse_multiprocessing_activation_threshold(
return multiprocessing_activation_threshold


def _parse_geodataframe_seeds(gdf: gpd.GeoDataFrame) -> tuple[list[Point], list[Hashable]]:
def _parse_geodataframe_seeds(
gdf: gpd.GeoDataFrame,
) -> tuple[list[Point], list[Hashable]]:
"""Transform GeoDataFrame into list of Points with index."""
seeds_wgs84 = gdf.to_crs(crs=WGS84_CRS)
region_ids: list[Hashable] = []
Expand Down
12 changes: 9 additions & 3 deletions srai/regionalizers/administrative_boundary_regionalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import Any, Optional, Union

import geopandas as gpd
import numpy as np
import topojson as tp
from shapely import union
from shapely.geometry import GeometryCollection, MultiPolygon, Point, Polygon
Expand Down Expand Up @@ -188,7 +189,8 @@ def transform(self, gdf: gpd.GeoDataFrame) -> gpd.GeoDataFrame:
empty_region = self._generate_empty_region(mask=gdf_wgs84, regions_gdf=regions_gdf)
if not empty_region.is_empty:
regions_gdf.loc[
AdministrativeBoundaryRegionalizer.EMPTY_REGION_NAME, GEOMETRY_COLUMN
AdministrativeBoundaryRegionalizer.EMPTY_REGION_NAME,
GEOMETRY_COLUMN,
] = empty_region

return regions_gdf
Expand All @@ -205,7 +207,9 @@ def _generate_regions_from_all_geometries(

with tqdm(desc="Loading boundaries: 0", total=len(all_geometries)) as pbar:
for geometry in all_geometries:
if not geometry.covered_by(unary_geometry):
with np.errstate(invalid="ignore"):
is_covered = geometry.covered_by(unary_geometry)
if not is_covered:
query = self._generate_query_for_single_geometry(geometry)
boundaries_list = self._query_overpass(query)
for boundary in boundaries_list:
Expand Down Expand Up @@ -366,7 +370,9 @@ def _check_intersects_with_points(
)

def _calculate_intersection_area_fraction(
self, region_geometry: BaseGeometry, clipping_polygon_area: Optional[BaseGeometry]
self,
region_geometry: BaseGeometry,
clipping_polygon_area: Optional[BaseGeometry],
) -> float:
"""Calculate intersection area fraction to check if it's big enough."""
if clipping_polygon_area is None or clipping_polygon_area.is_empty:
Expand Down
4 changes: 2 additions & 2 deletions tests/embedders/geovex/test_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def test_embedder_save_load() -> None:
assert isinstance(loaded_embedder._model, GeoVexModel)

# safely clean up tmp_models directory
os.remove(tmp_models_dir / "test_model" / "model.pt")
os.remove(tmp_models_dir / "test_model" / "config.json")
(tmp_models_dir / "test_model" / "model.pt").unlink()
(tmp_models_dir / "test_model" / "config.json").unlink()
os.rmdir(tmp_models_dir / "test_model")
os.rmdir(tmp_models_dir)
2 changes: 1 addition & 1 deletion tests/embedders/geovex/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pandas as pd
import pytest
import torch
from lightning_fabric import seed_everything
from pytorch_lightning import seed_everything

from srai.embedders.geovex.embedder import GeoVexEmbedder
from srai.embedders.geovex.model import GeoVexModel
Expand Down
4 changes: 2 additions & 2 deletions tests/loaders/osm_way_loader/test_osm_way_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def test_contract(
area_gdf = request.getfixturevalue(area_gdf_fixture)
nodes_expected_len, edges_expected_len = expected_result or (None, None)

def patched_graph_from_polygon(f_name: str, *args, **kwargs) -> Any: # type: ignore
def patched_graph_from_polygon(f_name: Optional[str], *args, **kwargs) -> Any: # type: ignore
if f_name == "type_error":
raise TypeError
elif f_name == "empty_overpass_response":
Expand All @@ -254,7 +254,7 @@ def patched_graph_from_polygon(f_name: str, *args, **kwargs) -> Any: # type: ig
raise osmnx._errors.EmptyOverpassResponse

files_path = Path(__file__).parent / "test_files"
file_name = f_name + ".pkl"
file_name = (f_name or "") + ".pkl"
file_path = files_path / file_name

with file_path.open("rb") as f:
Expand Down
5 changes: 3 additions & 2 deletions tests/regionalizers/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ def gdf_earth_poles(earth_poles) -> gpd.GeoDataFrame:
@pytest.fixture # type: ignore
def gdf_poland() -> gpd.GeoDataFrame:
"""Get Poland GeoDataFrame."""
world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
area = world[world.name == "Poland"]
area = gpd.read_file(
"https://raw.githubusercontent.com/johan/world.geo.json/master/countries/POL.geo.json"
)
return area


Expand Down

0 comments on commit b02f78c

Please sign in to comment.