Skip to content
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ repos:
- id: mixed-line-ending
- id: check-case-conflict
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.17
rev: 0.11.28
hooks:
- id: uv-lock
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.15 # must match uv.lock
rev: v0.15.21 # must match uv.lock
hooks:
- id: ruff-check
- id: ruff-format
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ tests = [
# pandapower
"networkx>=3.2.1",
"geopandas>=1.0.0",
"pandapower>=3.1.2",
"pandapower>=3.1.2,<3.5", # TODO: remove upper bound
"types-networkx>=3.4.2",
# pyogrio
"pyogrio>=0.13.0",
]
dev = [
"ruff>=0.15.15",
"ruff>=0.15.21",
"pytest>=9.0",
"rich-argparse>=1.8.0",
"mypy[native-parser]>=2.1.0",
"pyright>=1.1.409",
"ty>=0.0.40",
"pyrefly>=1.0.0",
"mypy[native-parser]>=2.2.0",
"pyright>=1.1.411",
"ty>=0.0.58",
"pyrefly>=1.1.1",
{ include-group = "tests" },
]

Expand Down Expand Up @@ -122,14 +124,15 @@ reportSelfClsParameterName = "none"

[tool.ty]
analysis.respect-type-ignore-comments = false
environment.extra-paths = ["./stubs/"]
terminal.output-format = "concise"

[tool.ty.rules]
deprecated = "error"
invalid-method-override = "ignore" # out of control of the stubs (inherited from implementation)

[tool.pyrefly]
search-path = ["stubs/"]
site-package-path = ["./stubs/"]
enabled-ignores = ["pyrefly"]
output-format = "min-text"

Expand Down
3 changes: 2 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def main() -> int:
ret = 0
for tool in tools:
cmd = [*tool.split("-"), *(rest or default_args[tool])]
env = {**os.environ, "PYTHONPATH": "stubs"} if tool in ("mypy", "stubtest") else None
print("Running:", l2c(cmd), file=sys.stderr)
ret |= subprocess.call(cmd, env={**os.environ, "PYTHONPATH": "stubs"}, text=True)
ret |= subprocess.call(cmd, env=env, text=True)
print(file=sys.stderr)
return ret

Expand Down
4 changes: 4 additions & 0 deletions stubs/pyogrio-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ from pyogrio.core import (
get_gdal_config_option as get_gdal_config_option,
get_gdal_data_path as get_gdal_data_path,
list_drivers as list_drivers,
list_drivers_details as list_drivers_details,
list_layers as list_layers,
read_bounds as read_bounds,
read_info as read_info,
set_gdal_config_options as set_gdal_config_options,
vsi_curl_clear_cache as vsi_curl_clear_cache,
vsi_listtree as vsi_listtree,
vsi_rmtree as vsi_rmtree,
vsi_unlink as vsi_unlink,
Expand All @@ -26,13 +28,15 @@ __all__ = [
"get_gdal_config_option",
"get_gdal_data_path",
"list_drivers",
"list_drivers_details",
"list_layers",
"open_arrow",
"read_arrow",
"read_bounds",
"read_dataframe",
"read_info",
"set_gdal_config_options",
"vsi_curl_clear_cache",
"vsi_listtree",
"vsi_rmtree",
"vsi_unlink",
Expand Down
18 changes: 15 additions & 3 deletions stubs/pyogrio-stubs/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,18 @@ class _LayerInfo(TypedDict):
dataset_metadata: dict[str, str] | None
layer_metadata: dict[str, str] | None

def list_drivers(read: bool = False, write: bool = False) -> dict[str, Literal["r", "rw"]]: ...
@type_check_only
class _DriverDetails(TypedDict):
long_name: str
read: bool
append: bool
write: bool
supports_vsi: bool
help_topic_url: str | None
extensions: list[str] | None

def list_drivers(read: bool = False, write: bool = False, append: bool = False) -> dict[str, Literal["r", "rw"]]: ...
def list_drivers_details() -> dict[str, _DriverDetails]: ...
def detect_write_driver(path: str | Path) -> str: ... # `path` is coerced to string internally
def list_layers(path_or_buffer: ReadPathOrBuffer, /) -> Array2D[np.object_]: ...
def read_bounds(
Expand All @@ -66,5 +77,6 @@ def set_gdal_config_options(options: dict[str, Any]) -> None: ...
def get_gdal_config_option(name: str) -> Any: ... # Could return str, int, bool, or None
def get_gdal_data_path() -> str: ...
def vsi_listtree(path: str | Path, pattern: str | None = None): ...
def vsi_rmtree(path: str | Path): ...
def vsi_unlink(path: str | Path): ...
def vsi_rmtree(path: str | Path) -> None: ...
def vsi_unlink(path: str | Path) -> None: ...
def vsi_curl_clear_cache(prefix: str | Path = "") -> None: ...
Loading