Skip to content

Commit c4c5d1f

Browse files
arre-ankitsaqibameen
authored andcommitted
📦 NEW: Python Release System
1 parent 58397ed commit c4c5d1f

File tree

6 files changed

+206
-2
lines changed

6 files changed

+206
-2
lines changed

.releaserc.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
"releaseRules": [
8+
{"type": "📦 NEW", "release": "major"},
9+
{"type": "👌 IMPROVE", "release": "patch"},
10+
{"type": "🐛 FIX", "release": "patch"},
11+
{"type": "🚀 RELEASE", "release": "patch"},
12+
{"type": "📖 DOC", "release": false},
13+
{"type": "🤖 TEST", "release": false},
14+
{"type": "‼️ BREAKING", "release": "major"}
15+
],
16+
"parserOpts": {
17+
"pattern": "^(📦 NEW|👌 IMPROVE|🐛 FIX|🚀 RELEASE|📖 DOC|🤖 TEST|‼️ BREAKING): (.*)$",
18+
"groupCorrespondence": ["type", "subject"]
19+
}
20+
}
21+
],
22+
[
23+
"@semantic-release/release-notes-generator",
24+
{
25+
"parserOpts": {
26+
"pattern": "^(📦 NEW|👌 IMPROVE|🐛 FIX|🚀 RELEASE|📖 DOC|🤖 TEST|‼️ BREAKING): (.*)$",
27+
"groupCorrespondence": ["type", "subject"]
28+
},
29+
"writerOpts": {
30+
"transform": {
31+
"hash": false,
32+
"committerDate": false,
33+
"authorDate": false,
34+
"authorName": false,
35+
"authorEmail": false,
36+
"committerName": false,
37+
"committerEmail": false
38+
},
39+
"groupBy": "type",
40+
"commitGroupsSort": ["📦 NEW", "👌 IMPROVE", "🐛 FIX", "‼️ BREAKING", "📖 DOC", "🤖 TEST"],
41+
"commitsSort": ["subject"],
42+
"noteGroupsSort": "title"
43+
}
44+
}
45+
],
46+
[
47+
"@semantic-release/changelog",
48+
{
49+
"changelogFile": "CHANGELOG.md"
50+
}
51+
],
52+
[
53+
"@semantic-release/git",
54+
{
55+
"assets": [
56+
"CHANGELOG.md",
57+
"pyproject.toml",
58+
"langbase/__init__.py"
59+
],
60+
"message": "🚀 RELEASE: ${nextRelease.version}\n\n${nextRelease.notes}"
61+
}
62+
]
63+
]
64+
}

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Initial Python SDK for Langbase API
12+
- Support for Pipes, Memories, Threads, Tools, and Workflows
13+
- Comprehensive type definitions and error handling
14+
- Streaming support for real-time responses
15+
- Memory and RAG functionality
16+
- Agent and workflow orchestration
17+
18+
## [0.1.0] - 2024-01-01
19+
20+
### Added
21+
- Initial release of the Langbase Python SDK

langbase/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
from .workflow import TimeoutError, Workflow
6565

