polos-sdk 0.1.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.
- polos_sdk-0.1.0/.gitignore +211 -0
- polos_sdk-0.1.0/BUILD.md +305 -0
- polos_sdk-0.1.0/PKG-INFO +650 -0
- polos_sdk-0.1.0/README.md +599 -0
- polos_sdk-0.1.0/polos/__init__.py +105 -0
- polos_sdk-0.1.0/polos/agents/__init__.py +7 -0
- polos_sdk-0.1.0/polos/agents/agent.py +746 -0
- polos_sdk-0.1.0/polos/agents/conversation_history.py +121 -0
- polos_sdk-0.1.0/polos/agents/stop_conditions.py +280 -0
- polos_sdk-0.1.0/polos/agents/stream.py +635 -0
- polos_sdk-0.1.0/polos/core/__init__.py +0 -0
- polos_sdk-0.1.0/polos/core/context.py +143 -0
- polos_sdk-0.1.0/polos/core/state.py +26 -0
- polos_sdk-0.1.0/polos/core/step.py +1380 -0
- polos_sdk-0.1.0/polos/core/workflow.py +1192 -0
- polos_sdk-0.1.0/polos/features/__init__.py +0 -0
- polos_sdk-0.1.0/polos/features/events.py +456 -0
- polos_sdk-0.1.0/polos/features/schedules.py +110 -0
- polos_sdk-0.1.0/polos/features/tracing.py +605 -0
- polos_sdk-0.1.0/polos/features/wait.py +82 -0
- polos_sdk-0.1.0/polos/llm/__init__.py +9 -0
- polos_sdk-0.1.0/polos/llm/generate.py +152 -0
- polos_sdk-0.1.0/polos/llm/providers/__init__.py +5 -0
- polos_sdk-0.1.0/polos/llm/providers/anthropic.py +615 -0
- polos_sdk-0.1.0/polos/llm/providers/azure.py +42 -0
- polos_sdk-0.1.0/polos/llm/providers/base.py +196 -0
- polos_sdk-0.1.0/polos/llm/providers/fireworks.py +41 -0
- polos_sdk-0.1.0/polos/llm/providers/gemini.py +40 -0
- polos_sdk-0.1.0/polos/llm/providers/groq.py +40 -0
- polos_sdk-0.1.0/polos/llm/providers/openai.py +1021 -0
- polos_sdk-0.1.0/polos/llm/providers/together.py +40 -0
- polos_sdk-0.1.0/polos/llm/stream.py +183 -0
- polos_sdk-0.1.0/polos/middleware/__init__.py +0 -0
- polos_sdk-0.1.0/polos/middleware/guardrail.py +148 -0
- polos_sdk-0.1.0/polos/middleware/guardrail_executor.py +253 -0
- polos_sdk-0.1.0/polos/middleware/hook.py +164 -0
- polos_sdk-0.1.0/polos/middleware/hook_executor.py +104 -0
- polos_sdk-0.1.0/polos/runtime/__init__.py +0 -0
- polos_sdk-0.1.0/polos/runtime/batch.py +87 -0
- polos_sdk-0.1.0/polos/runtime/client.py +841 -0
- polos_sdk-0.1.0/polos/runtime/queue.py +42 -0
- polos_sdk-0.1.0/polos/runtime/worker.py +1365 -0
- polos_sdk-0.1.0/polos/runtime/worker_server.py +249 -0
- polos_sdk-0.1.0/polos/tools/__init__.py +0 -0
- polos_sdk-0.1.0/polos/tools/tool.py +587 -0
- polos_sdk-0.1.0/polos/types/__init__.py +23 -0
- polos_sdk-0.1.0/polos/types/types.py +116 -0
- polos_sdk-0.1.0/polos/utils/__init__.py +27 -0
- polos_sdk-0.1.0/polos/utils/agent.py +27 -0
- polos_sdk-0.1.0/polos/utils/client_context.py +41 -0
- polos_sdk-0.1.0/polos/utils/config.py +12 -0
- polos_sdk-0.1.0/polos/utils/output_schema.py +311 -0
- polos_sdk-0.1.0/polos/utils/retry.py +47 -0
- polos_sdk-0.1.0/polos/utils/serializer.py +167 -0
- polos_sdk-0.1.0/polos/utils/tracing.py +27 -0
- polos_sdk-0.1.0/polos/utils/worker_singleton.py +40 -0
- polos_sdk-0.1.0/pyproject.toml +138 -0
- polos_sdk-0.1.0/tests/__init__.py +1 -0
- polos_sdk-0.1.0/tests/conftest.py +77 -0
- polos_sdk-0.1.0/tests/integration/__init__.py +1 -0
- polos_sdk-0.1.0/tests/integration/test_agent_execution.py +477 -0
- polos_sdk-0.1.0/tests/integration/test_runtime_interactions.py +292 -0
- polos_sdk-0.1.0/tests/integration/test_tool_execution.py +209 -0
- polos_sdk-0.1.0/tests/integration/test_workflow_execution.py +352 -0
- polos_sdk-0.1.0/tests/unit/__init__.py +1 -0
- polos_sdk-0.1.0/tests/unit/test_agents/__init__.py +1 -0
- polos_sdk-0.1.0/tests/unit/test_agents/test_agent.py +602 -0
- polos_sdk-0.1.0/tests/unit/test_agents/test_conversation_history.py +331 -0
- polos_sdk-0.1.0/tests/unit/test_agents/test_stop_conditions.py +347 -0
- polos_sdk-0.1.0/tests/unit/test_agents/test_stream.py +87 -0
- polos_sdk-0.1.0/tests/unit/test_core/__init__.py +1 -0
- polos_sdk-0.1.0/tests/unit/test_core/test_context.py +256 -0
- polos_sdk-0.1.0/tests/unit/test_core/test_state.py +70 -0
- polos_sdk-0.1.0/tests/unit/test_core/test_step.py +275 -0
- polos_sdk-0.1.0/tests/unit/test_core/test_workflow.py +281 -0
- polos_sdk-0.1.0/tests/unit/test_llm/__init__.py +1 -0
- polos_sdk-0.1.0/tests/unit/test_llm/test_providers_base.py +213 -0
- polos_sdk-0.1.0/tests/unit/test_llm/test_utils.py +51 -0
- polos_sdk-0.1.0/tests/unit/test_middleware/__init__.py +1 -0
- polos_sdk-0.1.0/tests/unit/test_middleware/test_guardrail.py +218 -0
- polos_sdk-0.1.0/tests/unit/test_middleware/test_hook.py +201 -0
- polos_sdk-0.1.0/tests/unit/test_runtime/__init__.py +1 -0
- polos_sdk-0.1.0/tests/unit/test_runtime/test_client.py +723 -0
- polos_sdk-0.1.0/tests/unit/test_utils/__init__.py +1 -0
- polos_sdk-0.1.0/tests/unit/test_utils/test_config.py +53 -0
- polos_sdk-0.1.0/tests/unit/test_utils/test_output_schema.py +394 -0
- polos_sdk-0.1.0/tests/unit/test_utils/test_retry.py +145 -0
- polos_sdk-0.1.0/tests/unit/test_utils/test_serializer.py +315 -0
- polos_sdk-0.1.0/uv.lock +1218 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib64/
|
|
18
|
+
parts/
|
|
19
|
+
sdist/
|
|
20
|
+
var/
|
|
21
|
+
wheels/
|
|
22
|
+
share/python-wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
*.py.cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
.pytest_cache/
|
|
51
|
+
cover/
|
|
52
|
+
|
|
53
|
+
# Translations
|
|
54
|
+
*.mo
|
|
55
|
+
*.pot
|
|
56
|
+
|
|
57
|
+
# Django stuff:
|
|
58
|
+
*.log
|
|
59
|
+
local_settings.py
|
|
60
|
+
db.sqlite3
|
|
61
|
+
db.sqlite3-journal
|
|
62
|
+
|
|
63
|
+
# Flask stuff:
|
|
64
|
+
instance/
|
|
65
|
+
.webassets-cache
|
|
66
|
+
|
|
67
|
+
# Scrapy stuff:
|
|
68
|
+
.scrapy
|
|
69
|
+
|
|
70
|
+
# Sphinx documentation
|
|
71
|
+
docs/_build/
|
|
72
|
+
|
|
73
|
+
# PyBuilder
|
|
74
|
+
.pybuilder/
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
86
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
87
|
+
# .python-version
|
|
88
|
+
|
|
89
|
+
# pipenv
|
|
90
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
91
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
92
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
93
|
+
# install all needed dependencies.
|
|
94
|
+
#Pipfile.lock
|
|
95
|
+
|
|
96
|
+
# UV
|
|
97
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
98
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
99
|
+
# commonly ignored for libraries.
|
|
100
|
+
#uv.lock
|
|
101
|
+
|
|
102
|
+
# poetry
|
|
103
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
104
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
105
|
+
# commonly ignored for libraries.
|
|
106
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
107
|
+
#poetry.lock
|
|
108
|
+
#poetry.toml
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
113
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
114
|
+
#pdm.lock
|
|
115
|
+
#pdm.toml
|
|
116
|
+
.pdm-python
|
|
117
|
+
.pdm-build/
|
|
118
|
+
|
|
119
|
+
# pixi
|
|
120
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
121
|
+
#pixi.lock
|
|
122
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
123
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
124
|
+
.pixi
|
|
125
|
+
|
|
126
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
127
|
+
__pypackages__/
|
|
128
|
+
|
|
129
|
+
# Celery stuff
|
|
130
|
+
celerybeat-schedule
|
|
131
|
+
celerybeat.pid
|
|
132
|
+
|
|
133
|
+
# SageMath parsed files
|
|
134
|
+
*.sage.py
|
|
135
|
+
|
|
136
|
+
# Environments
|
|
137
|
+
.env
|
|
138
|
+
.envrc
|
|
139
|
+
.venv
|
|
140
|
+
env/
|
|
141
|
+
venv/
|
|
142
|
+
ENV/
|
|
143
|
+
env.bak/
|
|
144
|
+
venv.bak/
|
|
145
|
+
|
|
146
|
+
# Spyder project settings
|
|
147
|
+
.spyderproject
|
|
148
|
+
.spyproject
|
|
149
|
+
|
|
150
|
+
# Rope project settings
|
|
151
|
+
.ropeproject
|
|
152
|
+
|
|
153
|
+
# mkdocs documentation
|
|
154
|
+
/site
|
|
155
|
+
|
|
156
|
+
# mypy
|
|
157
|
+
.mypy_cache/
|
|
158
|
+
.dmypy.json
|
|
159
|
+
dmypy.json
|
|
160
|
+
|
|
161
|
+
# Pyre type checker
|
|
162
|
+
.pyre/
|
|
163
|
+
|
|
164
|
+
# pytype static type analyzer
|
|
165
|
+
.pytype/
|
|
166
|
+
|
|
167
|
+
# Cython debug symbols
|
|
168
|
+
cython_debug/
|
|
169
|
+
|
|
170
|
+
# PyCharm
|
|
171
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
172
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
173
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
174
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
175
|
+
#.idea/
|
|
176
|
+
|
|
177
|
+
# Abstra
|
|
178
|
+
# Abstra is an AI-powered process automation framework.
|
|
179
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
180
|
+
# Learn more at https://abstra.io/docs
|
|
181
|
+
.abstra/
|
|
182
|
+
|
|
183
|
+
# Visual Studio Code
|
|
184
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
185
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
186
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
187
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
188
|
+
# .vscode/
|
|
189
|
+
|
|
190
|
+
# Ruff stuff:
|
|
191
|
+
.ruff_cache/
|
|
192
|
+
|
|
193
|
+
# PyPI configuration file
|
|
194
|
+
.pypirc
|
|
195
|
+
|
|
196
|
+
# Cursor
|
|
197
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
198
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
199
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
200
|
+
.cursorignore
|
|
201
|
+
.cursorindexingignore
|
|
202
|
+
|
|
203
|
+
# Marimo
|
|
204
|
+
marimo/_static/
|
|
205
|
+
marimo/_lsp/
|
|
206
|
+
__marimo__/
|
|
207
|
+
|
|
208
|
+
# Ignore all node_modules folders everywhere
|
|
209
|
+
node_modules/
|
|
210
|
+
|
|
211
|
+
.DS_Store
|
polos_sdk-0.1.0/BUILD.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# Building and Releasing Polos Python SDK
|
|
2
|
+
|
|
3
|
+
This document describes how to build, test, and release the `polos-sdk` Python package.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Python 3.10+ installed
|
|
8
|
+
- [UV](https://github.com/astral-sh/uv) (recommended) or `pip` and `build`
|
|
9
|
+
- Git access to the repository
|
|
10
|
+
- PyPI account (for publishing releases)
|
|
11
|
+
|
|
12
|
+
## Local Development
|
|
13
|
+
|
|
14
|
+
### Setup
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cd sdk/python
|
|
18
|
+
|
|
19
|
+
# Using UV (recommended)
|
|
20
|
+
uv sync --dev
|
|
21
|
+
|
|
22
|
+
# Or using pip
|
|
23
|
+
python -m venv venv
|
|
24
|
+
source venv/bin/activate # Windows: venv\Scripts\activate
|
|
25
|
+
pip install -e ".[dev]"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Running Tests
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Using UV
|
|
32
|
+
uv run pytest
|
|
33
|
+
|
|
34
|
+
# Or using pip
|
|
35
|
+
pytest
|
|
36
|
+
|
|
37
|
+
# With coverage
|
|
38
|
+
uv run pytest --cov=polos --cov-report=html
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Code Quality
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Format code
|
|
45
|
+
uv run ruff format .
|
|
46
|
+
|
|
47
|
+
# Lint code
|
|
48
|
+
uv run ruff check .
|
|
49
|
+
|
|
50
|
+
# Auto-fix linting issues
|
|
51
|
+
uv run ruff check --fix .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Building the Package
|
|
55
|
+
|
|
56
|
+
### Build Locally
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
cd sdk/python
|
|
60
|
+
|
|
61
|
+
# Install build tools
|
|
62
|
+
pip install build hatchling hatch-vcs
|
|
63
|
+
|
|
64
|
+
# Build package (creates sdist and wheel in dist/)
|
|
65
|
+
python -m build
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This will create:
|
|
69
|
+
- `dist/polos-sdk-<version>.tar.gz` (source distribution)
|
|
70
|
+
- `dist/polos-sdk-<version>-py3-none-any.whl` (wheel distribution)
|
|
71
|
+
|
|
72
|
+
### Verify the Build
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Check package metadata
|
|
76
|
+
python -m pip install --upgrade pip
|
|
77
|
+
pip install twine
|
|
78
|
+
twine check dist/*
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Test Installation
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Install from local build
|
|
85
|
+
pip install dist/polos-sdk-*.whl
|
|
86
|
+
|
|
87
|
+
# Or install from source
|
|
88
|
+
pip install dist/polos-sdk-*.tar.gz
|
|
89
|
+
|
|
90
|
+
# Verify installation
|
|
91
|
+
python -c "import polos; print(polos.__version__)"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Version Management
|
|
95
|
+
|
|
96
|
+
The package uses [hatch-vcs](https://github.com/ofek/hatch-vcs) for automatic version management from Git tags.
|
|
97
|
+
|
|
98
|
+
- Version is automatically derived from Git tags matching `python-sdk-v*`
|
|
99
|
+
- Tag format: `python-sdk-v<version>` (e.g., `python-sdk-v0.1.0`)
|
|
100
|
+
- The version in `pyproject.toml` is set to `dynamic = ["version"]`
|
|
101
|
+
- During build, `hatch-vcs` extracts the version from the Git tag
|
|
102
|
+
|
|
103
|
+
### Manual Version Check
|
|
104
|
+
|
|
105
|
+
To see what version would be built from the current Git state:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
cd sdk/python
|
|
109
|
+
python -c "from hatchling.build import build_sdist; import os; os.chdir('.'); print(build_sdist('dist'))"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Or check the Git tags:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git tag -l "python-sdk-v*"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Releasing to PyPI
|
|
119
|
+
|
|
120
|
+
### Release Process
|
|
121
|
+
|
|
122
|
+
The release process is automated via GitHub Actions. To create a release:
|
|
123
|
+
|
|
124
|
+
#### 1. Ensure Code is Ready
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Make sure all changes are committed
|
|
128
|
+
git status
|
|
129
|
+
|
|
130
|
+
# Run tests locally
|
|
131
|
+
cd sdk/python
|
|
132
|
+
uv run pytest
|
|
133
|
+
|
|
134
|
+
# Check code quality
|
|
135
|
+
uv run ruff format .
|
|
136
|
+
uv run ruff check .
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### 2. Commit and Push Changes
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
git add .
|
|
143
|
+
git commit -m "Prepare for release v0.1.0"
|
|
144
|
+
git push origin main # or your branch name
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### 3. Create and Push Release Tag
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Create the tag (must match pattern: python-sdk-v*)
|
|
151
|
+
git tag python-sdk-v0.1.0
|
|
152
|
+
|
|
153
|
+
# Push the tag to trigger the release workflow
|
|
154
|
+
git push origin python-sdk-v0.1.0
|
|
155
|
+
|
|
156
|
+
# Or push all tags
|
|
157
|
+
git push origin --tags
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### 4. Monitor the Release
|
|
161
|
+
|
|
162
|
+
1. Go to your GitHub repository
|
|
163
|
+
2. Click the "Actions" tab
|
|
164
|
+
3. Find the "Release Python SDK" workflow run
|
|
165
|
+
4. The workflow will:
|
|
166
|
+
- ✅ Run tests on Python 3.10, 3.11, 3.12
|
|
167
|
+
- ✅ Build the package (sdist + wheel)
|
|
168
|
+
- ✅ Validate the package with `twine check`
|
|
169
|
+
- ✅ Create a GitHub Release with artifacts
|
|
170
|
+
- ✅ Publish to PyPI
|
|
171
|
+
|
|
172
|
+
#### 5. Verify the Release
|
|
173
|
+
|
|
174
|
+
After the workflow completes:
|
|
175
|
+
|
|
176
|
+
**GitHub Release:**
|
|
177
|
+
- Visit: `https://github.com/polos-dev/polos/releases`
|
|
178
|
+
- You should see the new release with download links
|
|
179
|
+
|
|
180
|
+
**PyPI:**
|
|
181
|
+
- Visit: `https://pypi.org/project/polos-sdk/`
|
|
182
|
+
- The new version should be listed
|
|
183
|
+
|
|
184
|
+
**Installation Test:**
|
|
185
|
+
```bash
|
|
186
|
+
pip install polos-sdk
|
|
187
|
+
python -c "import polos; print(polos.__version__)"
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Manual Release (Alternative)
|
|
191
|
+
|
|
192
|
+
If you need to release manually without GitHub Actions:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
cd sdk/python
|
|
196
|
+
|
|
197
|
+
# 1. Ensure you're on the correct tag
|
|
198
|
+
git checkout python-sdk-v0.1.0
|
|
199
|
+
|
|
200
|
+
# 2. Build the package
|
|
201
|
+
python -m build
|
|
202
|
+
|
|
203
|
+
# 3. Verify the build
|
|
204
|
+
twine check dist/*
|
|
205
|
+
|
|
206
|
+
# 4. Upload to PyPI
|
|
207
|
+
twine upload dist/* \
|
|
208
|
+
--username __token__ \
|
|
209
|
+
--password <your-pypi-api-token>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Release Notes
|
|
213
|
+
|
|
214
|
+
The GitHub Actions workflow automatically generates release notes from commits between tags:
|
|
215
|
+
|
|
216
|
+
- For the first release: All commits up to the tag
|
|
217
|
+
- For subsequent releases: Commits since the last `python-sdk-v*` tag
|
|
218
|
+
|
|
219
|
+
You can edit the release notes in the GitHub Release after it's created.
|
|
220
|
+
|
|
221
|
+
## Troubleshooting
|
|
222
|
+
|
|
223
|
+
### Build Fails: "No tags found"
|
|
224
|
+
|
|
225
|
+
**Problem**: `hatch-vcs` can't find a matching Git tag.
|
|
226
|
+
|
|
227
|
+
**Solution**:
|
|
228
|
+
- Ensure you're in a Git repository
|
|
229
|
+
- Check that tags exist: `git tag -l "python-sdk-v*"`
|
|
230
|
+
- Make sure you've fetched tags: `git fetch --tags`
|
|
231
|
+
- For local builds, you may need to be on a tagged commit
|
|
232
|
+
|
|
233
|
+
### Version Extraction Fails
|
|
234
|
+
|
|
235
|
+
**Problem**: Version can't be extracted from tag.
|
|
236
|
+
|
|
237
|
+
**Solution**:
|
|
238
|
+
- Ensure tag format is exactly `python-sdk-v<version>` (e.g., `python-sdk-v0.1.0`)
|
|
239
|
+
- Check `pyproject.toml` has `tag-pattern = "python-sdk-v(?P<version>.*)"` in `[tool.hatch.version]`
|
|
240
|
+
|
|
241
|
+
### PyPI Upload Fails: 401 Unauthorized
|
|
242
|
+
|
|
243
|
+
**Problem**: Authentication failed.
|
|
244
|
+
|
|
245
|
+
**Solution**:
|
|
246
|
+
- Verify `PYPI_API_TOKEN` is set in GitHub Secrets
|
|
247
|
+
- Check the token hasn't expired or been revoked
|
|
248
|
+
- Ensure the token has the correct scope (entire account or project-specific)
|
|
249
|
+
|
|
250
|
+
### Tests Fail in CI
|
|
251
|
+
|
|
252
|
+
**Problem**: Tests pass locally but fail in GitHub Actions.
|
|
253
|
+
|
|
254
|
+
**Solution**:
|
|
255
|
+
- Check the test output in the Actions tab
|
|
256
|
+
- Ensure all dependencies are listed in `pyproject.toml`
|
|
257
|
+
- Verify Python version compatibility
|
|
258
|
+
- Check for environment-specific issues
|
|
259
|
+
|
|
260
|
+
## Package Structure
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
sdk/python/
|
|
264
|
+
├── polos/ # Main package
|
|
265
|
+
│ ├── __init__.py # Package initialization (includes __version__)
|
|
266
|
+
│ ├── agents/ # Agent implementation
|
|
267
|
+
│ ├── core/ # Core workflow/step/context
|
|
268
|
+
│ ├── features/ # Events, schedules, tracing
|
|
269
|
+
│ ├── llm/ # LLM providers
|
|
270
|
+
│ ├── middleware/ # Hooks and guardrails
|
|
271
|
+
│ ├── runtime/ # Worker and client
|
|
272
|
+
│ ├── tools/ # Tool implementation
|
|
273
|
+
│ ├── types/ # Type definitions
|
|
274
|
+
│ └── utils/ # Utility functions
|
|
275
|
+
├── tests/ # Test suite
|
|
276
|
+
├── pyproject.toml # Package configuration
|
|
277
|
+
├── README.md # Package documentation
|
|
278
|
+
└── BUILD.md # This file
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Version Numbering
|
|
282
|
+
|
|
283
|
+
Follow [Semantic Versioning](https://semver.org/):
|
|
284
|
+
- **MAJOR**: Breaking changes
|
|
285
|
+
- **MINOR**: New features (backward compatible)
|
|
286
|
+
- **PATCH**: Bug fixes (backward compatible)
|
|
287
|
+
|
|
288
|
+
Examples:
|
|
289
|
+
- `python-sdk-v0.1.0` - Initial release
|
|
290
|
+
- `python-sdk-v0.1.1` - Patch release (bug fixes)
|
|
291
|
+
- `python-sdk-v0.2.0` - Minor release (new features)
|
|
292
|
+
- `python-sdk-v1.0.0` - Major release (breaking changes)
|
|
293
|
+
|
|
294
|
+
## Related Documentation
|
|
295
|
+
|
|
296
|
+
- [Package README](./README.md) - User-facing documentation
|
|
297
|
+
- [GitHub Actions Workflow](../.github/workflows/release-python-sdk.yml) - Automated release workflow
|
|
298
|
+
- [PyPI Project](https://pypi.org/project/polos-sdk/) - Published package page
|
|
299
|
+
|
|
300
|
+
## Support
|
|
301
|
+
|
|
302
|
+
For issues or questions:
|
|
303
|
+
- 📖 [Documentation](https://docs.polos.dev)
|
|
304
|
+
- 💬 [Discord Community](https://discord.gg/polos)
|
|
305
|
+
- 🐛 [Issue Tracker](https://github.com/polos-dev/polos/issues)
|