Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ Examples:
- Follow PEP 8 conventions.
- Use `autopep8` for Python formatting.

## Copyright Headers

Every new Python (`.py`) source file MUST begin with the following copyright
header as the first two lines, followed by a blank line before any code,
docstring, or imports:

```python
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
```

This applies to all hand-written Python files, including `__init__.py` files,
tests, and examples. The only exceptions are auto-generated protobuf files
(`*_pb2.py` and `*_pb2_grpc.py`), which carry their own generated header.

## Python Type Checking

Before linting, check for and fix any Pylance errors in the files you
Expand Down
2 changes: 2 additions & 0 deletions durabletask-azuremanaged/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
2 changes: 2 additions & 0 deletions durabletask-azuremanaged/durabletask/azuremanaged/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
3 changes: 3 additions & 0 deletions durabletask/entities/durable_entity.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from typing import Any, TypeVar, overload

from durabletask.entities.entity_context import EntityContext
Expand Down
2 changes: 2 additions & 0 deletions durabletask/entities/entity_context.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from typing import Any, TypeVar, overload
import uuid
Expand Down
3 changes: 3 additions & 0 deletions durabletask/entities/entity_instance_id.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

class EntityInstanceId:
def __init__(self, entity: str, key: str):
EntityInstanceId.validate_entity_name(entity)
Expand Down
3 changes: 3 additions & 0 deletions durabletask/entities/entity_lock.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
3 changes: 3 additions & 0 deletions durabletask/entities/entity_metadata.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from datetime import datetime, timezone
from typing import Any, TypeVar, overload
from durabletask.entities.entity_instance_id import EntityInstanceId
Expand Down
3 changes: 3 additions & 0 deletions durabletask/entities/entity_operation_failed_exception.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from durabletask.internal.orchestrator_service_pb2 import TaskFailureDetails
from durabletask.entities.entity_instance_id import EntityInstanceId

Expand Down
3 changes: 3 additions & 0 deletions durabletask/internal/entity_state_shim.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from typing import Any, TypeVar, overload

import durabletask.internal.orchestrator_service_pb2 as pb
Expand Down
3 changes: 3 additions & 0 deletions durabletask/internal/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import durabletask.internal.orchestrator_service_pb2 as pb


Expand Down
3 changes: 3 additions & 0 deletions durabletask/internal/json_encode_output_exception.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from typing import Any


Expand Down
3 changes: 3 additions & 0 deletions durabletask/internal/orchestration_entity_context.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from collections.abc import Generator
from datetime import datetime
from typing import Any
Expand Down
3 changes: 3 additions & 0 deletions durabletask/internal/proto_task_hub_sidecar_service_stub.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from collections.abc import Callable
from typing import Any, Protocol

Expand Down
3 changes: 3 additions & 0 deletions examples/activity_sequence.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that calls an activity function in a sequence and prints the outputs."""
import logging
Expand Down
3 changes: 3 additions & 0 deletions examples/entities/class_based_entity.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that calls an activity function in a sequence and prints the outputs."""
import os
Expand Down
3 changes: 3 additions & 0 deletions examples/entities/class_based_entity_actions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that calls an activity function in a sequence and prints the outputs."""
import os
Expand Down
3 changes: 3 additions & 0 deletions examples/entities/entity_locking.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that calls an activity function in a sequence and prints the outputs."""
import os
Expand Down
3 changes: 3 additions & 0 deletions examples/entities/function_based_entity.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that calls an activity function in a sequence and prints the outputs."""
import os
Expand Down
3 changes: 3 additions & 0 deletions examples/entities/function_based_entity_actions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that calls an activity function in a sequence and prints the outputs."""
import os
Expand Down
3 changes: 3 additions & 0 deletions examples/fanout_fanin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that a dynamic number activity functions in parallel, waits for them all
to complete, and prints an aggregate summary of the outputs."""
Expand Down
3 changes: 3 additions & 0 deletions examples/human_interaction.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that waits for an "approval" event before proceding to the next step. If
the approval isn't received within a specified timeout, the order that is
Expand Down
3 changes: 3 additions & 0 deletions examples/sandboxes/main_app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""Declarer app for the Durable Task Scheduler sandbox activities sample."""

import os
Expand Down
3 changes: 3 additions & 0 deletions examples/sandboxes/remote_worker.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""Remote worker image entrypoint for the Durable Task Scheduler sandbox activities sample."""

import os
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import os
from azure.identity import DefaultAzureCredential
from durabletask import client
Expand Down
3 changes: 3 additions & 0 deletions examples/sub-orchestrations-with-fan-out-fan-in/worker.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import os
import random
import time
Expand Down
3 changes: 3 additions & 0 deletions examples/version_aware_orchestrator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that a dynamic number activity functions in parallel, waits for them all
to complete, and prints an aggregate summary of the outputs."""
Expand Down
3 changes: 3 additions & 0 deletions examples/work_item_filtering.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to use work item filters
to control which orchestrations and activities a worker processes."""
import os
Expand Down
2 changes: 2 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
2 changes: 2 additions & 0 deletions tests/durabletask-azuremanaged/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
2 changes: 2 additions & 0 deletions tests/durabletask-azuremanaged/entities/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from datetime import datetime, timezone
import os
import time
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import json
import os
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from datetime import datetime, timezone
import os
import time
Expand Down
3 changes: 3 additions & 0 deletions tests/durabletask-azuremanaged/test_dts_activity_sequence.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""End-to-end sample that demonstrates how to configure an orchestrator
that calls an activity function in a sequence and prints the outputs."""
import os
Expand Down
2 changes: 2 additions & 0 deletions tests/durabletask-azuremanaged/test_dts_batch_actions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import asyncio
import logging
Expand Down
3 changes: 3 additions & 0 deletions tests/durabletask/entities/test_entity_id_parsing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import pytest
from durabletask.entities import EntityInstanceId

Expand Down
2 changes: 2 additions & 0 deletions tests/durabletask/extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
2 changes: 2 additions & 0 deletions tests/durabletask/extensions/history_export/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
3 changes: 3 additions & 0 deletions tests/durabletask/test_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import asyncio
import inspect
import json
Expand Down
3 changes: 3 additions & 0 deletions tests/durabletask/test_entity_executor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""Unit tests for the _EntityExecutor class in durabletask.worker."""
import logging

Expand Down
3 changes: 3 additions & 0 deletions tests/durabletask/test_worker_concurrency_loop.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import asyncio
import threading
import time
Expand Down
3 changes: 3 additions & 0 deletions tests/durabletask/test_worker_concurrency_loop_async.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import asyncio

from durabletask.worker import ConcurrencyOptions, TaskHubGrpcWorker
Expand Down
3 changes: 3 additions & 0 deletions tests/durabletask/test_worker_resiliency.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import asyncio
import grpc
from threading import Event, Timer
Expand Down
Loading