Skip to content
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

Typing improvements and loosened dependencies #342

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Zaczero
Copy link

@Zaczero Zaczero commented Jan 27, 2025

This PR is a set of several typing improvements as well as loosened dependencies which resolves #341. While this PR bundles several changes, the commits are atomic and should be simple to review individually.

More notable changes:

  • pydantic depdendency was replaced with pydantic-settings as in official docs.
  • set_json_dumps no longer uses a .decode() wrapper method, since bytes return is supported in psycopg since 3.1.9.
  • pathlib.Path type hints were removed since from my testing they never worked (they are not an instance of str).

@@ -10,23 +10,13 @@
from psycopg import Connection, sql
from psycopg.types.json import set_json_dumps, set_json_loads
from psycopg_pool import ConnectionPool

try:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still have some use cases where pypgstac is used with other libraries that require pydantic 1.X, so we use this try block to use the v1 compatibility layer of pydantic 2 which still supports BaseSettings.

@bitner
Copy link
Collaborator

bitner commented Feb 10, 2025

Hey @Zaczero Thanks for kicking this PR up here.

I am not too keen on just using >= for dependencies as (particularly with a major release version) there is a good chance that there could be breaking changes from dependencies.

For pydantic, I do know that we need to integrate with some libraries that still are using pydantic v1. This is why we use the v1 compatibility layer in Pydantic v2 that allows us to still use the old pydantic base settings api.

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.

Loosen dependencies requirements
2 participants