Skip to content

Commit 3fd14d7

Browse files
authored
[V5] Refactor Shared Pass Through Router Extensions For Hatchling (#7524)
* refactor shared pass-through routers for hatchling and ruff + ty * add publish workflows
1 parent 4bcf844 commit 3fd14d7

87 files changed

Lines changed: 26718 additions & 16086 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: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: 📦 publish openbb-commodity
2+
3+
# Triggers exclusively on the merge of a ``release/openbb-commodity-v*``
4+
# branch into ``develop``. Four sequential jobs — version-check,
5+
# build, test, publish — with PyPI OIDC trusted publishing.
6+
7+
on:
8+
pull_request:
9+
types: [closed]
10+
branches: [develop, v5]
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
version-check:
18+
name: Verify version bump
19+
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/openbb-commodity-v')) || github.event_name == 'workflow_dispatch' }}
20+
runs-on: ubuntu-latest
21+
outputs:
22+
version: ${{ steps.parse.outputs.version }}
23+
defaults:
24+
run:
25+
shell: bash
26+
working-directory: openbb_platform/extensions/commodity
27+
steps:
28+
- uses: actions/checkout@v6
29+
with:
30+
ref: develop
31+
32+
- name: Parse [project].version from pyproject.toml
33+
id: parse
34+
run: |
35+
VERSION=$(grep -m1 -E '^version[[:space:]]*=' pyproject.toml | sed -E 's/^version[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/')
36+
if [ -z "$VERSION" ]; then
37+
echo "::error::Could not parse [project].version from pyproject.toml."
38+
exit 1
39+
fi
40+
echo "Local version: $VERSION"
41+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
42+
43+
- name: Fail if version already exists on PyPI
44+
env:
45+
VERSION: ${{ steps.parse.outputs.version }}
46+
run: |
47+
STATUS=$(curl -sS -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/openbb-commodity/${VERSION}/json")
48+
case "$STATUS" in
49+
200)
50+
echo "::error::openbb-commodity ${VERSION} is already published on PyPI."
51+
echo "Bump openbb_platform/extensions/commodity/pyproject.toml [project].version and re-merge a fresh release branch."
52+
exit 1
53+
;;
54+
404)
55+
echo "openbb-commodity ${VERSION} is not yet on PyPI — proceeding."
56+
;;
57+
*)
58+
echo "::error::Unexpected status $STATUS from PyPI JSON API. Aborting to avoid a silent skip."
59+
exit 1
60+
;;
61+
esac
62+
63+
- name: Verify release branch name matches pyproject version
64+
if: github.event_name == 'pull_request'
65+
env:
66+
VERSION: ${{ steps.parse.outputs.version }}
67+
BRANCH: ${{ github.event.pull_request.head.ref }}
68+
run: |
69+
EXPECTED="release/openbb-commodity-v${VERSION}"
70+
if [ "$BRANCH" != "$EXPECTED" ]; then
71+
echo "::error::Release branch '${BRANCH}' does not match pyproject version '${VERSION}'."
72+
echo "Expected branch name: '${EXPECTED}'."
73+
echo "Either rename the release branch or update [project].version in pyproject.toml so they agree."
74+
exit 1
75+
fi
76+
echo "Branch '${BRANCH}' matches pyproject version '${VERSION}'."
77+
78+
build:
79+
name: Build sdist + wheel
80+
needs: version-check
81+
runs-on: ubuntu-latest
82+
defaults:
83+
run:
84+
shell: bash
85+
working-directory: openbb_platform/extensions/commodity
86+
steps:
87+
- uses: actions/checkout@v6
88+
with:
89+
ref: develop
90+
91+
- uses: actions/setup-python@v6
92+
with:
93+
python-version: "3.11"
94+
95+
- run: python -m pip install --upgrade pip uv
96+
97+
- name: Build sdist + wheel
98+
run: uv build --no-sources
99+
100+
- uses: actions/upload-artifact@v4
101+
with:
102+
name: openbb-commodity-dist
103+
path: openbb_platform/extensions/commodity/dist/
104+
if-no-files-found: error
105+
retention-days: 7
106+
107+
publish:
108+
name: Publish to PyPI
109+
needs: build
110+
runs-on: ubuntu-latest
111+
permissions:
112+
id-token: write
113+
steps:
114+
- uses: actions/download-artifact@v4
115+
with:
116+
name: openbb-commodity-dist
117+
path: dist
118+
119+
- uses: pypa/gh-action-pypi-publish@release/v1
120+
with:
121+
packages-dir: dist
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: 📦 publish openbb-crypto
2+
3+
# Triggers exclusively on the merge of a ``release/openbb-crypto-v*``
4+
# branch into ``develop``. Four sequential jobs — version-check,
5+
# build, test, publish — with PyPI OIDC trusted publishing.
6+
7+
on:
8+
pull_request:
9+
types: [closed]
10+
branches: [develop, v5]
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
version-check:
18+
name: Verify version bump
19+
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/openbb-crypto-v')) || github.event_name == 'workflow_dispatch' }}
20+
runs-on: ubuntu-latest
21+
outputs:
22+
version: ${{ steps.parse.outputs.version }}
23+
defaults:
24+
run:
25+
shell: bash
26+
working-directory: openbb_platform/extensions/crypto
27+
steps:
28+
- uses: actions/checkout@v6
29+
with:
30+
ref: develop
31+
32+
- name: Parse [project].version from pyproject.toml
33+
id: parse
34+
run: |
35+
VERSION=$(grep -m1 -E '^version[[:space:]]*=' pyproject.toml | sed -E 's/^version[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/')
36+
if [ -z "$VERSION" ]; then
37+
echo "::error::Could not parse [project].version from pyproject.toml."
38+
exit 1
39+
fi
40+
echo "Local version: $VERSION"
41+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
42+
43+
- name: Fail if version already exists on PyPI
44+
env:
45+
VERSION: ${{ steps.parse.outputs.version }}
46+
run: |
47+
STATUS=$(curl -sS -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/openbb-crypto/${VERSION}/json")
48+
case "$STATUS" in
49+
200)
50+
echo "::error::openbb-crypto ${VERSION} is already published on PyPI."
51+
echo "Bump openbb_platform/extensions/crypto/pyproject.toml [project].version and re-merge a fresh release branch."
52+
exit 1
53+
;;
54+
404)
55+
echo "openbb-crypto ${VERSION} is not yet on PyPI — proceeding."
56+
;;
57+
*)
58+
echo "::error::Unexpected status $STATUS from PyPI JSON API. Aborting to avoid a silent skip."
59+
exit 1
60+
;;
61+
esac
62+
63+
- name: Verify release branch name matches pyproject version
64+
if: github.event_name == 'pull_request'
65+
env:
66+
VERSION: ${{ steps.parse.outputs.version }}
67+
BRANCH: ${{ github.event.pull_request.head.ref }}
68+
run: |
69+
EXPECTED="release/openbb-crypto-v${VERSION}"
70+
if [ "$BRANCH" != "$EXPECTED" ]; then
71+
echo "::error::Release branch '${BRANCH}' does not match pyproject version '${VERSION}'."
72+
echo "Expected branch name: '${EXPECTED}'."
73+
echo "Either rename the release branch or update [project].version in pyproject.toml so they agree."
74+
exit 1
75+
fi
76+
echo "Branch '${BRANCH}' matches pyproject version '${VERSION}'."
77+
78+
build:
79+
name: Build sdist + wheel
80+
needs: version-check
81+
runs-on: ubuntu-latest
82+
defaults:
83+
run:
84+
shell: bash
85+
working-directory: openbb_platform/extensions/crypto
86+
steps:
87+
- uses: actions/checkout@v6
88+
with:
89+
ref: develop
90+
91+
- uses: actions/setup-python@v6
92+
with:
93+
python-version: "3.11"
94+
95+
- run: python -m pip install --upgrade pip uv
96+
97+
- name: Build sdist + wheel
98+
run: uv build --no-sources
99+
100+
- uses: actions/upload-artifact@v4
101+
with:
102+
name: openbb-crypto-dist
103+
path: openbb_platform/extensions/crypto/dist/
104+
if-no-files-found: error
105+
retention-days: 7
106+
107+
publish:
108+
name: Publish to PyPI
109+
needs: build
110+
runs-on: ubuntu-latest
111+
permissions:
112+
id-token: write
113+
steps:
114+
- uses: actions/download-artifact@v4
115+
with:
116+
name: openbb-crypto-dist
117+
path: dist
118+
119+
- uses: pypa/gh-action-pypi-publish@release/v1
120+
with:
121+
packages-dir: dist
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: 📦 publish openbb-currency
2+
3+
# Triggers exclusively on the merge of a ``release/openbb-currency-v*``
4+
# branch into ``develop``. Four sequential jobs — version-check,
5+
# build, test, publish — with PyPI OIDC trusted publishing.
6+
7+
on:
8+
pull_request:
9+
types: [closed]
10+
branches: [develop, v5]
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
version-check:
18+
name: Verify version bump
19+
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/openbb-currency-v')) || github.event_name == 'workflow_dispatch' }}
20+
runs-on: ubuntu-latest
21+
outputs:
22+
version: ${{ steps.parse.outputs.version }}
23+
defaults:
24+
run:
25+
shell: bash
26+
working-directory: openbb_platform/extensions/currency
27+
steps:
28+
- uses: actions/checkout@v6
29+
with:
30+
ref: develop
31+
32+
- name: Parse [project].version from pyproject.toml
33+
id: parse
34+
run: |
35+
VERSION=$(grep -m1 -E '^version[[:space:]]*=' pyproject.toml | sed -E 's/^version[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/')
36+
if [ -z "$VERSION" ]; then
37+
echo "::error::Could not parse [project].version from pyproject.toml."
38+
exit 1
39+
fi
40+
echo "Local version: $VERSION"
41+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
42+
43+
- name: Fail if version already exists on PyPI
44+
env:
45+
VERSION: ${{ steps.parse.outputs.version }}
46+
run: |
47+
STATUS=$(curl -sS -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/openbb-currency/${VERSION}/json")
48+
case "$STATUS" in
49+
200)
50+
echo "::error::openbb-currency ${VERSION} is already published on PyPI."
51+
echo "Bump openbb_platform/extensions/currency/pyproject.toml [project].version and re-merge a fresh release branch."
52+
exit 1
53+
;;
54+
404)
55+
echo "openbb-currency ${VERSION} is not yet on PyPI — proceeding."
56+
;;
57+
*)
58+
echo "::error::Unexpected status $STATUS from PyPI JSON API. Aborting to avoid a silent skip."
59+
exit 1
60+
;;
61+
esac
62+
63+
- name: Verify release branch name matches pyproject version
64+
if: github.event_name == 'pull_request'
65+
env:
66+
VERSION: ${{ steps.parse.outputs.version }}
67+
BRANCH: ${{ github.event.pull_request.head.ref }}
68+
run: |
69+
EXPECTED="release/openbb-currency-v${VERSION}"
70+
if [ "$BRANCH" != "$EXPECTED" ]; then
71+
echo "::error::Release branch '${BRANCH}' does not match pyproject version '${VERSION}'."
72+
echo "Expected branch name: '${EXPECTED}'."
73+
echo "Either rename the release branch or update [project].version in pyproject.toml so they agree."
74+
exit 1
75+
fi
76+
echo "Branch '${BRANCH}' matches pyproject version '${VERSION}'."
77+
78+
build:
79+
name: Build sdist + wheel
80+
needs: version-check
81+
runs-on: ubuntu-latest
82+
defaults:
83+
run:
84+
shell: bash
85+
working-directory: openbb_platform/extensions/currency
86+
steps:
87+
- uses: actions/checkout@v6
88+
with:
89+
ref: develop
90+
91+
- uses: actions/setup-python@v6
92+
with:
93+
python-version: "3.11"
94+
95+
- run: python -m pip install --upgrade pip uv
96+
97+
- name: Build sdist + wheel
98+
run: uv build --no-sources
99+
100+
- uses: actions/upload-artifact@v4
101+
with:
102+
name: openbb-currency-dist
103+
path: openbb_platform/extensions/currency/dist/
104+
if-no-files-found: error
105+
retention-days: 7
106+
107+
publish:
108+
name: Publish to PyPI
109+
needs: build
110+
runs-on: ubuntu-latest
111+
permissions:
112+
id-token: write
113+
steps:
114+
- uses: actions/download-artifact@v4
115+
with:
116+
name: openbb-currency-dist
117+
path: dist
118+
119+
- uses: pypa/gh-action-pypi-publish@release/v1
120+
with:
121+
packages-dir: dist

0 commit comments

Comments
 (0)