Skip to content

fix: circular imports for extensions - #1764

Merged
gadomski merged 2 commits into
mainfrom
issues/1763-circular-imports
Jul 23, 2026
Merged

gadomski merged 2 commits into
mainfrom
issues/1763-circular-imports

Conversation

@gadomski

@gadomski gadomski commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

We didn't get the extension refactor correct in #1650 (my fault). Rather than static imports, this PR converts things to an extension registry via an entry point group.

I'm not sure how bad the https://pypi.org/project/pystac/1.15.1/ release is — while the new sub-packages aren't correct, it's still fine to use the top level pystac package (which is all that existed before v1.15). I'm inclined to not yank v1.15.1, but happy to hear other opinions.

@hrodmn hrodmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The entry_points system seems like a great way to handle this when the extension packages are truly optional. Thanks for the fix @gadomski!


with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
for entry_point in entry_points(group="pystac.extensions"):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the entry_points approach is elegant!

Comment thread core/pystac/__init__.py
from pystac.utils import HREF

import pystac.extensions.hooks
import pystac.extensions.classification

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ah yeah, pystac.extensions.classification imports pystac 🔃

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah I missed this one hard on the initial refactor

dependencies = ["pystac-core"]
dependencies = [
"pystac-core",
"pystac-ext-raster",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I like how the related extensions are explicitly listed as dependencies here

@gadomski
gadomski added this pull request to the merge queue Jul 23, 2026
Merged via the queue into main with commit c82570e Jul 23, 2026
17 checks passed
@gadomski
gadomski deleted the issues/1763-circular-imports branch July 23, 2026 16:06
@gadomski gadomski linked an issue Jul 27, 2026 that may be closed by this pull request
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.

Fix circular dependency in pystac-core

2 participants