Skip to content

Fix import for latest stac_pydantic version #844

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 2 commits into from
Jun 2, 2025

Conversation

lukasbindreiter
Copy link
Contributor

Related Issue(s):

  • none, I created a PR directly

Description:

The latest release of stac_pydantic moved SearchDatetime from stac_pydantic.api.search to stac_pydantic.shared

As a consequence, using both the latest version of stac-fastapi and stac_pydantic raises an ImportError:

  File "/Users/lukasbindreiter/Documents/tilebox/stac-fastapi-tilebox/.venv/lib/python3.13/site-packages/stac_fastapi/extensions/core/collection_search/__init__.py", line 3, in <module>
    from .collection_search import (
    ...<3 lines>...
    )
  File "/Users/lukasbindreiter/Documents/tilebox/stac-fastapi-tilebox/.venv/lib/python3.13/site-packages/stac_fastapi/extensions/core/collection_search/collection_search.py", line 16, in <module>
    from .client import AsyncBaseCollectionSearchClient, BaseCollectionSearchClient
  File "/Users/lukasbindreiter/Documents/tilebox/stac-fastapi-tilebox/.venv/lib/python3.13/site-packages/stac_fastapi/extensions/core/collection_search/client.py", line 9, in <module>
    from .request import BaseCollectionSearchPostRequest
  File "/Users/lukasbindreiter/Documents/tilebox/stac-fastapi-tilebox/.venv/lib/python3.13/site-packages/stac_fastapi/extensions/core/collection_search/request.py", line 9, in <module>
    from stac_pydantic.api.search import SearchDatetime
ImportError: cannot import name 'SearchDatetime' from 'stac_pydantic.api.search' (/Users/lukasbindreiter/Documents/tilebox/stac-fastapi-t^CINFO:     Stopping reloader process [31239]c_pydantic/api/search.py)

PR Checklist:

  • pre-commit hooks pass locally
  • Tests pass (run make test)
  • [] Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the CHANGELOG.

@vincentsarago
Copy link
Member

Oh no
I missed that
Can you do a PR on Stac-pydantic to revert this breaking change?
We can keep the change here as well 👍

@vincentsarago
Copy link
Member

@lukasbindreiter I've just released a new version of stac-pydantic which fixes the error issue.

I think we don't need to have a special handle for the import, IMO we should just depends on stac-pydantic >=3.3

Next version of stac-fastapi is going to be a major version so we can safely update the dependencies versions pins

@lukasbindreiter
Copy link
Contributor Author

@vincentsarago thanks for looking into it

Yeah if that's an option probably just depending on stac-pydantic>=3.3 would be the more straightforward fix, should I update my PR to do that instead of the special case import?

@vincentsarago
Copy link
Member

should I update my PR to do that instead of the special case import?

Yes 🙏

@lukasbindreiter
Copy link
Contributor Author

@vincentsarago Changed it now to the version pin instead 👍

@vincentsarago vincentsarago merged commit 5333806 into stac-utils:main Jun 2, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants