Skip to content

Support path-like filenames in edit#3684

Closed
arturict wants to merge 1 commit into
pallets:mainfrom
arturict:agent/edit-pathlike
Closed

Support path-like filenames in edit#3684
arturict wants to merge 1 commit into
pallets:mainfrom
arturict:agent/edit-pathlike

Conversation

@arturict

Copy link
Copy Markdown

What changed

  • accept a single os.PathLike[str] or an iterable containing path-like filenames in click.edit
  • normalize path-like values with os.fspath before invoking the editor
  • cover both runtime behavior and static typing

Why

click.edit(filename=Path(...)) was rejected by type checkers and treated the path as an iterable at runtime. This makes the public API consistent with other Click file APIs that already accept path-like objects.

Fixes #2869

Validation

  • uv run --frozen pytest -q — 1832 passed, 95 skipped, 1 xfailed
  • uv run --frozen ruff check src tests
  • uv run --frozen mypy tests/typing/typing_termui.py
  • git diff --check

@arturict

Copy link
Copy Markdown
Author

Closing after finding the project's maintainer guidance that AI-generated contributions are not wanted. Sorry for missing that before opening this draft.

@arturict arturict closed this Jul 12, 2026
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.

Support pathlib.Path in edit filename

1 participant