huitzo-sdk 0.0.0__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.
@@ -0,0 +1,329 @@
1
+ # =============================================================================
2
+ # SDK Publishing Workflow
3
+ # =============================================================================
4
+ # Implements:
5
+ # - docs/architecture/ci-cd.md#workflows
6
+ # - docs/architecture/ci-cd.md#self-hosted-runners
7
+ #
8
+ # Jobs:
9
+ # - detect-version: Determine version and targets from branch/tag
10
+ # - test: Cross-platform unit tests (3.11-3.14 all on self-hosted Linux)
11
+ # - build: Build distribution packages
12
+ # - publish-to-testpypi: Publish to TestPyPI for develop branches
13
+ # - publish-to-pypi: Publish to PyPI for main/tags
14
+ # - publish-release-notes: Create GitHub release for tags
15
+ #
16
+ # Self-Hosted Runners:
17
+ # - linux: All Python versions and builds
18
+ # =============================================================================
19
+
20
+ name: Publish Huitzo SDK 🐍 to PyPI and TestPyPI
21
+
22
+ on:
23
+ push:
24
+ branches:
25
+ - main
26
+ - 'develop/**'
27
+ tags:
28
+ - 'v*'
29
+
30
+ concurrency:
31
+ group: ${{ github.workflow }}-${{ github.ref }}
32
+ cancel-in-progress: true
33
+
34
+ jobs:
35
+ detect-version:
36
+ name: Detect Release Version
37
+ runs-on:
38
+ group: linux
39
+ labels: [self-hosted, Linux, X64]
40
+ outputs:
41
+ version: ${{ steps.version.outputs.version }}
42
+ is-release: ${{ steps.version.outputs.is-release }}
43
+ target: ${{ steps.version.outputs.target }}
44
+
45
+ steps:
46
+ - name: Pre-cleanup
47
+ run: |
48
+ docker image prune -f 2>/dev/null || true
49
+
50
+ - uses: actions/checkout@v6
51
+ with:
52
+ fetch-depth: 0
53
+
54
+ - name: Detect version strategy
55
+ id: version
56
+ run: |
57
+ if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
58
+ # Tag push: use tag as version
59
+ VERSION="${{ github.ref_name }}"
60
+ IS_RELEASE="true"
61
+ TARGET="pypi"
62
+ elif [[ "${{ github.ref }}" == refs/heads/main ]]; then
63
+ # Main branch: publish to PyPI with clean version
64
+ if git describe --tags --abbrev=0 2>/dev/null; then
65
+ VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
66
+ else
67
+ VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
68
+ fi
69
+ IS_RELEASE="false"
70
+ TARGET="pypi"
71
+ elif [[ "${{ github.ref }}" == refs/heads/develop/* ]]; then
72
+ # Develop branch: use dev version with timestamp only (PEP 440 compliant)
73
+ BASE_VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
74
+ VERSION="${BASE_VERSION}.dev$(date +%s)"
75
+ IS_RELEASE="false"
76
+ TARGET="testpypi"
77
+ else
78
+ VERSION="0.0.0.dev0"
79
+ IS_RELEASE="false"
80
+ TARGET="none"
81
+ fi
82
+
83
+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
84
+ echo "is-release=${IS_RELEASE}" >> $GITHUB_OUTPUT
85
+ echo "target=${TARGET}" >> $GITHUB_OUTPUT
86
+ echo "::notice title=Release Info::Version: ${VERSION} | Release: ${IS_RELEASE} | Target: ${TARGET}"
87
+
88
+ test:
89
+ name: Test Python ${{ matrix.python-version }}
90
+ strategy:
91
+ fail-fast: false
92
+ matrix:
93
+ python-version: ['3.11', '3.12', '3.13', '3.14']
94
+
95
+ runs-on:
96
+ group: linux
97
+ labels: [self-hosted, Linux, X64]
98
+
99
+ # Cache directories scoped by Python version to prevent conflicts
100
+ env:
101
+ UV_CACHE_DIR: /opt/runner-cache/uv/${{ matrix.python-version }}
102
+ PIP_CACHE_DIR: /opt/runner-cache/pip/${{ matrix.python-version }}
103
+
104
+ steps:
105
+ - name: Pre-cleanup
106
+ run: |
107
+ docker image prune -f 2>/dev/null || true
108
+ shell: bash
109
+
110
+ - uses: actions/checkout@v6
111
+ with:
112
+ persist-credentials: false
113
+
114
+ - name: Set up Python ${{ matrix.python-version }}
115
+ uses: actions/setup-python@v6
116
+ with:
117
+ python-version: ${{ matrix.python-version }}
118
+
119
+ - name: Install uv
120
+ uses: astral-sh/setup-uv@v7
121
+ with:
122
+ version: "latest"
123
+
124
+ - name: Install dependencies
125
+ run: uv sync --all-extras
126
+
127
+ - name: Lint with ruff
128
+ run: uv run ruff check .
129
+
130
+ - name: Type check with mypy
131
+ run: uv run mypy --strict src/ --ignore-missing-imports
132
+
133
+ - name: Run pytest
134
+ run: uv run pytest -v --tb=short --cov=huitzo_sdk --cov-report=xml
135
+
136
+ - name: Upload coverage
137
+ uses: codecov/codecov-action@v4
138
+ with:
139
+ files: ./coverage.xml
140
+ flags: unittests
141
+ name: Python ${{ matrix.python-version }}
142
+ fail_ci_if_error: false
143
+ env:
144
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
145
+
146
+ - name: Post-cleanup
147
+ if: always()
148
+ run: |
149
+ docker image prune -f 2>/dev/null || true
150
+
151
+ build:
152
+ name: Build distribution 📦
153
+ needs:
154
+ - test
155
+ - detect-version
156
+ runs-on:
157
+ group: linux
158
+ labels: [self-hosted, Linux, X64]
159
+
160
+ env:
161
+ UV_CACHE_DIR: /opt/runner-cache/uv/3.14
162
+ PIP_CACHE_DIR: /opt/runner-cache/pip/3.14
163
+
164
+ steps:
165
+ - name: Pre-cleanup
166
+ run: |
167
+ docker image prune -f 2>/dev/null || true
168
+
169
+ - uses: actions/checkout@v6
170
+ with:
171
+ persist-credentials: false
172
+
173
+ - name: Set up Python
174
+ uses: actions/setup-python@v6
175
+ with:
176
+ python-version: '3.14'
177
+
178
+ - name: Install uv
179
+ uses: astral-sh/setup-uv@v7
180
+ with:
181
+ version: "latest"
182
+
183
+ - name: Update version in pyproject.toml
184
+ run: |
185
+ # Replace version in pyproject.toml (if not a release tag)
186
+ if [[ "${{ needs.detect-version.outputs.is-release }}" != "true" ]]; then
187
+ sed -i 's/^version = ".*/version = "${{ needs.detect-version.outputs.version }}"/' pyproject.toml
188
+ fi
189
+
190
+ - name: Build distribution
191
+ run: uv build
192
+
193
+ - name: Store the distribution packages
194
+ uses: actions/upload-artifact@v5
195
+ with:
196
+ name: python-package-distributions
197
+ path: dist/
198
+
199
+ - name: Post-cleanup
200
+ if: always()
201
+ run: |
202
+ docker image prune -f 2>/dev/null || true
203
+
204
+ publish-to-testpypi:
205
+ name: Publish to TestPyPI 🧪
206
+ if: needs.detect-version.outputs.target == 'testpypi'
207
+ needs:
208
+ - build
209
+ - detect-version
210
+ runs-on:
211
+ group: linux
212
+ labels: [self-hosted, Linux, X64]
213
+
214
+ environment:
215
+ name: testpypi
216
+ url: https://test.pypi.org/p/huitzo-sdk
217
+
218
+ permissions:
219
+ id-token: write # For trusted publishing
220
+ contents: write # For commit comments
221
+
222
+ steps:
223
+ - name: Pre-cleanup
224
+ run: |
225
+ docker image prune -f 2>/dev/null || true
226
+
227
+ - name: Download all the dists
228
+ uses: actions/download-artifact@v6
229
+ with:
230
+ name: python-package-distributions
231
+ path: dist/
232
+
233
+ - name: Publish distribution to TestPyPI
234
+ uses: pypa/gh-action-pypi-publish@release/v1
235
+ with:
236
+ repository-url: https://test.pypi.org/legacy/
237
+
238
+ - name: Comment on commit
239
+ uses: actions/github-script@v7
240
+ with:
241
+ script: |
242
+ github.rest.repos.createCommitComment({
243
+ owner: context.repo.owner,
244
+ repo: context.repo.repo,
245
+ commit_sha: context.sha,
246
+ body: '✅ Published to TestPyPI v${{ needs.detect-version.outputs.version }}\n\n[View Package](https://test.pypi.org/project/huitzo-sdk/${{ needs.detect-version.outputs.version }})'
247
+ })
248
+
249
+ publish-to-pypi:
250
+ name: Publish to PyPI 🚀
251
+ if: needs.detect-version.outputs.target == 'pypi'
252
+ needs:
253
+ - build
254
+ - detect-version
255
+ runs-on:
256
+ group: linux
257
+ labels: [self-hosted, Linux, X64]
258
+
259
+ environment:
260
+ name: pypi
261
+ url: https://pypi.org/p/huitzo-sdk
262
+
263
+ permissions:
264
+ id-token: write # For trusted publishing
265
+ contents: write # For commit comments
266
+
267
+ steps:
268
+ - name: Pre-cleanup
269
+ run: |
270
+ docker image prune -f 2>/dev/null || true
271
+
272
+ - name: Download all the dists
273
+ uses: actions/download-artifact@v6
274
+ with:
275
+ name: python-package-distributions
276
+ path: dist/
277
+
278
+ - name: Publish distribution to PyPI
279
+ uses: pypa/gh-action-pypi-publish@release/v1
280
+
281
+ publish-release-notes:
282
+ name: Create GitHub Release
283
+ if: needs.detect-version.outputs.target == 'pypi' && needs.detect-version.outputs.is-release == 'true'
284
+ needs:
285
+ - publish-to-pypi
286
+ - detect-version
287
+ runs-on:
288
+ group: linux
289
+ labels: [self-hosted, Linux, X64]
290
+
291
+ permissions:
292
+ contents: write
293
+
294
+ steps:
295
+ - name: Pre-cleanup
296
+ run: |
297
+ docker image prune -f 2>/dev/null || true
298
+
299
+ - uses: actions/checkout@v6
300
+ with:
301
+ fetch-depth: 0
302
+
303
+ - name: Generate changelog
304
+ id: changelog
305
+ run: |
306
+ TAG="${{ github.ref_name }}"
307
+ PREV_TAG=$(git describe --tags --abbrev=0 ${TAG}^ 2>/dev/null || echo "")
308
+ if [ -z "$PREV_TAG" ]; then
309
+ CHANGELOG=$(git log --pretty=format:"- %s" | head -20)
310
+ else
311
+ CHANGELOG=$(git log ${PREV_TAG}..${TAG} --pretty=format:"- %s")
312
+ fi
313
+ echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
314
+ echo "$CHANGELOG" >> $GITHUB_OUTPUT
315
+ echo "EOF" >> $GITHUB_OUTPUT
316
+
317
+ - name: Create Release
318
+ uses: softprops/action-gh-release@v1
319
+ with:
320
+ body: |
321
+ ## Changes in ${{ needs.detect-version.outputs.version }}
322
+
323
+ ${{ steps.changelog.outputs.CHANGELOG }}
324
+
325
+ Published to [PyPI](https://pypi.org/project/huitzo-sdk/${{ needs.detect-version.outputs.version }})
326
+ draft: false
327
+ prerelease: false
328
+ env:
329
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,167 @@
1
+ # =============================================================================
2
+ # SDK CI Workflow
3
+ # =============================================================================
4
+ # Implements:
5
+ # - docs/architecture/ci-cd.md#workflows
6
+ # - docs/architecture/ci-cd.md#self-hosted-runners
7
+ #
8
+ # Jobs:
9
+ # - test: Cross-platform unit tests (3.11-3.14 all on self-hosted Linux)
10
+ # - lint: Lint and type checking
11
+ # - build: Build package
12
+ # - ci-success: Summary job
13
+ #
14
+ # Self-Hosted Runners:
15
+ # - linux: All Python versions and builds
16
+ # =============================================================================
17
+
18
+ name: SDK CI
19
+
20
+ on:
21
+ push:
22
+ branches: [main, develop]
23
+ pull_request:
24
+ branches: [main, develop]
25
+
26
+ permissions:
27
+ contents: read
28
+
29
+ concurrency:
30
+ group: ${{ github.workflow }}-${{ github.ref }}
31
+ cancel-in-progress: true
32
+
33
+ jobs:
34
+ test:
35
+ name: Test Python ${{ matrix.python-version }}
36
+ runs-on:
37
+ group: linux
38
+ labels: [self-hosted, Linux, X64]
39
+ strategy:
40
+ fail-fast: false
41
+ matrix:
42
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
43
+
44
+ # Cache directories scoped by Python version to prevent conflicts
45
+ env:
46
+ UV_CACHE_DIR: /opt/runner-cache/uv/${{ matrix.python-version }}
47
+ PIP_CACHE_DIR: /opt/runner-cache/pip/${{ matrix.python-version }}
48
+
49
+ steps:
50
+ - name: Pre-cleanup
51
+ run: |
52
+ docker image prune -f 2>/dev/null || true
53
+ - uses: actions/checkout@v6
54
+
55
+ - uses: astral-sh/setup-uv@v7
56
+ with:
57
+ python-version: ${{ matrix.python-version }}
58
+
59
+ - name: Install dependencies
60
+ run: uv sync --all-extras
61
+
62
+ - name: Run tests
63
+ run: uv run pytest tests/ -v --cov=src/huitzo_sdk --cov-report=xml
64
+
65
+ - name: Upload coverage
66
+ if: matrix.python-version == '3.14'
67
+ uses: actions/upload-artifact@v6
68
+ with:
69
+ name: coverage-report
70
+ path: coverage.xml
71
+ retention-days: 30
72
+ env:
73
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
74
+
75
+ - name: Post-cleanup
76
+ if: always()
77
+ run: |
78
+ docker image prune -f 2>/dev/null || true
79
+
80
+ lint:
81
+ name: Lint & Type Check
82
+ runs-on:
83
+ group: linux
84
+ labels: [self-hosted, Linux, X64]
85
+
86
+ env:
87
+ UV_CACHE_DIR: /opt/runner-cache/uv/3.14
88
+ PIP_CACHE_DIR: /opt/runner-cache/pip/3.14
89
+
90
+ steps:
91
+ - name: Pre-cleanup
92
+ run: |
93
+ docker image prune -f 2>/dev/null || true
94
+ - uses: actions/checkout@v6
95
+
96
+ - uses: astral-sh/setup-uv@v7
97
+ with:
98
+ python-version: "3.14"
99
+
100
+ - name: Install dependencies
101
+ run: uv sync --all-extras
102
+
103
+ - name: Ruff check
104
+ run: uv run ruff check .
105
+
106
+ - name: Ruff format check
107
+ run: uv run ruff format --check .
108
+
109
+ - name: Mypy strict
110
+ run: uv run mypy src/ --strict --ignore-missing-imports
111
+
112
+ - name: Post-cleanup
113
+ if: always()
114
+ run: |
115
+ docker image prune -f 2>/dev/null || true
116
+
117
+ build:
118
+ name: Build Package
119
+ runs-on:
120
+ group: linux
121
+ labels: [self-hosted, Linux, X64]
122
+ needs: [test, lint]
123
+
124
+ env:
125
+ UV_CACHE_DIR: /opt/runner-cache/uv/3.14
126
+ PIP_CACHE_DIR: /opt/runner-cache/pip/3.14
127
+
128
+ steps:
129
+ - name: Pre-cleanup
130
+ run: |
131
+ docker image prune -f 2>/dev/null || true
132
+ - uses: actions/checkout@v6
133
+
134
+ - uses: astral-sh/setup-uv@v7
135
+ with:
136
+ python-version: "3.14"
137
+
138
+ - name: Build
139
+ run: uv build
140
+
141
+ - name: Upload dist
142
+ uses: actions/upload-artifact@v6
143
+ with:
144
+ name: dist
145
+ path: dist/
146
+ retention-days: 30
147
+
148
+ - name: Post-cleanup
149
+ if: always()
150
+ run: |
151
+ docker image prune -f 2>/dev/null || true
152
+
153
+ ci-success:
154
+ name: CI Success
155
+ runs-on:
156
+ group: linux
157
+ labels: [self-hosted, Linux, X64]
158
+ needs: [test, lint, build]
159
+ if: always()
160
+ steps:
161
+ - name: Check results
162
+ run: |
163
+ if [[ "${{ needs.test.result }}" != "success" || "${{ needs.lint.result }}" != "success" || "${{ needs.build.result }}" != "success" ]]; then
164
+ echo "CI failed"
165
+ exit 1
166
+ fi
167
+ echo "All checks passed"
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .venv/
8
+ .mypy_cache/
9
+ .pytest_cache/
10
+ .ruff_cache/
11
+ *.lock
12
+ !uv.lock
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: huitzo-sdk
3
+ Version: 0.0.0
4
+ Summary: Huitzo SDK for building Intelligence Packs
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: pydantic>=2.12
7
+ Provides-Extra: dev
8
+ Requires-Dist: mypy>=1.19; extra == 'dev'
9
+ Requires-Dist: pytest-asyncio>=1.0; extra == 'dev'
10
+ Requires-Dist: pytest-cov>=7.0; extra == 'dev'
11
+ Requires-Dist: pytest>=9.0; extra == 'dev'
12
+ Requires-Dist: ruff>=0.14; extra == 'dev'