Skip to content

Comments

Update v8 with the latest commits from v7#2478

Merged
haakonvt merged 10 commits intopysdk-release-v8from
update-v8-with-v7-latest
Feb 18, 2026
Merged

Update v8 with the latest commits from v7#2478
haakonvt merged 10 commits intopysdk-release-v8from
update-v8-with-v7-latest

Conversation

@haakonvt
Copy link
Contributor

No description provided.

@haakonvt haakonvt requested review from a team as code owners February 17, 2026 21:51
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @haakonvt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request synchronizes the v8 branch with recent changes from v7, primarily introducing a new timezone parameter to the synthetic time series query API for more flexible data aggregation. It also includes significant updates to the documentation build system, improving the presentation of API signatures and managing documentation-specific dependencies more effectively.

Highlights

  • Synthetic Time Series Query API Enhancement: The query method for synthetic time series now supports a timezone parameter, allowing users to specify the timezone for aggregating datapoints. This parameter accepts various formats including str, datetime.timezone, or ZoneInfo objects.
  • Documentation Improvements and Build Process Updates: The documentation build process has been updated to require Sphinx 7.2, include custom CSS for improved signature formatting, and incorporate a patch to hide @overload signatures, enhancing readability. Documentation dependencies were also moved to a dedicated group in pyproject.toml.
  • Integration Test Updates: An integration test for synthetic time series queries was updated to reflect the new timezone parameter and adjusted limit and granularity values, ensuring proper functionality.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • cognite/client/_api/synthetic_time_series.py
    • Imported datetime and ZoneInfo modules.
    • Updated type hints for start and end parameters to datetime.datetime.
    • Added timezone parameter to the query method and its overloads, allowing specification of aggregation timezone.
    • Enhanced the query method's docstring with details and an example for the new timezone parameter.
    • Implemented logic to convert ZoneInfo or datetime.timezone objects to string format for the timezone parameter in the API request.
  • cognite/client/_sync_api/synthetic_time_series.py
    • Updated the auto-generated file hash.
    • Imported datetime and ZoneInfo modules.
    • Updated type hints for start and end parameters to datetime.datetime.
    • Added timezone parameter to the query method and its overloads, passing it to the asynchronous client.
    • Enhanced the query method's docstring with details and an example for the new timezone parameter.
  • docs/source/_static/css/custom.css
    • Added new CSS rules to remove vertical whitespace in Sphinx signatures.
    • Added new CSS rules to make signature boxes full-width and right-align view-source and header links.
  • docs/source/conf.py
    • Updated the minimum required Sphinx version to 7.2.
    • Configured html_static_path to include _static directory.
    • Added css/custom.css to html_css_files for custom styling.
    • Set python_maximum_signature_line_length to 80.
    • Implemented a Python patch to Sphinx's ModuleAnalyzer to hide @overload signatures in the generated documentation.
  • docs/source/data_modeling.rst
    • Added a new section for 'Debugging Data Classes' documentation.
  • pyproject.toml
    • Removed docutils, sphinx, and sphinx-rtd-theme from [tool.poetry.group.dev.dependencies].
    • Created a new [tool.poetry.group.docs.dependencies] section.
    • Moved sphinx (version >=7.2) and sphinx-rtd_theme (version >=1) to the new [tool.poetry.group.docs.dependencies] group.
  • tests/tests_integration/test_api/test_synthetic_time_series.py
    • Modified test_expression_builder_complex to change the limit from 100 to 10.
    • Modified test_expression_builder_complex to change the granularity from '3s' to '1h'.
    • Added timezone='Europe/Oslo' parameter to the query call in test_expression_builder_complex.
    • Updated the assertion for the length of returned datapoints from 100 to 3 in test_expression_builder_complex.
