Skip to content

[rasterio] 1.5.1 support (BLOCKED) - #16180

Open
jack-volantautonomy wants to merge 10 commits into
python:mainfrom
jack-volantautonomy:rasterio_Add-proper-affine-typing
Open

[rasterio] 1.5.1 support (BLOCKED)#16180
jack-volantautonomy wants to merge 10 commits into
python:mainfrom
jack-volantautonomy:rasterio_Add-proper-affine-typing

Conversation

@jack-volantautonomy

@jack-volantautonomy jack-volantautonomy commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

rasterio has now released version 1.5.1 and as a result affine has now released version 3.0.0 with py.typed implemented so we should move to properly typing Affine with this update.

BLOCKED
Currently blocked by stub_uploader not allowing affine usage. I have a PR created there that should allow this to work as can be seen here:

@jack-volantautonomy

Copy link
Copy Markdown
Contributor Author

@thomas-maschler I know your away from computer at the moment so won't be able to properly verify, but is this as simple a fix as it should be or is more work required?

@jack-volantautonomy jack-volantautonomy changed the title [rasterio] Add proper Affine typing [rasterio] 1.5.1 support Aug 10, 2026
@jack-volantautonomy jack-volantautonomy changed the title [rasterio] 1.5.1 support [rasterio] 1.5.1 support (BLOCKED) Aug 10, 2026
Comment thread stubs/rasterio/rasterio/serde.pyi Outdated
from typing import Any

@singledispatch
def to_json(obj: Any) -> Any: ...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a better option than Any? Can the return type be str?

@jack-volantautonomy jack-volantautonomy Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would like for it to be better than Any but sadly the function is brutally simple:

@singledispatch
def to_json(obj):
    """Convert obj to a JSON serializable form."""
    return obj

I guess typing using an unbound Generic would be more effective @thomas-maschler?

@jack-volantautonomy jack-volantautonomy Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, just looked into it a bit more and singledispatch is already typed in typeshed to tell us this so we'd basically be having a generic typing inside of typing with Callable and generic already. Looks like if we want better typing than Any the next best alternative is object so I've made that change now.

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