Skip to content

Commit

Permalink
chore: drop support for python 3.8 (#397)
Browse files Browse the repository at this point in the history
* chore: remove 3.8 from supported versions

* chore: apply pyupgrade to 3.9

* chore: upgrade dict union syntax in slippy_map_regionalizer, replace flat_map+identity with flatten

* chore: update changelog
  • Loading branch information
simonusher authored Nov 2, 2023
1 parent b9894e9 commit efd5e31
Show file tree
Hide file tree
Showing 24 changed files with 142 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]
include:
- os: macos-latest
python-version: "3.11"
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ repos:
rev: v1.17.0
hooks:
- id: refurb
args: ["--python-version", "3.8"]
args: ["--python-version", "3.9"]
language: python
language_version: python3.10
stages: [manual]
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security

## [0.6.0] - 2023-11-02

### Changed

- update code to use Python 3.9 syntax.

### Removed

- Support for Python 3.8.

## [0.5.2] - 2023-10-29

### Added
Expand Down Expand Up @@ -196,7 +206,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Intersection Joiner
- Geoparquet Loader

[unreleased]: https://github.com/srai-lab/srai/compare/0.5.2...HEAD
[unreleased]: https://github.com/srai-lab/srai/compare/0.6.0...HEAD
[0.6.0]: https://github.com/srai-lab/srai/compare/0.5.2...0.6.0
[0.5.2]: https://github.com/srai-lab/srai/compare/0.5.1...0.5.2
[0.5.1]: https://github.com/srai-lab/srai/compare/0.5.0...0.5.1
[0.5.0]: https://github.com/srai-lab/srai/compare/0.4.1...0.5.0
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ authors:
given-names: "Szymon"
orcid: "https://orcid.org/0000-0002-2047-1649"
title: "SRAI: Spatial Representations for Artificial Intelligence"
version: 0.5.2
version: 0.6.0
date-released: 2022-11-23
url: "https://kraina-ai.github.io/srai"
repository-code: "https://github.com/kraina-ai/srai"
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To make changes to srai's code base, you need to fork and then clone the GitHub

For first setup of the project locally, the following commands have to be executed.

0. Make sure you have installed at least version **3.8+** of Python.
0. Make sure you have installed at least version **3.9+** of Python.

1. Install [PDM](https://pdm.fming.dev/latest) (only if not already installed)

Expand All @@ -24,7 +24,7 @@ For first setup of the project locally, the following commands have to be execut

```sh
# Optional if you want to create venv in a specific version. More info: https://pdm.fming.dev/latest/usage/venv/#create-a-virtualenv-yourself
pdm venv create 3.8 # or any higher version of Python
pdm venv create 3.9 # or any higher version of Python
pdm install -G:all
```
Expand Down Expand Up @@ -52,7 +52,7 @@ For testing, [tox](https://tox.wiki/en/latest/) is used to allow testing on mult
To test code locally before committing, run:

```sh
tox -e python3.8 # put your python version here
tox -e python3.9 # put your python version here
```

<!-- ### Pre-commit hooks
Expand Down Expand Up @@ -82,7 +82,7 @@ Docstrings should be written following the [google convention](https://gist.gith

### Python conventions

All Python code must be written **compatible with Python 3.8+**.
All Python code must be written **compatible with Python 3.9+**.

<!-- ## Adding tests -->

Expand Down
22 changes: 1 addition & 21 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "srai"
version = "0.5.2"
version = "0.6.0"
description = "A set of python modules for geospatial machine learning and data mining"
authors = [
{ name = "Piotr Gramacki", email = "pgramacki@kraina.ai" },
Expand All @@ -26,7 +26,7 @@ dependencies = [
"requests",
"h3ronpy>=0.18.0",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
readme = "README.md"
license = { text = "Apache-2.0" }
classifiers = [
Expand All @@ -37,7 +37,6 @@ classifiers = [
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -184,7 +183,7 @@ close-quotes-on-newline = true
wrap-one-line = true

[tool.bumpver]
current_version = "0.5.2"
current_version = "0.6.0"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "chore: 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.5.2"
__version__ = "0.6.0"
4 changes: 2 additions & 2 deletions srai/embedders/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import abc
from pathlib import Path
from typing import Any, Dict, TypeVar, Union
from typing import Any, TypeVar, Union

import geopandas as gpd
import pandas as pd
Expand All @@ -19,7 +19,7 @@
class Model(LightningModule): # type: ignore
"""Class for model based on LightningModule."""

def get_config(self) -> Dict[str, Any]:
def get_config(self) -> dict[str, Any]:
"""Get model config."""
model_config = {
k: v
Expand Down
7 changes: 4 additions & 3 deletions srai/embedders/contextual_count_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
1. https://arxiv.org/abs/2111.00990
"""

from typing import Iterator, List, Optional, Tuple, Union
from collections.abc import Iterator
from typing import Optional, Union

import geopandas as gpd
import numpy as np
Expand All @@ -30,7 +31,7 @@ def __init__(
neighbourhood_distance: int,
concatenate_vectors: bool = False,
expected_output_features: Optional[
Union[List[str], OsmTagsFilter, GroupedOsmTagsFilter]
Union[list[str], OsmTagsFilter, GroupedOsmTagsFilter]
] = None,
count_subcategories: bool = False,
) -> None:
Expand Down Expand Up @@ -171,7 +172,7 @@ def _get_concatenated_embeddings(self, counts_df: pd.DataFrame) -> pd.DataFrame:

def _get_averaged_values_for_distances(
self, counts_df: pd.DataFrame
) -> Iterator[Tuple[int, npt.NDArray[np.float32]]]:
) -> Iterator[tuple[int, npt.NDArray[np.float32]]]:
"""
Generate averaged values for neighbours at given distances.
Expand Down
14 changes: 7 additions & 7 deletions srai/embedders/count_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This module contains count embedder implementation.
"""
from typing import List, Optional, Set, Union, cast
from typing import Optional, Union, cast

import geopandas as gpd
import pandas as pd
Expand All @@ -19,7 +19,7 @@ class CountEmbedder(Embedder):
def __init__(
self,
expected_output_features: Optional[
Union[List[str], OsmTagsFilter, GroupedOsmTagsFilter]
Union[list[str], OsmTagsFilter, GroupedOsmTagsFilter]
] = None,
count_subcategories: bool = True,
) -> None:
Expand Down Expand Up @@ -100,7 +100,7 @@ def transform(

def _parse_expected_output_features(
self,
expected_output_features: Optional[Union[List[str], OsmTagsFilter, GroupedOsmTagsFilter]],
expected_output_features: Optional[Union[list[str], OsmTagsFilter, GroupedOsmTagsFilter]],
) -> None:
expected_output_features_list = []

Expand All @@ -127,8 +127,8 @@ def _parse_expected_output_features(

def _parse_osm_tags_filter_to_expected_features(
self, osm_filter: OsmTagsFilter, delimiter: str = "_"
) -> List[str]:
expected_output_features: Set[str] = set()
) -> list[str]:
expected_output_features: set[str] = set()

if not self.count_subcategories:
expected_output_features.update(osm_filter.keys())
Expand All @@ -150,8 +150,8 @@ def _parse_osm_tags_filter_to_expected_features(

def _parse_grouped_osm_tags_filter_to_expected_features(
self, grouped_osm_filter: GroupedOsmTagsFilter
) -> List[str]:
expected_output_features: Set[str] = set()
) -> list[str]:
expected_output_features: set[str] = set()

if not self.count_subcategories:
expected_output_features.update(grouped_osm_filter.keys())
Expand Down
4 changes: 2 additions & 2 deletions srai/loaders/geoparquet_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from pathlib import Path
from typing import List, Optional, Union
from typing import Optional, Union

import geopandas as gpd

Expand All @@ -28,7 +28,7 @@ def load(
self,
file_path: Union[Path, str],
index_column: Optional[str] = None,
columns: Optional[List[str]] = None,
columns: Optional[list[str]] = None,
area: Optional[gpd.GeoDataFrame] = None,
) -> gpd.GeoDataFrame:
"""
Expand Down
Loading

0 comments on commit efd5e31

Please sign in to comment.