Skip to content

Commit 73b0e2e

Browse files
srirclaude
authored andcommitted
Rename package from orb to orb_sdk
- Rename src/orb to src/orb_sdk - Update pyproject.toml with new package name - Update all internal imports - Add sync-upstream.yml workflow for automated updates - Add apply-customizations.sh script - Use Python 3.13 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 48e6486 commit 73b0e2e

563 files changed

Lines changed: 1345 additions & 158 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Sync Upstream
2+
3+
on:
4+
schedule:
5+
- cron: '0 9 * * *' # Daily at 9am UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
check-and-sync:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
token: ${{ secrets.GITHUB_TOKEN }}
16+
17+
- name: Configure git
18+
run: |
19+
git config user.name "github-actions[bot]"
20+
git config user.email "github-actions[bot]@users.noreply.github.com"
21+
22+
- name: Check for new upstream release
23+
id: check
24+
run: |
25+
LATEST=$(curl -s https://api.github.com/repos/orbcorp/orb-python/releases/latest | jq -r .tag_name)
26+
CURRENT=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
27+
28+
echo "Latest upstream: $LATEST"
29+
echo "Current: $CURRENT"
30+
31+
if [ "$LATEST" != "$CURRENT" ]; then
32+
echo "new_release=true" >> $GITHUB_OUTPUT
33+
echo "version=$LATEST" >> $GITHUB_OUTPUT
34+
else
35+
echo "new_release=false" >> $GITHUB_OUTPUT
36+
fi
37+
38+
- name: Sync upstream changes
39+
if: steps.check.outputs.new_release == 'true'
40+
run: |
41+
git remote add upstream https://github.com/orbcorp/orb-python.git || true
42+
git fetch upstream --tags
43+
44+
# Create branch for the sync
45+
git checkout -b sync-upstream-${{ steps.check.outputs.version }}
46+
47+
# Merge upstream tag
48+
git merge ${{ steps.check.outputs.version }} -m "Merge upstream ${{ steps.check.outputs.version }}" || true
49+
50+
- name: Re-apply customizations
51+
if: steps.check.outputs.new_release == 'true'
52+
run: |
53+
chmod +x ./scripts/apply-customizations.sh
54+
./scripts/apply-customizations.sh
55+
56+
- name: Set up Python
57+
if: steps.check.outputs.new_release == 'true'
58+
uses: actions/setup-python@v5
59+
with:
60+
python-version: '3.13'
61+
62+
- name: Install and test
63+
if: steps.check.outputs.new_release == 'true'
64+
run: |
65+
pip install uv
66+
uv pip install -e ".[dev]" --system
67+
pytest tests/ -x -q
68+
69+
- name: Commit customizations
70+
if: steps.check.outputs.new_release == 'true'
71+
run: |
72+
git add -A
73+
git commit -m "Apply orb_sdk customizations" || true
74+
75+
- name: Push and create PR
76+
if: steps.check.outputs.new_release == 'true'
77+
run: |
78+
git push -u origin sync-upstream-${{ steps.check.outputs.version }}
79+
gh pr create \
80+
--title "Sync upstream ${{ steps.check.outputs.version }}" \
81+
--body "Automated sync from orbcorp/orb-python ${{ steps.check.outputs.version }}" \
82+
--base main
83+
env:
84+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
86+
- name: Enable auto-merge
87+
if: steps.check.outputs.new_release == 'true'
88+
run: |
89+
gh pr merge --auto --squash
90+
env:
91+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.9.18
1+
3.13.1

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "orb-billing"
2+
name = "orb_sdk"
33
version = "4.55.0"
44
description = "The official Python library for the orb API"
55
dynamic = ["readme"]
@@ -80,14 +80,14 @@ format = { chain = [
8080
"check:ruff" = "ruff check ."
8181
"fix:ruff" = "ruff check --fix ."
8282

83-
"check:importable" = "python -c 'import orb'"
83+
"check:importable" = "python -c 'import orb_sdk'"
8484

8585
typecheck = { chain = [
8686
"typecheck:pyright",
8787
"typecheck:mypy"
8888
]}
8989
"typecheck:pyright" = "pyright"
90-
"typecheck:verify-types" = "pyright --verifytypes orb --ignoreexternal"
90+
"typecheck:verify-types" = "pyright --verifytypes orb_sdk --ignoreexternal"
9191
"typecheck:mypy" = "mypy ."
9292

9393
[build-system]
@@ -100,7 +100,7 @@ include = [
100100
]
101101

102102
[tool.hatch.build.targets.wheel]
103-
packages = ["src/orb"]
103+
packages = ["src/orb_sdk"]
104104

105105
[tool.hatch.build.targets.sdist]
106106
# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc)
@@ -168,7 +168,7 @@ show_error_codes = true
168168
#
169169
# We also exclude our `tests` as mypy doesn't always infer
170170
# types correctly and Pyright will still catch any type errors.
171-
exclude = ['src/orb/_files.py', '_dev/.*.py', 'tests/.*']
171+
exclude = ['src/orb_sdk/_files.py', '_dev/.*.py', 'tests/.*']
172172

173173
strict_equality = true
174174
implicit_reexport = true
@@ -260,7 +260,7 @@ length-sort = true
260260
length-sort-straight = true
261261
combine-as-imports = true
262262
extra-standard-library = ["typing_extensions"]
263-
known-first-party = ["orb", "tests"]
263+
known-first-party = ["orb_sdk", "tests"]
264264

265265
[tool.ruff.lint.per-file-ignores]
266266
"bin/**.py" = ["T201", "T203"]

scripts/apply-customizations.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Applying orb_sdk customizations..."
5+
6+
# Rename module directory if upstream merge restored 'orb'
7+
if [ -d "src/orb" ]; then
8+
echo "Renaming src/orb -> src/orb_sdk"
9+
rm -rf src/orb_sdk 2>/dev/null || true
10+
mv src/orb src/orb_sdk
11+
fi
12+
13+
# Update all internal imports in src/
14+
echo "Updating imports in src/"
15+
find src -name "*.py" -exec sed -i 's/from orb\([^_]\)/from orb_sdk\1/g' {} +
16+
find src -name "*.py" -exec sed -i 's/from orb$/from orb_sdk/g' {} +
17+
find src -name "*.py" -exec sed -i 's/import orb\([^_]\)/import orb_sdk\1/g' {} +
18+
find src -name "*.py" -exec sed -i 's/import orb$/import orb_sdk/g' {} +
19+
20+
# Update imports in tests/
21+
echo "Updating imports in tests/"
22+
find tests -name "*.py" -exec sed -i 's/from orb\([^_]\)/from orb_sdk\1/g' {} +
23+
find tests -name "*.py" -exec sed -i 's/from orb$/from orb_sdk/g' {} +
24+
find tests -name "*.py" -exec sed -i 's/import orb\([^_]\)/import orb_sdk\1/g' {} +
25+
find tests -name "*.py" -exec sed -i 's/import orb$/import orb_sdk/g' {} +
26+
27+
# Update pyproject.toml
28+
echo "Updating pyproject.toml"
29+
sed -i 's/name = "orb-billing"/name = "orb_sdk"/' pyproject.toml
30+
sed -i 's/packages = \["src\/orb"\]/packages = ["src\/orb_sdk"]/' pyproject.toml
31+
sed -i "s/\"check:importable\" = \"python -c 'import orb'\"/\"check:importable\" = \"python -c 'import orb_sdk'\"/" pyproject.toml
32+
sed -i 's/--verifytypes orb /--verifytypes orb_sdk /' pyproject.toml
33+
sed -i "s/exclude = \['src\/orb\/_files.py'/exclude = ['src\/orb_sdk\/_files.py'/" pyproject.toml
34+
sed -i 's/known-first-party = \["orb", "tests"\]/known-first-party = ["orb_sdk", "tests"]/' pyproject.toml
35+
36+
echo "Customizations applied successfully"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@
105105
# Update the __module__ attribute for exported symbols so that
106106
# error messages point to this module instead of the module
107107
# it was originally defined in, e.g.
108-
# orb._exceptions.NotFoundError -> orb.NotFoundError
108+
# orb_sdk._exceptions.NotFoundError -> orb_sdk.NotFoundError
109109
__locals = locals()
110110
for __name in __all__:
111111
if not __name.startswith("__"):
112112
try:
113-
__locals[__name].__module__ = "orb"
113+
__locals[__name].__module__ = "orb_sdk"
114114
except (TypeError, AttributeError):
115115
# Some of our exported symbols are builtins which we can't set attributes for.
116116
pass

0 commit comments

Comments
 (0)