arthur-common 0.0.0.post0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. arthur_common-0.0.0.post0/.bumpversion.cfg +11 -0
  2. arthur_common-0.0.0.post0/.github/workflows/arthur-common-release.yml +163 -0
  3. arthur_common-0.0.0.post0/.github/workflows/arthur-common-version-bump.yml +49 -0
  4. arthur_common-0.0.0.post0/.github/workflows/arthur-common-workflow.yml +62 -0
  5. arthur_common-0.0.0.post0/.github/workflows/claude-code-review.yml +45 -0
  6. arthur_common-0.0.0.post0/.github/workflows/claude.yml +50 -0
  7. arthur_common-0.0.0.post0/.github/workflows/composite-actions/setup-git/action.yml +34 -0
  8. arthur_common-0.0.0.post0/.github/workflows/composite-actions/setup-poetry/action.yml +17 -0
  9. arthur_common-0.0.0.post0/.github/workflows/composite-actions/setup-uv/action.yml +13 -0
  10. arthur_common-0.0.0.post0/.gitignore +126 -0
  11. arthur_common-0.0.0.post0/.pre-commit-config.yaml +61 -0
  12. arthur_common-0.0.0.post0/CLAUDE.md +302 -0
  13. arthur_common-0.0.0.post0/PKG-INFO +65 -0
  14. arthur_common-0.0.0.post0/README.md +44 -0
  15. arthur_common-0.0.0.post0/pyproject.toml +91 -0
  16. arthur_common-0.0.0.post0/renovate.json +24 -0
  17. arthur_common-0.0.0.post0/src/arthur_common/__init__.py +0 -0
  18. arthur_common-0.0.0.post0/src/arthur_common/aggregations/__init__.py +2 -0
  19. arthur_common-0.0.0.post0/src/arthur_common/aggregations/aggregator.py +304 -0
  20. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/README.md +26 -0
  21. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/__init__.py +25 -0
  22. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/agentic_aggregations.py +1891 -0
  23. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/categorical_count.py +139 -0
  24. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/confusion_matrix.py +521 -0
  25. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/inference_count.py +112 -0
  26. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/inference_count_by_class.py +286 -0
  27. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/inference_null_count.py +130 -0
  28. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/mean_absolute_error.py +164 -0
  29. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/mean_squared_error.py +164 -0
  30. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/multiclass_confusion_matrix.py +287 -0
  31. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/multiclass_inference_count_by_class.py +118 -0
  32. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/numeric_stats.py +135 -0
  33. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/numeric_sum.py +135 -0
  34. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/py.typed +0 -0
  35. arthur_common-0.0.0.post0/src/arthur_common/aggregations/functions/shield_aggregations.py +1161 -0
  36. arthur_common-0.0.0.post0/src/arthur_common/aggregations/py.typed +0 -0
  37. arthur_common-0.0.0.post0/src/arthur_common/config/__init__.py +0 -0
  38. arthur_common-0.0.0.post0/src/arthur_common/config/config.py +42 -0
  39. arthur_common-0.0.0.post0/src/arthur_common/config/settings.yaml +4 -0
  40. arthur_common-0.0.0.post0/src/arthur_common/models/__init__.py +0 -0
  41. arthur_common-0.0.0.post0/src/arthur_common/models/agent_governance_schemas.py +170 -0
  42. arthur_common-0.0.0.post0/src/arthur_common/models/audit_log_schemas.py +42 -0
  43. arthur_common-0.0.0.post0/src/arthur_common/models/common_schemas.py +214 -0
  44. arthur_common-0.0.0.post0/src/arthur_common/models/connectors.py +80 -0
  45. arthur_common-0.0.0.post0/src/arthur_common/models/constants.py +24 -0
  46. arthur_common-0.0.0.post0/src/arthur_common/models/datasets.py +14 -0
  47. arthur_common-0.0.0.post0/src/arthur_common/models/enums.py +203 -0
  48. arthur_common-0.0.0.post0/src/arthur_common/models/llm_model_providers.py +374 -0
  49. arthur_common-0.0.0.post0/src/arthur_common/models/metric_schemas.py +63 -0
  50. arthur_common-0.0.0.post0/src/arthur_common/models/metrics.py +297 -0
  51. arthur_common-0.0.0.post0/src/arthur_common/models/py.typed +0 -0
  52. arthur_common-0.0.0.post0/src/arthur_common/models/request_schemas.py +927 -0
  53. arthur_common-0.0.0.post0/src/arthur_common/models/response_schemas.py +855 -0
  54. arthur_common-0.0.0.post0/src/arthur_common/models/schema_definitions.py +656 -0
  55. arthur_common-0.0.0.post0/src/arthur_common/models/task_eval_schemas.py +150 -0
  56. arthur_common-0.0.0.post0/src/arthur_common/models/task_job_specs.py +102 -0
  57. arthur_common-0.0.0.post0/src/arthur_common/py.typed +0 -0
  58. arthur_common-0.0.0.post0/src/arthur_common/tools/__init__.py +0 -0
  59. arthur_common-0.0.0.post0/src/arthur_common/tools/aggregation_analyzer.py +274 -0
  60. arthur_common-0.0.0.post0/src/arthur_common/tools/aggregation_loader.py +59 -0
  61. arthur_common-0.0.0.post0/src/arthur_common/tools/duckdb_data_loader.py +401 -0
  62. arthur_common-0.0.0.post0/src/arthur_common/tools/duckdb_utils.py +32 -0
  63. arthur_common-0.0.0.post0/src/arthur_common/tools/functions.py +46 -0
  64. arthur_common-0.0.0.post0/src/arthur_common/tools/py.typed +0 -0
  65. arthur_common-0.0.0.post0/src/arthur_common/tools/schema_inferer.py +122 -0
  66. arthur_common-0.0.0.post0/src/arthur_common/tools/time_utils.py +33 -0
  67. arthur_common-0.0.0.post0/tests/test_data/agentic_trace_metadata/inferences.json +34964 -0
  68. arthur_common-0.0.0.post0/tests/test_data/balloons/flights.csv +851 -0
  69. arthur_common-0.0.0.post0/tests/test_data/balloons/ground_truth.csv +851 -0
  70. arthur_common-0.0.0.post0/tests/test_data/balloons/inference_generator.py +142 -0
  71. arthur_common-0.0.0.post0/tests/test_data/balloons/reference.csv +151 -0
  72. arthur_common-0.0.0.post0/tests/test_data/electricity/README.md +64 -0
  73. arthur_common-0.0.0.post0/tests/test_data/electricity/energy_charts_all_cities.png +0 -0
  74. arthur_common-0.0.0.post0/tests/test_data/electricity/energy_dataset.csv +14391 -0
  75. arthur_common-0.0.0.post0/tests/test_data/electricity/inference_generator.py +411 -0
  76. arthur_common-0.0.0.post0/tests/test_data/emails/emails.json +392 -0
  77. arthur_common-0.0.0.post0/tests/test_data/emails/ground_truth.json +1 -0
  78. arthur_common-0.0.0.post0/tests/test_data/emails/inferences.json +1 -0
  79. arthur_common-0.0.0.post0/tests/test_data/emails/reference_data.json +1 -0
  80. arthur_common-0.0.0.post0/tests/test_data/emails/split_dataset.py +37 -0
  81. arthur_common-0.0.0.post0/tests/test_data/equipment_inspection/README.md +5 -0
  82. arthur_common-0.0.0.post0/tests/test_data/equipment_inspection/inference_generator.py +105 -0
  83. arthur_common-0.0.0.post0/tests/test_data/equipment_inspection/inferences.csv +1001 -0
  84. arthur_common-0.0.0.post0/tests/test_data/equipment_inspection/requirements.txt +3 -0
  85. arthur_common-0.0.0.post0/tests/test_data/networking/inference_generator.py +231 -0
  86. arthur_common-0.0.0.post0/tests/test_data/networking/network_packets_dataset.csv +25001 -0
  87. arthur_common-0.0.0.post0/tests/test_data/traintimes/inference_generator.py +241 -0
  88. arthur_common-0.0.0.post0/tests/test_data/traintimes/train_delays.csv +50001 -0
  89. arthur_common-0.0.0.post0/tests/test_data/traintimes/train_delays_visualization.png +0 -0
  90. arthur_common-0.0.0.post0/tests/test_data/traintimes/visualize_delays.py +66 -0
  91. arthur_common-0.0.0.post0/tests/test_data/vehicles/generate_data.py +76 -0
  92. arthur_common-0.0.0.post0/tests/test_data/vehicles/vehicle_classification_data.csv +201 -0
  93. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/__init__.py +0 -0
  94. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/conftest.py +622 -0
  95. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/helpers.py +83 -0
  96. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_agentic_aggregations.py +984 -0
  97. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_aggregation_function.py +100 -0
  98. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_aggregation_loader.py +14 -0
  99. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_categorical_count.py +85 -0
  100. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_confusion_matrix.py +233 -0
  101. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_count_by_class.py +131 -0
  102. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_general_numerics.py +118 -0
  103. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_inference_count.py +55 -0
  104. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_inference_null_counts.py +64 -0
  105. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_mean_absolute_error.py +77 -0
  106. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_mean_squared_error.py +75 -0
  107. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_multiclass_confusion_matrix.py +94 -0
  108. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_multiclass_count_by_class.py +59 -0
  109. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_shield_inference_hallucination_count.py +71 -0
  110. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_shield_inference_pass_fail_count.py +82 -0
  111. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_shield_rule_count.py +94 -0
  112. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_shield_token_count.py +213 -0
  113. arthur_common-0.0.0.post0/tests/unit/aggregation_functions/test_shield_toxicity_score.py +87 -0
  114. arthur_common-0.0.0.post0/tests/unit/models/__init__.py +0 -0
  115. arthur_common-0.0.0.post0/tests/unit/models/test_agent_governance_schemas.py +234 -0
  116. arthur_common-0.0.0.post0/tests/unit/models/test_shield_api_models.py +270 -0
  117. arthur_common-0.0.0.post0/tests/unit/tools/test_aggregation_analyzer.py +521 -0
  118. arthur_common-0.0.0.post0/tests/unit/tools/test_duck_db_operations.py +480 -0
  119. arthur_common-0.0.0.post0/tests/unit/tools/test_duckdb_data_loader.py +276 -0
  120. arthur_common-0.0.0.post0/tests/unit/tools/test_schema_inference.py +345 -0
  121. arthur_common-0.0.0.post0/uv.lock +2398 -0
