Skip to content

Restore default max_items behavior #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed

- Fix type annotation of `Client._stac_io` and avoid implicit re-exports in `pystac_client.__init__.py` [#249](https://github.com/stac-utils/pystac-client/pull/249)
- Restored the previous behavior of ``Client.search()`` to return an unlimited number of items by default. [#273](https://github.com/stac-utils/pystac-client/pull/273)
- Added `ItemSearch.item_collection()` as a replacement for the deprecated `ItemSearch.get_all_items()` [#237](https://github.com/stac-utils/pystac-client/issues/237)

## [v0.4.0] - 2022-06-08
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ A Python client for working with [STAC](https://stacspec.org/) Catalogs and APIs

## Table of Contents

- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Documentation](#documentation)
- [Development](#development)
- [Pull Requests](#pull-requests)
- [Pull Requests](#pull-requests)
- [Benchmark](#benchmark)

## Installation

Expand Down Expand Up @@ -70,7 +72,7 @@ $ git add <new files here>
$ git commit -a -m 'new test episodes'
```

To update pystac-client to use future versions of STAC API, the existing recorded API responsees
To update pystac-client to use future versions of STAC API, the existing recorded API responses
should be "re-recorded":

```shell
Expand Down
13 changes: 8 additions & 5 deletions pystac_client/item_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@

OPS = list(OP_MAP.keys())

DEFAULT_LIMIT_AND_MAX_ITEMS = 100
# Previously named DEFAULT_LIMIT_AND_MAX_ITEMS
# aliased for backwards compat
# https://github.com/stac-utils/pystac-client/pull/273
DEFAUL_LIMIT = DEFAULT_LIMIT_AND_MAX_ITEMS = 100


# from https://gist.github.com/angstwad/bf22d1822c38a92ec0a9#gistcomment-2622319
Expand Down Expand Up @@ -140,12 +143,12 @@ class ItemSearch:
the response, it will automatically retry with
``"GET"`` for all subsequent requests.
max_items : The maximum number of items to return from the search, even
if there are more matching results. This client to limit the
if there are more matching results. This allows the client to limit the
total number of Items returned from the :meth:`items`,
:meth:`item_collections`, and :meth:`items_as_dicts methods`. The client
will continue to request pages of items until the number of max items is
reached. This parameter defaults to 100. Setting this to ``None`` will
allow iteration over a possibly very large number of results.
reached. By default (``max_items=None``) all items matching the query
will be returned.
stac_io: An instance of StacIO for retrieving results. Normally comes
from the Client that returns this ItemSearch client: An instance of a
root Client used to set the root on resulting Items.
Expand Down Expand Up @@ -217,7 +220,7 @@ def __init__(
url: str,
*,
method: Optional[str] = "POST",
max_items: Optional[int] = DEFAULT_LIMIT_AND_MAX_ITEMS,
max_items: Optional[int] = None,
stac_io: Optional[StacApiIO] = None,
client: Optional["_client.Client"] = None,
limit: Optional[int] = DEFAULT_LIMIT_AND_MAX_ITEMS,
Expand Down
Loading