Tz support - #21
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds timezone-aware datetime normalization throughout collation and downstream processing.
Changes:
- Normalizes timestamps to
default_timezone, preserving timezone metadata. - Documents DST, clock-token, transfer, and merge behavior.
- Updates package metadata and editor configuration.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/cocoa/collator.py |
Implements timezone normalization. |
src/cocoa/config/collation.yaml |
Adds the default timezone. |
README.md |
Documents timezone behavior and updates references. |
docs/api/collator.md |
Describes collation timezone semantics. |
docs/api/tokenizer.md |
Clarifies clock-token timezone semantics. |
recipes/date-based-generative-inference.md |
Clarifies local-midnight inference. |
recipes/tokenizer-transfer.md |
Documents timezone consistency requirements. |
CLAUDE.md |
Updates repository guidance and caveats. |
pyproject.toml |
Bumps the package version. |
.vscode/settings.json |
Configures Prettier’s ignore file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return ( | ||
| pl.col(column) | ||
| .cast(pl.Datetime) | ||
| .dt.replace_time_zone(time_zone=default_tz, ambiguous="latest") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces comprehensive support for timezone-aware datetime handling throughout the collation and tokenization pipeline. The main changes ensure that all timestamps are normalized to the configured
default_timezone(defaulting toUTCif unset), and that this timezone is preserved in all downstream processing. Documentation has been updated to clarify the new behavior, including the implications for clock tokens, dataset merging, and daylight-saving transitions. The codebase has been refactored to implement these changes, replacing the previous approach of converting all times to naive UTC.Timezone-aware datetime normalization and propagation:
All timestamps are now normalized to timezone-aware datetimes in the collation config’s
default_timezone, and this timezone is preserved throughout the pipeline. Tz-aware columns are converted instant-preserving; tz-naive columns are assumed to be local times in the specified zone. Ambiguous local times (due to DST) take the later instant, and nonexistent times raise an error. (src/cocoa/collator.py,src/cocoa/config/collation.yaml,README.md,docs/api/collator.md) [1] [2] [3] [4] [5] [6] [7] [8] [9]The collation config (
collation.yaml) and example configs now explicitly include adefault_timezonefield, and documentation reflects the new timezone handling. (src/cocoa/config/collation.yaml,README.md) [1] [2] [3]Documentation updates and clarifications:
The README, API docs, and recipes have been updated to describe the new timezone-aware behavior, the meaning of clock tokens (
CLCK//HH), and the importance of consistentdefault_timezonevalues when merging datasets or transferring tokenizers. (README.md,docs/api/tokenizer.md,recipes/date-based-generative-inference.md,recipes/tokenizer-transfer.md,CLAUDE.md) [1] [2] [3] [4] [5] [6]Clock tokens now explicitly refer to hours in the configured
default_timezone, and documentation clarifies their behavior around daylight-saving shifts. (README.md,docs/api/tokenizer.md,recipes/date-based-generative-inference.md) [1] [2] [3]Other improvements:
README.md)26.6.3. (pyproject.toml).prettierignoreto VSCode settings. (.vscode/settings.json)README.md)These changes make the handling of timezones explicit, robust, and well-documented, improving both correctness and reproducibility when working with time-based data.