@@ -0,0 +1,11 @@
1
+ [bumpversion]
2
+ current_version = 2.4.56
3
+ commit = True
4
+ tag = True
5
+ tag_name = {new_version}
6
+ parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
7
+ serialize = {major}.{minor}.{patch}
8
+
9
+ [bumpversion:file:pyproject.toml]
10
+ search = version = "{current_version}"
11
+ replace = version = "{new_version}"
@@ -0,0 +1,163 @@
1
+ name: Arthur Common Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - '*-lts'
9
+ - '*-lts-patch-*'
10
+
11
+ jobs:
12
+ pypi-build:
13
+ # Should be separate from publish job: https://docs.pypi.org/trusted-publishers/security-model/#:~:text=Retrieve%20the%20publishable%20distribution%20files%20from%20a%20separate%20build%20job%3B
14
+ # written from guide: https://johnfraney.ca/blog/how-to-publish-a-python-package-with-poetry-and-github-actions/
15
+ name: Build release for PyPI
16
+ if: github.ref_type == 'branch' && startsWith(github.event.head_commit.message, 'Bump version')
17
+ runs-on: ubuntu-latest
18
+ env:
19
+ GIT_DEPTH: 100
20
+ permissions:
21
+ contents: read
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ with:
25
+ fetch-depth: ${{ env.GIT_DEPTH }}
26
+ ref: main
27
+ - uses: ./.github/workflows/composite-actions/setup-git
28
+ with:
29
+ safe-directory: ${{ runner.workspace }}
30
+ - uses: ./.github/workflows/composite-actions/setup-uv
31
+ - name: Package project
32
+ run: uv build
33
+ - name: List build artifacts
34
+ run: ls -la dist/
35
+ - name: Archive package
36
+ uses: actions/upload-artifact@v4
37
+ with:
38
+ name: arthur-common
39
+ path: dist/
40
+ retention-days: 1
41
+ if-no-files-found: error
42
+
43
+ pypi-publish:
44
+ # don't add more steps to this job—it should only publish so that steps with access to the OIDC token for use with
45
+ # PyPI are as limited as possible
46
+ needs: pypi-build
47
+ # does not run on dev—https://packaging.python.org/en/latest/specifications/version-specifiers/#version-specifiers:~:text=Local%20version%20identifiers%20SHOULD%20NOT%20be%20used%20when%20publishing%20upstream%20projects%20to%20a%20public%20index%20server%2C%20but%20MAY%20be%20used%20to%20identify%20private%20builds%20created%20directly%20from%20the%20project%20source.
48
+ name: Upload release to PyPI
49
+ if: github.ref_type == 'branch' && startsWith(github.event.head_commit.message, 'Bump version')
50
+ runs-on: ubuntu-latest
51
+ environment: # must be the same as what is set for the trusted publisher in PyPI
52
+ name: shared-protected-branch-secrets
53
+ url: https://pypi.org/project/arthur-common/
54
+ permissions:
55
+ contents: read
56
+ id-token: write # needed for PyPI trusted publishing to create short-lived ID token to verify authority to publish
57
+ steps:
58
+ - name: Download distribution from pypi-build job
59
+ uses: actions/download-artifact@v4
60
+ with:
61
+ name: arthur-common
62
+ path: dist
63
+ - name: List downloaded artifacts
64
+ run: ls -la dist/
65
+ - name: Publish package distributions to PyPI
66
+ uses: pypa/gh-action-pypi-publish@release/v1
67
+ with:
68
+ packages-dir: dist
69
+
70
+ create-git-tag:
71
+ needs: pypi-publish
72
+ name: Create git tag for the release
73
+ if: github.ref_type == 'branch' && startsWith(github.event.head_commit.message, 'Bump version')
74
+ runs-on: ubuntu-latest
75
+ environment: # must be the same as what is set for the trusted publisher in PyPI
76
+ name: shared-protected-branch-secrets
77
+ url: https://pypi.org/project/arthur-common/
78
+ permissions:
79
+ contents: write
80
+ steps:
81
+ - name: Generate Arthur GitHub Automator App Token
82
+ id: generate-token
83
+ uses: actions/create-github-app-token@v1
84
+ with:
85
+ app-id: ${{ secrets.ARTHUR_GH_AUTOMATOR_APP_ID }}
86
+ private-key: ${{ secrets.ARTHUR_GH_AUTOMATOR_APP_PRIVATE_KEY }}
87
+ - uses: actions/checkout@v4
88
+ with:
89
+ token: ${{ steps.generate-token.outputs.token }}
90
+ - uses: ./.github/workflows/composite-actions/setup-git
91
+ with:
92
+ safe-directory: ${{ runner.workspace }}
93
+ - uses: ./.github/workflows/composite-actions/setup-uv
94
+ - name: Get current version
95
+ id: get-version
96
+ run: |
97
+ VERSION=$(python -c "import tomllib; data=tomllib.load(open('pyproject.toml','rb')); print(data['project']['version'])")
98
+ echo "Current version: $VERSION"
99
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
100
+ - name: Create and push git tag
101
+ run: |
102
+ git tag ${{ steps.get-version.outputs.version }}
103
+ git push origin ${{ steps.get-version.outputs.version }}
104
+
105
+ # ---------------------------------------------------------------------------
106
+ # LTS publish — fires on *-lts and *-lts-patch-* tags only.
107
+ # The lts-management orchestrator writes pyproject.toml to the .post form
108
+ # (e.g. 1.5.0.post0) and pushes the LTS tag, which triggers these jobs.
109
+ # PyPI versions are immutable so we rebuild the wheel rather than retag.
110
+ # ---------------------------------------------------------------------------
111
+
112
+ lts-pypi-build:
113
+ name: Build LTS wheel
114
+ if: github.ref_type == 'tag'
115
+ runs-on: ubuntu-latest
116
+ permissions:
117
+ contents: read
118
+ steps:
119
+ - uses: actions/checkout@v4
120
+ with:
121
+ ref: ${{ github.ref }}
122
+ - uses: ./.github/workflows/composite-actions/setup-git
123
+ with:
124
+ safe-directory: ${{ runner.workspace }}
125
+ # Use astral-sh/setup-uv directly (NOT the local setup-uv composite,
126
+ # which runs `uv sync --frozen` — the orchestrator changed pyproject.toml
127
+ # putting it out of sync with uv.lock). uv build doesn't need a synced env.
128
+ - uses: astral-sh/setup-uv@v5
129
+ with:
130
+ version: "0.11.7"
131
+ - name: Build wheel
132
+ run: uv build
133
+ - name: List artifacts
134
+ run: ls -la dist/
135
+ - name: Archive wheel
136
+ uses: actions/upload-artifact@v4
137
+ with:
138
+ name: arthur-common-lts
139
+ path: dist/
140
+ retention-days: 1
141
+ if-no-files-found: error
142
+
143
+ lts-pypi-publish:
144
+ name: Publish LTS wheel to PyPI
145
+ needs: lts-pypi-build
146
+ if: github.ref_type == 'tag'
147
+ runs-on: ubuntu-latest
148
+ environment:
149
+ name: shared-protected-branch-secrets
150
+ url: https://pypi.org/project/arthur-common/
151
+ permissions:
152
+ contents: read
153
+ id-token: write
154
+ steps:
155
+ - uses: actions/download-artifact@v4
156
+ with:
157
+ name: arthur-common-lts
158
+ path: dist
159
+ - run: ls -la dist/
160
+ - name: Publish to PyPI
161
+ uses: pypa/gh-action-pypi-publish@release/v1
162
+ with:
163
+ packages-dir: dist
@@ -0,0 +1,49 @@
1
+ name: Arthur Common Version Bump
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ intent:
7
+ description: 'Trigger version bump'
8
+ required: true
9
+ default: 'bump_version'
10
+ type: string
11
+ bump_type:
12
+ description: 'Version bump type (patch, minor, major)'
13
+ required: true
14
+ default: 'patch'
15
+ type: choice
16
+ options:
17
+ - patch
18
+ - minor
19
+ - major
20
+
21
+ jobs:
22
+ bump-version:
23
+ environment: shared-protected-branch-secrets
24
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.intent == 'bump_version'
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - name: Generate Arthur GitHub Automator App Token
28
+ id: generate-token
29
+ uses: actions/create-github-app-token@v1
30
+ with:
31
+ app-id: ${{ secrets.ARTHUR_GH_AUTOMATOR_APP_ID }}
32
+ private-key: ${{ secrets.ARTHUR_GH_AUTOMATOR_APP_PRIVATE_KEY }}
33
+ - uses: actions/checkout@v5
34
+ with:
35
+ fetch-depth: 0
36
+ token: ${{ steps.generate-token.outputs.token }}
37
+ - uses: ./.github/workflows/composite-actions/setup-git
38
+ with:
39
+ safe-directory: ${{ runner.workspace }}
40
+ - uses: astral-sh/setup-uv@v5
41
+ with:
42
+ version: "0.6.x"
43
+ - name: Bump version
44
+ run: |
45
+ uvx bump2version ${{ github.event.inputs.bump_type }}
46
+
47
+ git status
48
+
49
+ git push origin
@@ -0,0 +1,62 @@
1
+ name: Arthur Common CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ run-linter:
13
+ runs-on: ubuntu-latest
14
+ env:
15
+ SKIP: pytest-check,changelog-check
16
+ GIT_DEPTH: 100
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: ${{ env.GIT_DEPTH }}
21
+ - uses: ./.github/workflows/composite-actions/setup-git
22
+ with:
23
+ safe-directory: ${{ runner.workspace }}
24
+ - uses: ./.github/workflows/composite-actions/setup-uv
25
+ - name: Run linters
26
+ run: |
27
+ uv run autoflake src/
28
+ uv run isort src/
29
+ uv run black src/
30
+ uv run mypy --config-file pyproject.toml src/
31
+
32
+ run-unit-tests:
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - uses: ./.github/workflows/composite-actions/setup-git
37
+ with:
38
+ safe-directory: ${{ runner.workspace }}
39
+ - uses: ./.github/workflows/composite-actions/setup-uv
40
+ - name: Run unit tests
41
+ shell: bash
42
+ run: |
43
+ set -o pipefail
44
+ uv run pytest tests/unit/ --cov --cov=src/arthur_common \
45
+ --cov-report term \
46
+ --junitxml=report.xml \
47
+ | tee pytest-coverage.txt
48
+ - name: Pytest coverage comment
49
+ if: always()
50
+ uses: MishaKav/pytest-coverage-comment@main
51
+ with:
52
+ pytest-coverage-path: pytest-coverage.txt
53
+ junitxml-path: report.xml
54
+ title: Coverage Report
55
+ - name: Upload coverage report
56
+ if: always()
57
+ uses: actions/upload-artifact@v4
58
+ with:
59
+ name: test-results
60
+ path: |
61
+ report.xml
62
+ pytest-coverage.txt
@@ -0,0 +1,45 @@
1
+ name: Claude Code Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize]
6
+ # Optional: Only run on specific file changes
7
+ # paths:
8
+ # - "src/**/*.ts"
9
+ # - "src/**/*.tsx"
10
+ # - "src/**/*.js"
11
+ # - "src/**/*.jsx"
12
+
13
+ jobs:
14
+ claude-review:
15
+ # Optional: Filter by PR author
16
+ # if: |
17
+ # github.event.pull_request.user.login == 'external-contributor' ||
18
+ # github.event.pull_request.user.login == 'new-developer' ||
19
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
+
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ contents: read
24
+ pull-requests: write
25
+ issues: read
26
+ id-token: write
27
+
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v4
31
+ with:
32
+ fetch-depth: 1
33
+
34
+ - name: Run Claude Code Review
35
+ id: claude-review
36
+ uses: anthropics/claude-code-action@v1
37
+ with:
38
+ anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
39
+ plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
40
+ plugins: 'code-review@claude-code-plugins'
41
+ prompt: '/code-review:code-review --comment https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
42
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
43
+ # Example prompts and configurations: https://github.com/anthropics/claude-code-action/blob/main/docs/solutions.md
44
+ # CLI flags: https://code.claude.com/docs/en/cli-reference
45
+ # Code review plugin: https://github.com/anthropics/claude-code/tree/main/plugins/code-review
@@ -0,0 +1,50 @@
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: write
24
+ issues: read
25
+ id-token: write
26
+ actions: read # Required for Claude to read CI results on PRs
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 1
32
+
33
+ - name: Run Claude Code
34
+ id: claude
35
+ uses: anthropics/claude-code-action@v1
36
+ with:
37
+ anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
38
+
39
+ # This is an optional setting that allows Claude to read CI results on PRs
40
+ additional_permissions: |
41
+ actions: read
42
+
43
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44
+ # prompt: 'Update the pull request description to include a summary of changes.'
45
+
46
+ # Optional: Add claude_args to customize behavior and configuration
47
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48
+ # or https://code.claude.com/docs/en/cli-reference for available options
49
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
50
+
@@ -0,0 +1,34 @@
1
+ name: 'Setup Git'
2
+ description: 'Installs and configures Git'
3
+
4
+ inputs:
5
+ safe-directory:
6
+ description: 'Directory to mark as safe for Git operations'
7
+ required: true
8
+
9
+ runs:
10
+ using: 'composite'
11
+ steps:
12
+ - name: 'Configure Git user'
13
+ shell: bash
14
+ run: |
15
+ git config --global user.email "github_ci@arthur.ai"
16
+ git config --global user.name "GitHub CI"
17
+
18
+ - name: 'Configure safe directory'
19
+ shell: bash
20
+ # run: git config --global --add safe.directory ${{ inputs.safe-directory }}
21
+ # run: git config --global --add safe.directory ${{ runner.workspace }}
22
+ run: git config --global --add safe.directory /__w/arthur-common/arthur-common
23
+
24
+ - name: 'Fetch tags'
25
+ shell: bash
26
+ run: git fetch --tags origin || true
27
+
28
+ - name: 'Show recent commits'
29
+ shell: bash
30
+ run: git log -n2
31
+
32
+ - name: 'Show repository status'
33
+ shell: bash
34
+ run: git status
@@ -0,0 +1,17 @@
1
+ name: 'Setup Poetry'
2
+ description: 'Installs and configures Poetry'
3
+
4
+ inputs:
5
+ poetry-version:
6
+ description: 'Poetry version to install'
7
+ required: true
8
+ default: '2.1.3'
9
+
10
+ runs:
11
+ using: 'composite'
12
+ steps:
13
+ - name: 'Setup Poetry'
14
+ shell: bash
15
+ run: |
16
+ pip install poetry==${{ inputs.poetry-version }}
17
+ poetry install
@@ -0,0 +1,13 @@
1
+ name: 'Setup uv'
2
+ description: 'Installs uv and syncs dependencies'
3
+
4
+ runs:
5
+ using: 'composite'
6
+ steps:
7
+ - name: 'Install uv'
8
+ uses: astral-sh/setup-uv@v5
9
+ with:
10
+ version: "0.11.7"
11
+ - name: 'Install dependencies'
12
+ shell: bash
13
+ run: uv sync --all-groups --frozen
@@ -0,0 +1,126 @@
1
+ .idea
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ .hypothesis/
50
+ .pytest_cache/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+
60
+ # Flask stuff:
61
+ instance/
62
+ .webassets-cache
63
+
64
+ # Scrapy stuff:
65
+ .scrapy
66
+
67
+ # Sphinx documentation
68
+ docs/_build/
69
+
70
+ # PyBuilder
71
+ .target/
72
+
73
+ # Jupyter Notebook
74
+ .ipynb_checkpoints
75
+
76
+ # IPython
77
+ profile_default/
78
+ ipython_config.py
79
+
80
+ # pyenv
81
+ .python-version
82
+
83
+ # pipenv
84
+ Pipfile.lock
85
+
86
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
87
+ __pypackages__/
88
+
89
+ # Celery stuff
90
+ celerybeat-schedule
91
+ celerybeat.pid
92
+
93
+ # SageMath parsed files
94
+ *.sage.py
95
+
96
+ # Environments
97
+ .env
98
+ .venv
99
+ env/
100
+ venv/
101
+ ENV/
102
+ env.bak/
103
+ venv.bak/
104
+
105
+ # Spyder project settings
106
+ .spyderproject
107
+ .spyproject
108
+
109
+ # Rope project settings
110
+ .ropeproject
111
+
112
+ # mkdocs documentation
113
+ /site
114
+
115
+ # mypy
116
+ .mypy_cache/
117
+ .dmypy.json
118
+
119
+ # Pyre type checker
120
+ .pyre/
121
+
122
+ # pytype static type analyzer
123
+ .pytype/
124
+
125
+ # Cython debug symbols
126
+ cython_debug/
@@ -0,0 +1,61 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: debug-statements
9
+ - id: name-tests-test
10
+ args: ["--pytest-test-first"]
11
+ exclude: |
12
+ (?x)^(
13
+ tests/test_data/|
14
+ tests/unit/aggregation_functions/helpers.py
15
+ )
16
+ - repo: https://github.com/pycqa/autoflake
17
+ rev: v2.2.1
18
+ hooks:
19
+ - id: autoflake
20
+ args:
21
+ - "--in-place"
22
+ - "--remove-all-unused-imports"
23
+ - "--recursive"
24
+ fail_fast: true
25
+ - repo: https://github.com/pycqa/isort
26
+ rev: 5.12.0
27
+ hooks:
28
+ - id: isort
29
+ name: "sort imports"
30
+ args: ["--profile", "black"]
31
+ fail_fast: true
32
+ - repo: https://github.com/psf/black
33
+ rev: 24.10.0
34
+ hooks:
35
+ - id: black
36
+ language_version: python3.12
37
+ fail_fast: true
38
+ - repo: https://github.com/asottile/add-trailing-comma
39
+ rev: v3.1.0
40
+ hooks:
41
+ - id: add-trailing-comma
42
+ name: "add trailing commas"
43
+ fail_fast: true
44
+ - repo: local
45
+ hooks:
46
+ - id: pytest-check
47
+ name: "pytest unit tests and coverage"
48
+ entry: uv run pytest tests/ --cov=arthur_common --cov-fail-under=45
49
+ language: system
50
+ types: [python]
51
+ pass_filenames: false
52
+ always_run: false
53
+ files: ^src/arthur_common/
54
+ - id: mypy
55
+ name: "mypy type checking"
56
+ entry: uv run mypy src/arthur_common/ --ignore-missing-imports
57
+ language: system
58
+ types: [python]
59
+ pass_filenames: false
60
+ always_run: false
61
+ files: ^src/arthur_common/