| name | publish-package |
| description | Use this skill when the user wants to publish the `financial-stock-agent` package. |
Publish Python Package
Use this skill when the user wants to publish the financial-stock-agent package.
Usage
publish-package VERSION
Example:
publish-package 0.1.1
What this skill does
-
Reads the current version from:
pyproject.toml
finance_agent/__init__.py
-
Validates that:
- both versions are identical;
- the target version is a valid semantic version;
- the target version is greater than the current version.
-
Ensures the git working tree is clean.
-
Updates the version in both files:
pyproject.toml
finance_agent/__init__.py
-
Verifies that the environment variable UV_PUBLISH_TOKEN exists.
- If
UV_PUBLISH_TOKEN exists, continue.
- Otherwise, stop immediately and ask the user to provide a PyPI API token.
-
Builds the package:
uv build
-
Publishes the package to PyPI:
uv publish
The command relies on:
UV_PUBLISH_TOKEN
being available in the environment.
-
Commits the release:
git add pyproject.toml finance_agent/__init__.py
git commit -m "Publish vX.Y.Z"
-
Creates an annotated git tag:
git tag -a vX.Y.Z -m "Release vX.Y.Z"
-
Displays a release summary to the user.
Preconditions
-
Must be executed from the repository root.
-
The git working tree must be clean.
-
pyproject.toml and finance_agent/__init__.py must contain the same version.
-
The user must have permission to publish the package to PyPI.
-
The environment variable below must be configured:
UV_PUBLISH_TOKEN
Failure Conditions
The skill must stop immediately if:
- The target version is invalid.
- The target version is less than or equal to the current version.
- The versions in
pyproject.toml and finance_agent/__init__.py do not match.
- The git working tree is dirty.
UV_PUBLISH_TOKEN is not defined.
uv build fails.
uv publish fails.
git commit fails.
git tag fails.
Release Workflow
Verify git status
↓
Verify version consistency
↓
Validate target version
↓
Update pyproject.toml
↓
Update finance_agent/__init__.py
↓
Verify UV_PUBLISH_TOKEN
↓
uv build
↓
uv publish
↓
git commit
↓
git tag
↓
Display summary
Summary Output
After a successful release, display a summary similar to:
Release completed successfully.
Previous version : 0.1.0
Published version: 0.1.1
Updated files:
- pyproject.toml
- finance_agent/__init__.py
Package published to PyPI using UV_PUBLISH_TOKEN.
Git commit:
Publish v0.1.1
Git tag:
v0.1.1
Example Environment Setup
Before invoking this skill:
export UV_PUBLISH_TOKEN="pypi-xxxxxxxxxxxxxxxxxxxxxxxx"
Verify that it is configured:
echo "${UV_PUBLISH_TOKEN:+configured}"
Expected output:
configured