Ignored Files
  • Ignored by pattern: .gemini/** (1)
    • .gemini/config.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces timezone support for synthetic time series queries, along with updates to documentation dependencies and configurations. The changes are generally good, but I've identified a regression in the type hints for the query method in both the synchronous and asynchronous APIs. The updated overloads no longer account for sympy expressions, which reduces type safety. I've provided suggestions to correct the overloads to include sympy.Basic types, aligning them with the implementation's capabilities and adhering to the project's strong typing principles.

Comment on lines 50 to 78
@overload
async def query(
self,
expressions: SequenceNotStr[str] | SequenceNotStr[sympy.Basic],
start: int | str | datetime,
end: int | str | datetime,
expressions: str,
start: int | str | datetime.datetime,
end: int | str | datetime.datetime,
limit: int | None = None,
variables: Mapping[str | sympy.Symbol, str | NodeId | TimeSeries | TimeSeriesWrite] | None = None,
aggregate: str | None = None,
granularity: str | None = None,
target_unit: str | None = None,
target_unit_system: str | None = None,
) -> DatapointsList: ...
timezone: str | datetime.timezone | ZoneInfo | None = None,
) -> Datapoints: ...

@overload
async def query(
self,
expressions: str | sympy.Basic,
start: int | str | datetime,
end: int | str | datetime,
expressions: SequenceNotStr[str],
start: int | str | datetime.datetime,
end: int | str | datetime.datetime,
limit: int | None = None,
variables: Mapping[str | sympy.Symbol, str | NodeId | TimeSeries | TimeSeriesWrite] | None = None,
aggregate: str | None = None,
granularity: str | None = None,
target_unit: str | None = None,
target_unit_system: str | None = None,
) -> Datapoints: ...
timezone: str | datetime.timezone | ZoneInfo | None = None,
) -> DatapointsList: ...
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The updated query method overloads are missing support for sympy.Basic expressions. This is a regression in type hinting, as the implementation still supports sympy expressions. The overloads should be updated to reflect all supported types to ensure type safety and provide a better developer experience.

    @overload
    async def query(
        self,
        expressions: str | sympy.Basic,
        start: int | str | datetime.datetime,
        end: int | str | datetime.datetime,
        limit: int | None = None,
        variables: Mapping[str | sympy.Symbol, str | NodeId | TimeSeries | TimeSeriesWrite] | None = None,
        aggregate: str | None = None,
        granularity: str | None = None,
        target_unit: str | None = None,
        target_unit_system: str | None = None,
        timezone: str | datetime.timezone | ZoneInfo | None = None,
    ) -> Datapoints: ...

    @overload
    async def query(
        self,
        expressions: SequenceNotStr[str | sympy.Basic],
        start: int | str | datetime.datetime,
        end: int | str | datetime.datetime,
        limit: int | None = None,
        variables: Mapping[str | sympy.Symbol, str | NodeId | TimeSeries | TimeSeriesWrite] | None = None,
        aggregate: str | None = None,
        granularity: str | None = None,
        target_unit: str | None = None,
        target_unit_system: str | None = None,
        timezone: str | datetime.timezone | ZoneInfo | None = None,
    ) -> DatapointsList: ...
References
  1. The style guide requires strong typing and that all functions, methods, and class attributes must have type hints. The current overloads are incomplete and do not cover all supported input types for the 'expressions' parameter. (link)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gemini-code-assist Because sympy.Basic resolves to Any in mypy (due to ignore_missing_imports = true in mypy.ini).

So str | sympy.Basic becomes str | Any = Any, which matches everything, including e.g. list[str]. This causes the first overload to always match, making the second overload unreachable.

The implementation still works at runtime; it's only the type hints that can't distinguish the overloads when sympy types are involved.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for the detailed explanation, haakonvt. I understand the issue now. You are correct that including sympy.Basic in the overloads, given mypy's ignore_missing_imports = true and its resolution of sympy.Basic to Any, would indeed make the first overload str | Any effectively Any, thus rendering subsequent overloads unreachable.

Given this constraint with mypy, your current approach of omitting sympy.Basic from the overloads and only including it in the implementation signature is a pragmatic solution to ensure correct overload resolution by the type checker, while still supporting sympy.Basic at runtime. The runtime behavior remains correct, and the type hints are as precise as possible under the circumstances.

This is a valid workaround for the type checking limitation.

@haakonvt haakonvt force-pushed the update-v8-with-v7-latest branch from 9ba8d1d to 197af53 Compare February 17, 2026 21:58
@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.59%. Comparing base (9aba382) to head (b268276).
⚠️ Report is 12 commits behind head on pysdk-release-v8.

Files with missing lines Patch % Lines
tests/tests_integration/test_api/test_workflows.py 65.71% 12 Missing ⚠️
cognite/client/_api/synthetic_time_series.py 42.85% 4 Missing ⚠️
cognite/client/_sync_api/synthetic_time_series.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##           pysdk-release-v8    #2478      +/-   ##
====================================================
+ Coverage             64.54%   64.59%   +0.05%     
====================================================
  Files                   467      467              
  Lines                 47774    47789      +15     
====================================================
+ Hits                  30836    30871      +35     
+ Misses                16938    16918      -20     
Files with missing lines Coverage Δ
...integration/test_api/test_synthetic_time_series.py 85.56% <100.00%> (ø)
cognite/client/_sync_api/synthetic_time_series.py 10.00% <0.00%> (-0.53%) ⬇️
cognite/client/_api/synthetic_time_series.py 71.77% <42.85%> (-0.50%) ⬇️
tests/tests_integration/test_api/test_workflows.py 93.89% <65.71%> (+5.58%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

erlendvollset
erlendvollset previously approved these changes Feb 18, 2026
Copy link
Contributor

@erlendvollset erlendvollset left a comment

Choose a reason for hiding this comment

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

🦄

vincent-cognite and others added 2 commits February 18, 2026 10:08
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…task now uses actual function (#2475)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@haakonvt haakonvt force-pushed the update-v8-with-v7-latest branch from d16b196 to b268276 Compare February 18, 2026 14:31
@haakonvt haakonvt enabled auto-merge (rebase) February 18, 2026 14:32
@haakonvt haakonvt disabled auto-merge February 18, 2026 14:54
@haakonvt haakonvt enabled auto-merge February 18, 2026 14:54
@haakonvt
Copy link
Contributor Author

🦄

@haakonvt haakonvt merged commit 17a357b into pysdk-release-v8 Feb 18, 2026
31 of 42 checks passed
@haakonvt haakonvt deleted the update-v8-with-v7-latest branch February 18, 2026 14:58
@haakonvt haakonvt self-assigned this Feb 18, 2026
@haakonvt haakonvt added the risk-review-ongoing Risk review is in progress label Feb 18, 2026
@haakonvt haakonvt added the waiting-for-team Waiting for the submitter or reviewer of the PR to take an action label Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk-review-ongoing Risk review is in progress waiting-for-team Waiting for the submitter or reviewer of the PR to take an action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants