Skip to content

feat(datasets): add os.PathLike support for Text, JSON, YAML and Pickle datasets#1324

Merged
merelcht merged 2 commits intokedro-org:mainfrom
priya-gitTest:feature/pathlike-support-text-json-yaml-pickle
Feb 27, 2026
Merged

feat(datasets): add os.PathLike support for Text, JSON, YAML and Pickle datasets#1324
merelcht merged 2 commits intokedro-org:mainfrom
priya-gitTest:feature/pathlike-support-text-json-yaml-pickle

Conversation

@priya-gitTest
Copy link
Copy Markdown
Contributor

Closes part of #1316.

Updates the filepath type hint from str to str | os.PathLike for:

  • TextDataset
  • JSONDataset
  • YAMLDataset
  • PickleDataset

Adds a test_pathlike_filepath test to each dataset's test suite that
passes a pathlib.Path object directly (without .as_posix()) and
verifies a save/load round-trip works correctly.

Notes

The underlying get_protocol_and_path from kedro.io.core already
accepts str | os.PathLike, so no changes to core logic were needed —
only the public type hints and tests.

@merelcht merelcht self-requested a review February 27, 2026 16:21
…le datasets

Update filepath type hints from `str` to `str | os.PathLike` in
TextDataset, JSONDataset, YAMLDataset, and PickleDataset, and add
`test_pathlike_filepath` tests to verify that pathlib.Path objects
can be passed directly without calling `.as_posix()`.

Closes part of kedro-org#1316

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Priyanka Ojha <21082240+priya-gitTest@users.noreply.github.com>
@priya-gitTest priya-gitTest force-pushed the feature/pathlike-support-text-json-yaml-pickle branch from 74c6ac2 to 4459e85 Compare February 27, 2026 16:56
Copy link
Copy Markdown
Member

@merelcht merelcht left a comment

Choose a reason for hiding this comment

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

Thank you so much for the contribution @priya-gitTest ! ⭐

@ravi-kumar-pilla ravi-kumar-pilla self-requested a review February 27, 2026 18:16
Copy link
Copy Markdown
Contributor

@ravi-kumar-pilla ravi-kumar-pilla left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution @priya-gitTest . The changes look clean 💯

@merelcht merelcht merged commit 1284db7 into kedro-org:main Feb 27, 2026
16 checks passed
@priya-gitTest priya-gitTest deleted the feature/pathlike-support-text-json-yaml-pickle branch February 27, 2026 18:22
celinaczy pushed a commit to celinaczy/kedro-plugins-fork that referenced this pull request Feb 27, 2026
…le datasets (kedro-org#1324)

Update filepath type hints from `str` to `str | os.PathLike` in
TextDataset, JSONDataset, YAMLDataset, and PickleDataset, and add
`test_pathlike_filepath` tests to verify that pathlib.Path objects
can be passed directly without calling `.as_posix()`.

Closes part of kedro-org#1316

Signed-off-by: Priyanka Ojha <21082240+priya-gitTest@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: celina-czyszczon <celina.czyszczon@justeattakeaway.com>
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.

3 participants