Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
351 commits
Select commit Hold shift + click to select a range
a03370c
Run mypy on tests_integration/test_api/test_agents.py
erlendvollset Sep 8, 2025
c3d79db
Run mypy on tests_integration/test_api/test_annotations.py
erlendvollset Sep 8, 2025
8a3d106
Make all tests return None
erlendvollset Sep 8, 2025
f8feb6d
Run mypy on tests_integration/test_api/test_data_sets.py
erlendvollset Sep 8, 2025
3507f05
Run mypy on tests_integration/test_api/test_datapoint_subscriptions.py
erlendvollset Sep 8, 2025
0a3a41f
Run mypy on tests_integration/test_api/test_diagrams.py
erlendvollset Sep 8, 2025
10dbfd5
Run mypy on tests_integration/test_api/test_documents.py
erlendvollset Sep 8, 2025
4a8acd3
Fix agent dataclass unit tests
erlendvollset Sep 8, 2025
03dc762
Run mypy on tests_integration/test_api/test_entity_matching.py
erlendvollset Sep 8, 2025
3a81d95
Run mypy on tests_integration/test_api/test_extraction_pipelines.py
erlendvollset Sep 8, 2025
074fc9e
Run mypy on tests_integration/test_api/test_files.py
erlendvollset Sep 8, 2025
a13b9e9
Run mypy on tests_integration/test_api/test_functions.py
erlendvollset Sep 8, 2025
92580e4
Run mypy on tests_integration/test_api/test_geospatial.py
erlendvollset Sep 8, 2025
0e668da
Run mypy on tests_integration/test_api/test_iam.py
erlendvollset Sep 8, 2025
12579e4
Run mypy on tests_integration/test_api/test_labels.py
erlendvollset Sep 8, 2025
85e6e40
Run mypy on more integration tests
erlendvollset Sep 8, 2025
efb3a03
Run mypy on more relationship integration tests
erlendvollset Sep 9, 2025
2715a0a
Run mypy on all integration tests
erlendvollset Sep 9, 2025
606f70f
Improve contextualization classes and clients
erlendvollset Sep 9, 2025
6b259e3
Run mypy on files unit tests
erlendvollset Sep 11, 2025
227e35d
Run mypy on sequences unit tests
erlendvollset Sep 11, 2025
11fe713
Fix some failing integration tests
erlendvollset Sep 11, 2025
f3e56e4
startTime is not required for VisionExtracJob
erlendvollset Sep 11, 2025
352eda1
Run mypy on all files in tests_unit/test_api
erlendvollset Sep 11, 2025
1490119
Run mypy on all test files
erlendvollset Sep 11, 2025
2d44536
Run 'build' workflow on all PRs
erlendvollset Sep 12, 2025
644ae44
Clean up ignore_missing_imports in mypy.ini
erlendvollset Sep 12, 2025
ed5e2fc
feat: Change to httpx.AsyncClient
haakonvt Sep 1, 2025
5b955a3
fix: stream methods
haakonvt Sep 20, 2025
5ae0bff
remove all __iter__ methods, update docstrings
haakonvt Sep 9, 2025
491ab34
fix: save one list copy op in datapoints-insert-loop
haakonvt Sep 19, 2025
e24a025
rename CogniteClient to AsyncCogniteClient
haakonvt Sep 20, 2025
2366e18
add global BoundedSemaphores for concurrency control
haakonvt Nov 4, 2025
3c75b2d
add AsyncSDKTask for future use in async execute_tasks etc
haakonvt Nov 4, 2025
806b7d0
remove threading-related code from utils/_concurrency.py
haakonvt Nov 4, 2025
dab2460
update TasksSummary to work with AsyncSDKTask
haakonvt Nov 4, 2025
2ee2806
add _PyodideEventLoopExecutor for sync support in browser
haakonvt Nov 4, 2025
6359455
add execute_async_tasks and execute_async_tasks_with_fail_fast
haakonvt Nov 4, 2025
a6057cc
update _http_client.py, use semaphore and use coroutine factory pattern
haakonvt Nov 4, 2025
69e42da
use semaphore and AsyncSDKTask in _api_client.py
haakonvt Nov 4, 2025
2e6dd12
add overloads to _list_generator in _api_client.py
haakonvt Nov 4, 2025
ba96ecc
un-nest get_partition in _api_client.py
haakonvt Nov 4, 2025
1f852f0
make _api_client.py async
haakonvt Nov 4, 2025
df71a2c
make _basic_api_client.py async
haakonvt Nov 4, 2025
ecda140
make top-level API methods (get/post etc) async on async client
haakonvt Nov 4, 2025
669eca8
add stand-in CogniteClient (not impl)
haakonvt Nov 4, 2025
2f2d5b8
make API async: agents/agents
haakonvt Nov 4, 2025
991cb91
make API async: ai/tools/documents
haakonvt Nov 4, 2025
9cd9506
make API async: annotations
haakonvt Nov 4, 2025
acb5a8f
make API async: assets
haakonvt Nov 4, 2025
a2829f0
convert AssetsAPI.create_hierarchy to async
haakonvt Sep 25, 2025
202c9eb
make API async: data_modeling/*
haakonvt Nov 4, 2025
05ae764
make API async: data_sets
haakonvt Nov 4, 2025
82df2b7
make API async: datapoints
haakonvt Nov 4, 2025
eb8c43d
make API async: datapoints_subscriptions
haakonvt Nov 4, 2025
b2af2f1
make API async: diagrams
haakonvt Nov 4, 2025
462e739
make API async: documents + doc. preview
haakonvt Nov 4, 2025
1fac5ad
make API async: entity_matching
haakonvt Nov 4, 2025
c9d315a
make API async: events
haakonvt Nov 4, 2025
165e9d4
make API async: extractionpipelines/*
haakonvt Nov 4, 2025
a752788
make API async: files
haakonvt Nov 4, 2025
812dc5e
make API async: functions/*
haakonvt Nov 4, 2025
b58ea4a
make API async: geospatial
haakonvt Nov 4, 2025
e24a7a9
make API async: hosted_extractors/*
haakonvt Nov 4, 2025
6f55364
make API async: iam/*
haakonvt Nov 4, 2025
2178088
make API async: labels
haakonvt Nov 4, 2025
0b00100
make API async: postgres_gateway/*
haakonvt Nov 4, 2025
0785163
make API async: raw/*
haakonvt Nov 4, 2025
dc30c14
make API async: relationships
haakonvt Nov 4, 2025
329e923
make API async: sequences + seq. data
haakonvt Nov 4, 2025
db824cc
make API async: simulators/*
haakonvt Nov 4, 2025
2ebee44
make API async: synthetic_time_series
haakonvt Nov 4, 2025
d2ec4d2
make API async: three_d/*
haakonvt Nov 4, 2025
d4b8514
make API async: time_series
haakonvt Nov 4, 2025
220decc
make API async: transformations/*
haakonvt Nov 4, 2025
a8efdd3
make API async: units + unit_system
haakonvt Nov 4, 2025
676c64f
make API async: user_profiles
haakonvt Nov 4, 2025
bcc37cc
make API async: vision
haakonvt Nov 4, 2025
946fd12
make API async: workflows/*
haakonvt Nov 4, 2025
3028ef4
make async: data_classes/assets
haakonvt Nov 4, 2025
d6ae75f
make async: data_classes/contextualization
haakonvt Nov 4, 2025
6332a0e
make async: data_classes/data_modeling/debug
haakonvt Nov 4, 2025
1588356
make async: data_classes/datapoints
haakonvt Nov 4, 2025
75b4e2d
make async: data_classes/files
haakonvt Nov 4, 2025
dd4a80e
make async: data_classes/functions
haakonvt Nov 4, 2025
3b07dc0
make async: data_classes/simulators/runs
haakonvt Nov 4, 2025
e622b93
make async: data_classes/raw
haakonvt Nov 4, 2025
3eb9261
make async: data_classes/time_series
haakonvt Nov 4, 2025
7c9e438
make async: data_classes/transformations/*
haakonvt Nov 4, 2025
a5ba96f
make async: data_classes/sequences
haakonvt Nov 4, 2025
a16026b
update scripts/custom_checks/docstrings.py to support AsyncIterators
haakonvt Nov 4, 2025
21cd243
remove function import_as_completed
haakonvt Sep 23, 2025
c1a83bf
improve ergonomics of AsyncSDKTask with __getitem__
haakonvt Sep 25, 2025
fe54005
drop pytest-asyncio in favor of anyio (used by httpx, so non-optional)
haakonvt Sep 25, 2025
5d425de
remove retrieve_dataframe_in_tz (timezone now support in API)
haakonvt Feb 20, 2025
662f189
change datapoints fetch code to async 😓
haakonvt Sep 25, 2025
5e58f52
fix CogniteNotFoundError missing cluster and project
haakonvt Sep 26, 2025
195c9f3
fix async: CogniteProjectAccessError._attempt_to_get_projects
haakonvt Sep 26, 2025
4bf98e6
update raw rows iter method to async
haakonvt Sep 27, 2025
3a19da1
add AsyncCogniteClient to all examples
haakonvt Sep 27, 2025
d590424
make sequences.rows a property and add DeprecationWarning
haakonvt Sep 27, 2025
b8b8161
add SyncIterator (to wrap async __call__) to utils/_async_helpers.py
haakonvt Sep 27, 2025
91f7ebc
rename _json.py to _json_extended.py as it conflicts with stdlib _jso…
haakonvt Sep 28, 2025
2c1ace0
minor cleanup of prev. "un-split" APIs:
haakonvt Sep 29, 2025
a5655c6
split ExtractionPipelinesAPIs into separate files
haakonvt Sep 29, 2025
2e8f44f
make async: utils/_session.py
haakonvt Nov 4, 2025
9352192
fix imports, raw strings missing 'r' and minor mypy/formatting
haakonvt Nov 4, 2025
381dae5
add overloads to _process_into_chunks in _api_client.py
haakonvt Nov 4, 2025
7b9e74a
refactor settings_forcing_raw_response_loading in _api_client.py
haakonvt Nov 4, 2025
2ee1a6c
refactor settings_forcing_raw_response_loading in DM/instances.py
haakonvt Nov 4, 2025
d80df1c
add/fix overloads on RawRowsAPI.__call__
haakonvt Nov 4, 2025
cf972dc
use match stmt in InstancesAPI.__call__
haakonvt Nov 4, 2025
938978c
use match stmt in SequencesDataAPI.insert
haakonvt Nov 4, 2025
52d84e8
httpx no longer need pyodide-patching!
haakonvt Sep 30, 2025
dce48d7
fix: reintroduce _base_url_with_base_path on API client to handle Org…
haakonvt Sep 8, 2025
2822520
make the SDK work in "normal" jupyter notebooks
haakonvt Sep 30, 2025
4084acb
add run_sync function to _utils/async_helpers.py
haakonvt Oct 4, 2025
13fe85c
delete: cognite/client/beta.py
haakonvt Oct 4, 2025
68fd847
remove deprecated aggregate methods
haakonvt Oct 5, 2025
2c2da3a
remove deprecated filter methods
haakonvt Oct 5, 2025
e0a7572
remove deprecated methods in _api/workflows/
haakonvt Oct 5, 2025
6d0d88a
remove support for deprecated argument 'column_external_ids' in _api/…
haakonvt Oct 5, 2025
22cdd0e
fix incorrect _RESOURCE_PATH in _api/sequence_data.py
haakonvt Oct 5, 2025
a66e4ec
change agg method to "count" for data sets and files
haakonvt Oct 5, 2025
61f658c
remove CountAggregate
haakonvt Oct 5, 2025
4c477ec
make TemplateGroupsAcl a LegacyCapability
haakonvt Oct 5, 2025
0bf806e
remove deprecated partitions-support on __call__
haakonvt Oct 5, 2025
ea4093c
remove legacy_name from time series data classes++
haakonvt Oct 5, 2025
94382fa
remove deprecated DataPointSubscriptionCreate
haakonvt Oct 5, 2025
57b111d
flip expand_properties default to True in to_pandas (data modeling)
haakonvt Oct 5, 2025
76986ff
fix DataModelingInstancesList.get method (remove deprecated 'id' arg)
haakonvt Oct 5, 2025
b1615a7
raise in ViewProperty[-Apply] when conn.def. is missing 'connectionType'
haakonvt Oct 5, 2025
a933bfd
remove deprecated CogniteObject method load_yaml on Query
haakonvt Oct 5, 2025
c9e2a30
queries for datapoints can no longer be passes as dict
haakonvt Oct 5, 2025
2cb32d9
remove deprecated DatapointsArray.__iter__ method
haakonvt Oct 5, 2025
0670609
fix double type annotations in docstring
haakonvt Oct 6, 2025
9b7587f
add decorator factory 'copy_doc_from_async' (doc = docstring)
haakonvt Oct 6, 2025
f50cb3e
fix data class helper methods: assets.py
haakonvt Oct 6, 2025
9a97fc4
fix data class helper methods: contextualization.py
haakonvt Oct 6, 2025
d5b3857
fix data class helper methods: files.py
haakonvt Oct 6, 2025
922f596
fix data class helper methods: functions.py
haakonvt Oct 6, 2025
42e0203
fix data class helper methods: raw.py
haakonvt Oct 6, 2025
82c84bf
fix data class helper methods: sequences.py
haakonvt Oct 6, 2025
fcfab6f
fix data class helper methods: simulators/*
haakonvt Oct 6, 2025
16d22f1
fix data class helper methods: time_series.py
haakonvt Oct 6, 2025
3637b9a
fix data class helper methods: transformations/__init__.py
haakonvt Oct 6, 2025
1732d87
fix data class helper methods: transformations/jobs.py
haakonvt Oct 6, 2025
1d2486c
remove param 'expected_fields' from Datapoints._load
haakonvt Oct 6, 2025
ea7e4a3
remove warning in class Transformation on already removed init params
haakonvt Oct 6, 2025
b6e5a01
drop 'deprecated' from docs (toctree) after sunsetting TemplatesAPI
haakonvt Oct 6, 2025
c350187
update thread-executor tests to async: tests/tests_unit/test_utils/te…
haakonvt Oct 6, 2025
a11a50a
add Omitted class to be used as "not given" singleton
haakonvt Oct 7, 2025
d4998b8
Update Apply-classes in cdm/v1.py to use OMITTED default
haakonvt Oct 7, 2025
1fc3112
Update Apply-classes in extractor_extensions/v1.py to use OMITTED def…
haakonvt Oct 7, 2025
b214e66
Ignore OMITTED values from being dumped in: data_classes/data_modelin…
haakonvt Oct 7, 2025
ea7ff0f
Load missing as OMITTED in Typed Apply classes in: data_classes/data_…
haakonvt Oct 15, 2025
0e13e32
use match statement in _serialize_value
haakonvt Oct 7, 2025
39df607
Ingesting no datapoints no longer raises an exception
MortGron Jun 16, 2025
2d8373b
remove alpha/beta client test fixtures/helper fns
haakonvt Oct 7, 2025
712e01c
make test util set_request_limit a fixture
haakonvt Oct 7, 2025
ae5c2dc
refactor usage of set_request_limit
haakonvt Oct 7, 2025
f6159fe
update test to use tmp_path fixture
haakonvt Oct 7, 2025
7e8d4c8
spellcheck on AsyncCogniteClient
haakonvt Oct 7, 2025
ffd2510
Access the response from the exception, not from the local variable
haakonvt Oct 8, 2025
71f92f0
make PrincipalsAPI async
haakonvt Oct 8, 2025
5361a7d
fix: CI checks for pyodide after httpx addition
haakonvt Sep 1, 2025
7bb8e8d
remove arg ignore_allscope_meaning from ACL compare fns (in IAM)
haakonvt Oct 9, 2025
a5d7f8c
short-circuit "retrieve_multiple" and similar on [] input
haakonvt Oct 9, 2025
2dd0b9b
make ruff remove empty "if TYPE_CHECKING:" blocks
haakonvt Oct 9, 2025
3e890df
rename ModelFailedException -> CogniteModelFailedError and fix inheri…
haakonvt Oct 9, 2025
f73314b
Org APIs use api-layer logic, not http. add CogniteOrganizationError
haakonvt Oct 9, 2025
e1eefb7
build request again when retrying in AsyncHTTPClientWithRetry.stream
haakonvt Oct 13, 2025
c315dae
remove special pyodide handling in FilesAPI upload *YEY*
haakonvt Oct 13, 2025
09cce0a
only accept pathlib.Path in FilesAPI (keep str support though)
haakonvt Oct 13, 2025
5962d82
fix bug in '_process_file_download' by using 'is_relative_to' instead
haakonvt Oct 13, 2025
ba2b94d
add helpers for file handling: utils/_uploading.py
haakonvt Oct 13, 2025
5800e73
fix FilesAPI: httpx AsyncClient doesn't accept regular file handles (…
haakonvt Oct 13, 2025
b1b9ad1
make FileMultipartUploadSession work in both sync and async contexts
haakonvt Oct 13, 2025
0c0a3be
add script to convert async apis into sync
haakonvt Sep 29, 2025
410f043
add Mock for async client: AsyncCogniteClientMock
haakonvt Oct 4, 2025
7405d67
properly fix missing AsyncMocks in AsyncCogniteClientMock
haakonvt Oct 14, 2025
78355a2
properly fix spec_set=True in CogniteClientMock
haakonvt Oct 14, 2025
3277849
change monkeypatch client fns to use patch instead of hacking __new__
haakonvt Oct 14, 2025
4ef48d3
update mock tests after refactoring
haakonvt Oct 14, 2025
a86bde4
refactor BasicAsyncAPIClient._request to log but re-raise
haakonvt Oct 13, 2025
7c06185
fix: missing payload from on-error-logging/raising
haakonvt Oct 13, 2025
53995ee
run script to create all sync APIs + sync CogniteClient
haakonvt Oct 2, 2025
2fbf43c
update API-conversion script to include sync methods + overloads
haakonvt Oct 15, 2025
edacf27
run updated script to update sync APIs
haakonvt Oct 15, 2025
99b0fc3
update conversion script to add basic HTTP methods++ to CogniteClient
haakonvt Oct 15, 2025
3a46ed8
fix tests: tests/tests_unit/* and tests/utils.py
haakonvt Oct 15, 2025
fb1d3e8
fix tests: tests/tests_unit/test_api/*
haakonvt Oct 15, 2025
04de0b2
fix tests: tests/tests_unit/test_data_classes/*
haakonvt Oct 15, 2025
74873c1
fix tests: tests/tests_integration/*
haakonvt Oct 15, 2025
80eced6
fix plain wrong code in docstring examples
haakonvt Oct 15, 2025
b610070
fix: various imports
haakonvt Oct 15, 2025
b8f18d3
run coverage also on test files
haakonvt Oct 16, 2025
f40d1e1
refactor: insert_dataframe, infer id type from columns
haakonvt Feb 19, 2025
6b7ae90
Update Sphinx documentation
haakonvt Oct 14, 2025
b6ea752
reorgranize DatapointsAPI, split utils and aggregates
haakonvt Oct 21, 2025
de5e61a
refactor Synth.DatapointsAPI to not use _extend
haakonvt Oct 21, 2025
126764d
refactor: use MultiIndex in df.columns for dps dataframes
haakonvt Oct 21, 2025
9f778b9
move Geometry from data_classes/_base to /shared.py
haakonvt Oct 21, 2025
993fab5
convert timed_cache to async, add tests
haakonvt Oct 22, 2025
d04d0d6
update _select_dps_fetch_strategy to use semaphore bound value
haakonvt Oct 22, 2025
42b6d80
refactor InstancesAPI.subscribe to async
haakonvt Oct 24, 2025
18b319e
update docs on InstancesAPI.subscribe -> local sqlite db
haakonvt Oct 24, 2025
ead2d93
Split query and sync classes
audunska Oct 16, 2025
f9f3d4e
Filter: Add magic __eq__
audunska Oct 24, 2025
2985088
Turn split sync query classes into dataclasses
audunska Oct 23, 2025
35b4285
Fix tests related to Query-Sync-split
audunska Oct 17, 2025
c06b225
Update InstancesAPI.subscribe doc example to use -Sync classes
audunska Oct 23, 2025
838b50b
make BasicAsyncAPIClient picklable
haakonvt Oct 27, 2025
be8324c
turn on pickle-client-test and add one for AsyncCogniteClient
haakonvt Oct 27, 2025
89114ec
feat(documents): extend content methods to support external_id and in…
andersfylling Oct 24, 2025
2e28120
avoid 'Task exception was never retrieved' in Datapoints API
haakonvt Nov 3, 2025
67cc841
update set_max_workers -> override_semaphore in tests/utils.py
haakonvt Nov 3, 2025
2c728f2
mypy pass of unit tests (+ minor fixes)
haakonvt Nov 3, 2025
0ee0b78
update to using override_semaphore in tests
haakonvt Nov 4, 2025
a50fb4d
update datapoints->dataframe tests after MultiIndex columns change
haakonvt Nov 4, 2025
6a14da1
improve robustness of workflow tests. change trigger to avoid spam
haakonvt Nov 4, 2025
4b304eb
update transformations tests (some used to be async even bef v8)
haakonvt Nov 4, 2025
2201904
do a mypy pass on tests
haakonvt Nov 4, 2025
1a9462d
change scopes arg of OAuthClientCredentials to allow None
haakonvt Nov 4, 2025
5a05f23
final mypy pass on sync APIs
haakonvt Nov 3, 2025
8f8eae6
use response header to evaluate is_auto_retryable (not .json())
haakonvt Nov 3, 2025
dc6da5d
always keep time series identifier in dataframe columns
haakonvt Nov 3, 2025
e62f312
perf: short circuit in util fn: at_least_one_is_not_none
haakonvt Nov 3, 2025
76b28f4
remove 'Cannot chain result sets...' check in instances/subscribe
haakonvt Nov 3, 2025
c853d96
remove no longer needed err handling of 'response.http_version'
haakonvt Nov 3, 2025
7557510
Add dunder str and repr-html to GlobalConfig
haakonvt Nov 3, 2025
7f40b29
remove upper bound on pre-commit. run autoupdate
haakonvt Nov 3, 2025
927b9d0
final mypy pass of fixes
haakonvt Nov 3, 2025
d7f38c1
final tests fixups
haakonvt Nov 4, 2025
6ce01de
final pass on sync APIs
haakonvt Nov 4, 2025
f82ec1b
bump version to 8.0.0a1
haakonvt Oct 13, 2025
471758a
update MIGRATION_GUIDE.md for v7 -> v8
haakonvt Nov 4, 2025
bb7caaa
fix generator return annot to union of iterators
haakonvt Nov 6, 2025
1d9f664
fix generator return annot to union of iterators in sync api
haakonvt Nov 6, 2025
25869f8
prepare codegen (sync api/client) for pre-commit/CI
haakonvt Nov 9, 2025
3adb175
run code-gen on edited files in commit (in pre-commit)
haakonvt Nov 9, 2025
d0e2950
verify all codegen files in new CI check (.github/workflows/build.yml)
haakonvt Nov 9, 2025
5c00175
add section on 'Automatic Code Generation' to CONTRIBUTING.md
haakonvt Nov 9, 2025
1ba5b84
drop base_url default in ClientConfig. add cluster as opt
haakonvt Nov 10, 2025
2439447
refactor filters to impl _load on subclasses
haakonvt Nov 12, 2025
52c5956
rename default_for_azure_ad to default_for_entra_id
haakonvt Nov 12, 2025
743e856
allow NodeID in DirectRelationReference.load
haakonvt Nov 12, 2025
695a085
Split the DM container classes into read/write
audunska Oct 21, 2025
4fd6abd
handle UnicodeEncodeError from strict httpx ascii-only header req
haakonvt Nov 14, 2025
c760443
clean up AggregatedValue in data_classes/aggregations.py
haakonvt Nov 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[run]
source=cognite
source =
cognite
tests
omit =
cognite/client/_proto/*

Expand Down
2 changes: 1 addition & 1 deletion .gemini/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import logging
from pathlib import Path
from typing import TYPE_CHECKING

from requests import Response
from httpx import Response

from cognite.client.data_classes import Asset

Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ name: build
on:
merge_group:
pull_request:
branches: [master]

concurrency:
group: pr-${{ github.workflow }}-${{ github.head_ref }}
Expand All @@ -14,36 +13,46 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
with:
extras: "-E pandas"
- name: Linting and static code checks
run: pre-commit run --all-files --show-diff-on-failure

verify-sync-codegen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
with:
extras: "-E pandas"
- name: Ensures sync code is up-to-date, with no stale files
run: python scripts/sync_client_codegen/main.py verify

build_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Build docs
run: cd docs && make html SPHINXOPTS="-W --keep-going"

build_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Build package
run: poetry build

test_core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Test core
run: pytest tests/tests_unit -n8 --dist loadscope --maxfail 10 -m 'not dsl' --test-deps-only-core
run: pytest tests/tests_unit -n6 --dist loadscope --maxfail 10 -m 'not dsl' --test-deps-only-core

test_full:
runs-on: ${{ matrix.os }}
Expand All @@ -53,7 +62,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
with:
python_version: ${{ matrix.python-version }}
Expand All @@ -73,6 +82,7 @@ jobs:
run: pytest --durations=10 --cov --cov-report term --cov-report xml:coverage.xml -n8 --dist loadscope --reruns 2 --maxfail 20

- uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5
# Report code coverage from windows runner; xdist + ubuntu gives incorrect results
if: matrix.os == 'windows-latest' && matrix.python-version == '3.10'
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/verify-jupyter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:
whl_file=$(find dist -name "*.whl" | sed 's|^dist/||') # Find the built wheel file, remove dist/ prefix
echo "Found built wheel file: $whl_file"
SDK_FILE_PATH=$whl_file \
PACKAGES="[\"pyodide-http\", \"http://localhost:3000/dist/$whl_file\"]" \
PACKAGES="[\"anyio\", \"http://localhost:3000/dist/$whl_file\"]" \
node scripts/test-pyodide.js
2 changes: 1 addition & 1 deletion .github/workflows/verify-streamlit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:
whl_file=$(find dist -name "*.whl" | sed 's|^dist/||') # Find the built wheel file, remove dist/ prefix
echo "Found built wheel file: $whl_file"
SDK_FILE_PATH=$whl_file \
PACKAGES="[\"pyodide-http\", \"http://localhost:3000/dist/$whl_file\"]" \
PACKAGES="[\"ssl\", \"anyio\", \"http://localhost:3000/dist/$whl_file\"]" \
node scripts/test-pyodide.js
24 changes: 11 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ repos:
- --fix
- --exit-non-zero-on-fix
- --force-exclude

- id: ruff-format
name: ruff format
language: python
Expand All @@ -32,22 +33,11 @@ repos:
hooks:
- id: mypy
name: mypy
# Eventually we want to run mypy on the whole test code base. But for now we only enable it for data modeling, simulators and datapoints
entry: |
poetry run dmypy run -- cognite tests/tests_integration/test_api/test_data_modeling
tests/tests_unit/test_data_classes/test_data_models
tests/tests_unit/test_utils/test_time.py
tests/tests_integration/test_api/test_datapoints.py
tests/tests_integration/test_api/test_simulators
tests/tests_integration/test_api/test_principals.py
tests/tests_unit/test_api/test_simulators
tests/tests_unit/test_data_classes/test_simulators.py
entry: poetry run dmypy run -- cognite tests
files: ^.*.(py|pyi)$
language: system
pass_filenames: false

- repo: local
hooks:
- id: custom-checks
name: custom repo checks
entry: poetry run python scripts/run_checks.py
Expand All @@ -56,8 +46,16 @@ repos:
pass_filenames: true
require_serial: true # avoid possible race conditions

- id: sync-client-codegen
name: run sync codegen on changed files
entry: poetry run python scripts/sync_client_codegen/main.py run --files
Copy link
Collaborator

Choose a reason for hiding this comment

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

This fails if the sync client is not up to date right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, the client itself it always checked

files: ^cognite/.*.(py|pyi)$
language: system
pass_filenames: true
require_serial: true

- repo: https://github.com/jsh9/pydoclint # Run after 'custom-checks' as these may auto-fix
rev: 0.7.3
rev: 0.8.1
hooks:
- id: pydoclint
require_serial: true # Spammy in run-all scenarios (more than fast enough already)
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ As of 2025-08-29, changes are grouped as follows
- 🐛 Bug Fixes: Bug fixes.
- ⚡ Improvements: Transparent changes, e.g. better performance.

## [7.89.0](https://github.com/cognitedata/cognite-sdk-python/compare/v7.88.0...v7.89.0) (2025-11-04)


### Features

* **simint-alpha:** add kind=long routines support ([#2388](https://github.com/cognitedata/cognite-sdk-python/issues/2388)) ([e9e2c9e](https://github.com/cognitedata/cognite-sdk-python/commit/e9e2c9ee7965aed71b1b8db4f609ab3cb17a7e22))

## [7.88.0](https://github.com/cognitedata/cognite-sdk-python/compare/v7.87.0...v7.88.0) (2025-10-22)


Expand Down
64 changes: 56 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Get the code!

```bash
git clone https://github.com/cognitedata/cognite-sdk-python.git
git clone https://github.com/cognitedata/cognite-sdk-python
cd cognite-sdk-python
```

Expand All @@ -15,10 +15,12 @@ Install dependencies and initialize a shell within the virtual environment, with

```bash
poetry install -E all
poetry shell
poetry env activate
```

Install pre-commit hooks to run static code checks on every commit:
Note that `poetry env activate` only prints out the command, you have to run it yourself (or wrap it in `eval`). You may also prefix commands with `poetry run`.

Install pre-commit hooks to run various checks and linters on every commit:

```bash
pre-commit install
Expand All @@ -30,9 +32,15 @@ You can also manually trigger the static checks with:
pre-commit run --all-files
```

### Getting access to python-sdk-test CDF project for running integration tests
To include slower checks that run in CI, include `--hook-stage manual`

```bash
pre-commit run --all-files --hook-stage manual
```

### Getting access to `python-sdk-contributor` CDF project for running integration tests

- Request access to python-sdk AAD tenant.
- Request access to python-sdk AAD tenant. Cognite internals can tag the Python SDK Maintainer shield on Slack.
- Set environment variables as per the interactive login flow below

### Environment Variables
Expand Down Expand Up @@ -69,6 +77,46 @@ COGNITE_CLIENT_ID=6b0b4266-ffa4-4b9b-8e13-ddbbc8a19ea6
#COGNITE_CERTIFICATE=aadappcert.pem
```

### Automatic Code Generation

The main code base in this repository is written for the `AsyncCogniteClient`. From this source code we also create a
"sync" `CogniteClient` through automatic code generation. The async->sync conversion script can be found in `scripts/sync_client_codegen/main.py`. It exclusively writes to `cognite/client/_sync_api/` (and temporary files as part of normalized file compares).

The script stores the hash of file it was created from in the module docstring, in order to quickly skip files that don't need to be updated. A variety of updates does not result in actual code changes in the SyncAPIs, as it only wraps the async client directly.

We have certain rules in place that must be followed:

- **Adding nested APIs: Put one API class per file.**

If the entire API addition is "flat", like classic resource types EventsAPI or FilesAPI, please use a single file directly below `cognite/client/_api/`. Else, add a directory instead. There are plenty of existing examples, e.g. IAMAPI, RawAPI.

#### Run modes
`usage: main.py [-h] [-v] {verify,run} ...`

Use `verify` to ensure all sync source code files are up-to-date and no stale files (that should be removed exists). This is mostly useful as a CI check.

Use `run` to pass a subset of _async_ source files (i.e. anything below `cognite/client/_api/`) to update:

```sh
python scripts/sync_client_codegen/main.py run --files FILE1 FILE2 ...
```
Note: This is how we run it as part of `pre-commit`.

To run through all files, pass `--all-files`. This will also run cleanup automatically:

```sh
python scripts/sync_client_codegen/main.py run --all-files
```

If a sync API file has entered into a bad state (e.g. through manual changes), you can simply delete it (or modify
the hash) to have it re-generated from scratch.

Verbose mode is supported (e.g. debugging). Pass `-v` before the subcommand `run`/`verify`:

```sh
python scripts/sync_client_codegen/main.py -v [run, verify] ...
```

### Testing

Initiate unit tests by running the following command from the root directory:
Expand All @@ -84,7 +132,7 @@ If you want to generate code coverage reports run:
```
pytest tests/tests_unit --cov-report html \
--cov-report xml \
--cov cognite
--cov cognite tests
```

Open `htmlcov/index.html` in the browser to navigate through the report.
Expand All @@ -110,8 +158,8 @@ pytest docs
If you need to add a new capability to the integration runner, you need to create a new Pull Requests (PR) in which
you do the following:

1. Add a read-only version of the new capability to the `scripts/toolkit/acces/auth/readonly.Group.yaml`
2. Add a read-write version of the new capability to the `scripts/toolkit/acces/auth/readwrite.Group.yaml`
1. Add a read-only version of the new capability to the `scripts/toolkit/access/auth/readonly.Group.yaml`
2. Add a read-write version of the new capability to the `scripts/toolkit/access/auth/readwrite.Group.yaml`

Get the PR reviewed by an SDK maintainer. The integration runner will be updated once the PR is merged.

Expand Down
Loading
Loading