6666
__version__ = "0.1.0"
67+
__author__ = "LangbaseInc"
68+
__description__ = "Python SDK for the Langbase API"
69+
6770
__all__ = [
6871
# Errors
6972
"APIConnectionError",

pyproject.toml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "langbase"
33
version = "0.1.0"
44
description = "Python SDK for the Langbase API"
55
readme = "README.md"
6-
license = {text = "MIT"}
6+
license = {text = "Apache-2.0"}
77
authors = [
88
{ name = "Saqib", email = "[email protected]" },
99
{ name = "Ankit", email = "[email protected]" },
@@ -13,20 +13,29 @@ keywords = ["ai", "langbase", "agent", "memory", "rag", "mcp", "pipes", "workflo
1313
classifiers = [
1414
"Development Status :: 4 - Beta",
1515
"Intended Audience :: Developers",
16-
"License :: OSI Approved :: MIT License",
16+
"License :: OSI Approved :: Apache Software License",
17+
"Operating System :: OS Independent",
18+
"Programming Language :: Python :: 3",
1719
"Programming Language :: Python :: 3.7",
1820
"Programming Language :: Python :: 3.8",
1921
"Programming Language :: Python :: 3.9",
2022
"Programming Language :: Python :: 3.10",
2123
"Programming Language :: Python :: 3.11",
2224
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3 :: Only",
26+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
2327
"Topic :: Software Development :: Libraries :: Python Modules",
2428
]
2529
dependencies = [
2630
"requests>=2.25.0",
2731
"typing-extensions>=4.0.0",
2832
]
2933

34+
[project.optional-dependencies]
35+
release = [
36+
"python-semantic-release>=8.0.0",
37+
]
38+
3039
[project.urls]
3140
Documentation = "https://docs.langbase.com"
3241
Homepage = "https://langbase.com"
@@ -102,3 +111,19 @@ precision = 2
102111

103112
[tool.coverage.html]
104113
directory = "htmlcov"
114+
115+
[tool.semantic_release]
116+
version_toml = ["pyproject.toml:project.version"]
117+
version_variables = [
118+
"langbase/__init__.py:__version__",
119+
]
120+
branch = "main"
121+
upload_to_PyPI = false
122+
upload_to_release = false
123+
build_command = "pip install build && python -m build"
124+
125+
[tool.semantic_release.commit_parser_options]
126+
allowed_tags = ["📦 NEW", "👌 IMPROVE", "🐛 FIX", "🚀 RELEASE", "📖 DOC", "🤖 TEST", "‼️ BREAKING"]
127+
minor_tags = ["📦 NEW"]
128+
patch_tags = ["👌 IMPROVE", "🐛 FIX", "🚀 RELEASE"]
129+
major_tags = ["‼️ BREAKING"]

release.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Simple release script for Langbase Python SDK.
4+
Usage: python release.py
5+
"""
6+
7+
import os
8+
import subprocess
9+
import sys
10+
11+
# Fix Windows encoding issues with emojis
12+
os.environ["PYTHONUTF8"] = "1"
13+
os.environ["PYTHONIOENCODING"] = "utf-8"
14+
15+
16+
def run_command(cmd, description):
17+
"""Run a command and handle errors."""
18+
print(f"🔄 {description}...")
19+
print(f" Running: {cmd}")
20+
try:
21+
result = subprocess.run(
22+
cmd,
23+
shell=True,
24+
check=True,
25+
capture_output=True,
26+
text=True,
27+
encoding="utf-8",
28+
errors="replace",
29+
)
30+
# Show both stdout and stderr
31+
if result.stdout.strip():
32+
print("📤 Output:")
33+
print(result.stdout)
34+
if result.stderr.strip():
35+
print("⚠️ Warnings:")
36+
print(result.stderr)
37+
if not result.stdout.strip() and not result.stderr.strip():
38+
print("✅ Command completed (no output)")
39+
return True
40+
except subprocess.CalledProcessError as e:
41+
print(f"❌ Error: {e}")
42+
print(f"❌ Command that failed: {cmd}")
43+
if e.stdout:
44+
print(f"📤 Output: {e.stdout}")
45+
if e.stderr:
46+
print(f"📤 Error details: {e.stderr}")
47+
return False
48+
49+
50+
def main():
51+
"""Run the complete release process."""
52+
print("🚀 Starting Langbase SDK release process...\n")
53+
54+
# Step 1: Confirm release
55+
try:
56+
confirm = input("\n❓ Proceed with release? (y/N): ").lower().strip()
57+
if confirm != "y" and confirm != "yes":
58+
print("❌ Release cancelled")
59+
return
60+
except KeyboardInterrupt:
61+
print("\n❌ Release cancelled")
62+
return
63+
64+
# Step 2: Create version
65+
print("\n📦 Creating new version...")
66+
if not run_command("semantic-release version", "Creating version"):
67+
print("❌ Failed to create version")
68+
sys.exit(1)
69+
70+
# Step 3: Configure git to push tags automatically (one-time setup)
71+
run_command(
72+
"git config push.followTags true", "Configuring git to push tags automatically"
73+
)
74+
75+
# Step 4: Push everything to origin
76+
print("\n⬆️ Pushing to origin...")
77+
if not run_command("git push origin main", "Pushing commits and tags"):
78+
print("❌ Failed to push to origin")
79+
sys.exit(1)
80+
81+
print("\n✅ Release completed successfully!")
82+
print("🎯 Next steps (optional):")
83+
print(" • python -m build # Build packages")
84+
print(" • twine upload dist/* # Upload to PyPI")
85+
86+
87+
if __name__ == "__main__":
88+
main()

requirements-dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ twine>=4.0.0
2121
# Development utilities
2222
ipdb>=0.13.0
2323
python-dotenv>=0.19.0
24+
25+
# release
26+
python-semantic-release>=8.0.0

0 commit comments

Comments
 (0)