Skip to content

Commit 1e492b6

Browse files
Yuri ZmytrakovYuri Zmytrakov
authored andcommitted
fix: resolve merge conflicts
2 parents dbfe1b2 + dc20246 commit 1e492b6

File tree

26 files changed

+399
-252
lines changed

26 files changed

+399
-252
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install build dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
24+
pip install build twine
2525
2626
- name: Build and publish stac-fastapi-core
2727
working-directory: stac_fastapi/core
@@ -30,7 +30,7 @@ jobs:
3030
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
3131
run: |
3232
# Build package
33-
python setup.py sdist bdist_wheel
33+
python -m build
3434
3535
# Publish to PyPI
3636
twine upload dist/*
@@ -42,7 +42,7 @@ jobs:
4242
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
4343
run: |
4444
# Build package
45-
python setup.py sdist bdist_wheel
45+
python -m build
4646
4747
# Publish to PyPI
4848
twine upload dist/*
@@ -54,7 +54,7 @@ jobs:
5454
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
5555
run: |
5656
# Build package
57-
python setup.py sdist bdist_wheel
57+
python -m build
5858
5959
# Publish to PyPI
6060
twine upload dist/*
@@ -66,7 +66,7 @@ jobs:
6666
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
6767
run: |
6868
# Build package
69-
python setup.py sdist bdist_wheel
69+
python -m build
7070
7171
# Publish to PyPI
7272
twine upload dist/*

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
### Added
1111

12+
### Changed
13+
14+
### Fixed
15+
16+
### Removed
17+
18+
### Updated
19+
20+
21+
## [v6.6.0] - 2025-10-21
22+
23+
### Added
24+
1225
- Spatial search support for collections via `bbox` parameter on `/collections` endpoint. Collections are now indexed with a `bbox_shape` field (GeoJSON polygon) derived from their spatial extent for efficient geospatial queries when created or updated. [#481](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/481
1326
- Introduced SFEOS Tools (`sfeos_tools/`) - An installable Click-based CLI package for managing SFEOS deployments. Initial command `add-bbox-shape` adds the `bbox_shape` field to existing collections for spatial search compatibility. Install with `pip install sfeos-tools[elasticsearch]` or `pip install sfeos-tools[opensearch]`. [#481](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/481)
1427
- Moved SFEOS Tools to its own repository at [Healy-Hyperspatial/sfeos-tools](https://github.com/Healy-Hyperspatial/sfeos-tools). The CLI package is now maintained separately. [#PR_NUMBER]
@@ -22,6 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2235
- Removed ENV_MAX_LIMIT environment variable; maximum limits are now handled by the default global limit environment variable. [#482](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/482)
2336
- Changed the default and maximum pagination limits for collections/items endpoints. [#482](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/482)
2437
- Removed the `rel=child` links to the collections from the landing page, as the listing was incomplete due to pagination. [#496](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/496)
38+
- Changed to pyproject.toml file from setup.py [#505](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/505)
2539

2640
### Fixed
2741

@@ -577,7 +591,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
577591
- Use genexp in execute_search and get_all_collections to return results.
578592
- Added db_to_stac serializer to item_collection method in core.py.
579593

580-
[Unreleased]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.5.1...main
594+
[Unreleased]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.6.0...main
595+
[v6.6.0]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.5.1...v6.6.0
581596
[v6.5.1]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.5.0...v6.5.1
582597
[v6.5.0]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.4.0...v6.5.0
583598
[v6.4.0]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.3.0...v6.4.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ These Redis configuration variables to enable proper navigation functionality in
356356
| `REDIS_HOST` | Redis server hostname or IP address for Redis configuration. | `""` | Conditional (required for standalone Redis) |
357357
| `REDIS_PORT` | Redis server port for Redis configuration. | `6379` | Conditional (required for standalone Redis) |
358358
| **Both** | | | |
359-
| `REDIS_DB` | Redis database number to use for caching. | `0` (Sentinel) / `0` (Standalone) | Optional |
359+
| `REDIS_DB` | Redis database number to use for caching. | `0` (Sentinel) / `15` (Standalone) | Optional |
360360
| `REDIS_MAX_CONNECTIONS` | Maximum number of connections in the Redis connection pool. | `10` | Optional |
361361
| `REDIS_RETRY_TIMEOUT` | Enable retry on timeout for Redis operations. | `true` | Optional |
362362
| `REDIS_DECODE_RESPONSES` | Automatically decode Redis responses to strings. | `true` | Optional |

stac_fastapi/core/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

stac_fastapi/core/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# stac-fastapi-core
2+
3+
Core functionality for stac-fastapi. For full documentation, please see the [main README](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/blob/main/README.md).
4+
5+
## Package Information
6+
7+
- **Package name**: stac-fastapi-core
8+
- **Description**: Core functionality for STAC API implementations.
9+
- **Documentation**: [https://stac-utils.github.io/stac-fastapi-elasticsearch-opensearch/](https://stac-utils.github.io/stac-fastapi-elasticsearch-opensearch/)
10+
- **Source**: [GitHub Repository](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/)
11+
12+
## Installation
13+
14+
```bash
15+
pip install stac-fastapi-core
16+
```
17+
18+
## Quick Start
19+
20+
For detailed usage and examples, please refer to the [main documentation](https://stac-utils.github.io/stac-fastapi-elasticsearch-opensearch/).

stac_fastapi/core/pyproject.toml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "stac_fastapi_core"
7+
description = "Core library for the Elasticsearch and Opensearch stac-fastapi backends."
8+
readme = "README.md"
9+
requires-python = ">=3.9"
10+
license = {text = "MIT"}
11+
authors = []
12+
classifiers = [
13+
"Intended Audience :: Developers",
14+
"Intended Audience :: Information Technology",
15+
"Intended Audience :: Science/Research",
16+
"Programming Language :: Python :: 3.9",
17+
"Programming Language :: Python :: 3.10",
18+
"Programming Language :: Python :: 3.11",
19+
"Programming Language :: Python :: 3.12",
20+
"Programming Language :: Python :: 3.13",
21+
"Programming Language :: Python :: 3.14",
22+
"License :: OSI Approved :: MIT License",
23+
]
24+
keywords = [
25+
"STAC",
26+
"STAC-API",
27+
"FastAPI",
28+
"stac-fastapi",
29+
"Elasticsearch",
30+
"Opensearch",
31+
]
32+
dynamic = ["version"]
33+
dependencies = [
34+
"fastapi~=0.109.0",
35+
"attrs>=23.2.0",
36+
"pydantic>=2.4.1,<3.0.0",
37+
"stac_pydantic~=3.3.0",
38+
"stac-fastapi.types==6.0.0",
39+
"stac-fastapi.api==6.0.0",
40+
"stac-fastapi.extensions==6.0.0",
41+
"orjson~=3.11.0",
42+
"overrides~=7.4.0",
43+
"geojson-pydantic~=1.0.0",
44+
"pygeofilter~=0.3.1",
45+
"jsonschema~=4.0.0",
46+
"slowapi~=0.1.9",
47+
"redis==6.4.0",
48+
]
49+
50+
[project.urls]
51+
Homepage = "https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch"
52+
53+
[tool.hatch.version]
54+
path = "stac_fastapi/core/version.py"
55+
56+
[tool.hatch.build.targets.sdist]
57+
exclude = ["alembic", "tests", "scripts"]
58+
59+
[tool.hatch.build.targets.wheel]
60+
only-include = ["stac_fastapi"]

stac_fastapi/core/setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

stac_fastapi/core/setup.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

stac_fastapi/core/stac_fastapi/core/redis_utils.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
import logging
55
from typing import List, Optional, Tuple
6+
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
67

78
from pydantic import field_validator
89
from pydantic_settings import BaseSettings
@@ -108,7 +109,7 @@ class RedisSettings(BaseSettings):
108109

109110
REDIS_HOST: str = ""
110111
REDIS_PORT: int = 6379
111-
REDIS_DB: int = 0
112+
REDIS_DB: int = 15
112113

113114
REDIS_MAX_CONNECTIONS: int = 10
114115
REDIS_RETRY_TIMEOUT: bool = True
@@ -218,23 +219,44 @@ async def connect_redis() -> Optional[aioredis.Redis]:
218219
return None
219220

220221

221-
async def save_self_link(
222-
redis: aioredis.Redis, token: Optional[str], self_href: str
222+
def build_url_with_token(base_url: str, token: str) -> str:
223+
"""Build URL with token parameter."""
224+
parsed = urlparse(base_url)
225+
query_params = parse_qs(parsed.query)
226+
227+
query_params["token"] = [token]
228+
229+
new_query = urlencode(query_params, doseq=True)
230+
231+
return urlunparse(
232+
(
233+
parsed.scheme,
234+
parsed.netloc,
235+
parsed.path,
236+
parsed.params,
237+
new_query,
238+
parsed.fragment,
239+
)
240+
)
241+
242+
243+
async def save_prev_link(
244+
redis: aioredis.Redis, next_url: str, current_url: str
223245
) -> None:
224-
"""Save the self link for the current token."""
225-
if token:
246+
"""Save the current page as the previous link for the next URL."""
247+
if next_url:
226248
if sentinel_settings.REDIS_SENTINEL_HOSTS:
227249
ttl_seconds = sentinel_settings.REDIS_SELF_LINK_TTL
228250
elif standalone_settings.REDIS_HOST:
229251
ttl_seconds = standalone_settings.REDIS_SELF_LINK_TTL
230-
await redis.setex(f"nav:self:{token}", ttl_seconds, self_href)
252+
await redis.setex(f"nav:{next_url}", ttl_seconds, current_url)
231253

232254

233-
async def get_prev_link(redis: aioredis.Redis, token: Optional[str]) -> Optional[str]:
255+
async def get_prev_link(redis: aioredis.Redis, current_url: str) -> Optional[str]:
234256
"""Get the previous page link for the current token."""
235-
if not token:
257+
if not current_url:
236258
return None
237-
return await redis.get(f"nav:self:{token}")
259+
return await redis.get(f"nav:{current_url}")
238260

239261

240262
async def redis_pagination_links(
@@ -248,9 +270,10 @@ async def redis_pagination_links(
248270

249271
try:
250272
if next_token:
251-
await save_self_link(redis, next_token, current_url)
273+
next_url = build_url_with_token(current_url, next_token)
274+
await save_prev_link(redis, next_url, current_url)
252275

253-
prev_link = await get_prev_link(redis, token)
276+
prev_link = await get_prev_link(redis, current_url)
254277
if prev_link:
255278
links.insert(
256279
0,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""library version."""
2-
__version__ = "6.5.1"
2+
__version__ = "6.6.0"

0 commit comments

Comments
 (0)