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
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ jobs:
python-version: "3.11"
enable-cache: true

- name: Update version in __init__.py
if: ${{ steps.release.outputs.release_created }}
run: |
uv run --python-dep tomli scripts/update_version.py

- name: Build and publish package
if: ${{ steps.release.outputs.release_created }}
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
uv build --no-sources
uv build
uv publish
1 change: 1 addition & 0 deletions py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["stackone_ai"]

[tool.hatch.build.targets.wheel.force-include]
"stackone_ai/py.typed" = "stackone_ai/py.typed"

[tool.hatch.build.targets.wheel.shared-data]
"py.typed" = "py.typed"

[project.optional-dependencies]
examples = [
"crewai>=0.102.0",
Expand Down
38 changes: 38 additions & 0 deletions scripts/update_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env python
"""
Script to ensure version consistency between pyproject.toml and __init__.py.
Run this script after release-please updates the version in pyproject.toml.

Dependencies:
- tomli
"""

import re
from pathlib import Path

import tomli


def main() -> None:
"""Update version in __init__.py to match pyproject.toml."""
# Read version from pyproject.toml
pyproject_path = Path("pyproject.toml")
init_path = Path("stackone_ai/__init__.py")

with open(pyproject_path, "rb") as f:
pyproject = tomli.load(f)
version = pyproject["project"]["version"]

# Update version in __init__.py
init_content = init_path.read_text()
new_init_content = re.sub(r'__version__ = "[^"]+"', f'__version__ = "{version}"', init_content)

if init_content != new_init_content:
init_path.write_text(new_init_content)
print(f"Updated version in {init_path} to {version}")
else:
print(f"Version in {init_path} already matches {version}")


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions stackone_ai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from .toolset import StackOneToolSet

__all__ = ["StackOneToolSet"]
__version__ = "0.0.2"
Empty file added stackone_ai/py.typed
Empty file.