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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ __pycache__
!.github/**
!*.py
!*.pyi
!py.typed
!asanypath.png
# auto-generated by hatch-vcs
_version.py
Expand Down
2 changes: 1 addition & 1 deletion hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ def update(self, metadata: dict) -> None:
metadata["dependencies"] = [
"anyio>=4",
f"asanypath-native~={major}.{minor}.0",
"msgspec>=0.21.1",
"msgspec>=0.22.0",
"yarl>=1.2",
]
4 changes: 2 additions & 2 deletions src/asanypath/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,8 +1383,8 @@ def _tree_text(name: str, branch_state: tuple[bool, ...], is_dir: bool | None) -
found_any = bool(rows)

if not found_any:
console.print("[dim](empty)[/dim]")
return 0
# No results is a non-match: exit non-zero like grep/aws s3 ls.
return 1

if simple:
for row in rows:
Expand Down
Empty file added src/asanypath/py.typed
Empty file.
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ async def nested_iterdir():
@pytest.mark.parametrize(
"setup,args,expected_exit,expected_in,not_in,call_with",
[
pytest.param(_ls_empty, ["ls", "s3://bucket/"], 0, ["empty"], [], None, id="empty"),
pytest.param(_ls_empty, ["ls", "s3://bucket/"], 1, [], ["empty"], None, id="empty"),
pytest.param(
_ls_items, ["ls", "s3://bucket/"], 0, ["file1.txt", "file2.txt"], [], None, id="items"
),
Expand All @@ -410,7 +410,7 @@ async def nested_iterdir():
pytest.param(
_ls_nested, ["ls", "-r", "s3://bucket/"], 0, ["deep.txt"], [], None, id="unbounded"
),
pytest.param(_ls_empty, ["ls"], 0, [], [], ".", id="no_arg_default"),
pytest.param(_ls_empty, ["ls"], 1, [], [], ".", id="no_arg_default"),
pytest.param(
_ls_items,
["ls", "-1", "s3://bucket/"],
Expand Down
14 changes: 14 additions & 0 deletions tests/test_py_typed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (C) 2026 Axis Communications AB, Lund, Sweden
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

"""PEP 561 marker must ship so downstream type checkers read asanypath's types."""

from importlib.resources import files


def test_py_typed_is_packaged() -> None:
marker = files("asanypath").joinpath("py.typed")
assert marker.is_file(), "py.typed marker missing from the installed asanypath package"
Loading