Skip to content

Commit c08dd61

Browse files
author
marcelkb
committed
Merge branch 'Reya-Labs-main'
2 parents f8962a5 + dc3aa08 commit c08dd61

120 files changed

Lines changed: 15105 additions & 3359 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: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
name: Version Check
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
version-consistency:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
submodules: true
18+
fetch-depth: 0
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.12'
24+
- name: Install dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y jq
28+
npm install -g @openapitools/openapi-generator-cli @asyncapi/cli @asyncapi/modelina-cli
29+
pip install tomli
30+
31+
- name: Check specs submodule points to a tag
32+
run: |
33+
cd specs
34+
# Get the current commit hash
35+
CURRENT_COMMIT=$(git rev-parse HEAD)
36+
echo "Current specs commit: $CURRENT_COMMIT"
37+
38+
# Check if this commit is tagged
39+
TAGS=$(git tag --points-at $CURRENT_COMMIT)
40+
if [ -z "$TAGS" ]; then
41+
echo "❌ ERROR: specs submodule is not pointing to a tagged commit"
42+
echo "Current commit $CURRENT_COMMIT has no tags"
43+
exit 1
44+
fi
45+
46+
# Get the first tag (in case there are multiple)
47+
SPECS_TAG=$(echo "$TAGS" | head -n1)
48+
echo "Specs is pointing to tag: $SPECS_TAG"
49+
echo "SPECS_TAG=$SPECS_TAG" >> $GITHUB_ENV
50+
51+
- name: Extract version components
52+
run: |
53+
# Extract SDK_VERSION from _version.py
54+
SDK_VERSION=$(python -c "
55+
import sys
56+
sys.path.insert(0, 'sdk')
57+
from _version import SDK_VERSION
58+
print(SDK_VERSION)
59+
")
60+
echo "SDK_VERSION: $SDK_VERSION"
61+
echo "SDK_VERSION=$SDK_VERSION" >> $GITHUB_ENV
62+
63+
# Extract version from pyproject.toml
64+
PYPROJECT_VERSION=$(python -c "
65+
import tomli
66+
with open('pyproject.toml', 'rb') as f:
67+
data = tomli.load(f)
68+
print(data['project']['version'])
69+
")
70+
echo "PYPROJECT_VERSION: $PYPROJECT_VERSION"
71+
echo "PYPROJECT_VERSION=$PYPROJECT_VERSION" >> $GITHUB_ENV
72+
73+
# Extract first 3 components from specs tag (remove 'v' prefix if present)
74+
SPECS_TAG_CLEAN=$(echo "$SPECS_TAG" | sed 's/^v//')
75+
SPECS_VERSION_PREFIX=$(echo "$SPECS_TAG_CLEAN" | cut -d. -f1-3)
76+
echo "SPECS_VERSION_PREFIX: $SPECS_VERSION_PREFIX"
77+
echo "SPECS_VERSION_PREFIX=$SPECS_VERSION_PREFIX" >> $GITHUB_ENV
78+
79+
# Extract first 3 components from SDK_VERSION
80+
SDK_VERSION_PREFIX=$(echo "$SDK_VERSION" | cut -d. -f1-3)
81+
echo "SDK_VERSION_PREFIX: $SDK_VERSION_PREFIX"
82+
echo "SDK_VERSION_PREFIX=$SDK_VERSION_PREFIX" >> $GITHUB_ENV
83+
84+
- name: Check version consistency
85+
run: |
86+
echo "Checking version consistency..."
87+
echo "Specs tag: $SPECS_TAG"
88+
echo "Specs version prefix: $SPECS_VERSION_PREFIX"
89+
echo "SDK version: $SDK_VERSION"
90+
echo "SDK version prefix: $SDK_VERSION_PREFIX"
91+
echo "Pyproject version: $PYPROJECT_VERSION"
92+
93+
# Check 1: SDK_VERSION and pyproject.toml versions must match exactly
94+
if [ "$SDK_VERSION" != "$PYPROJECT_VERSION" ]; then
95+
echo "❌ ERROR: SDK_VERSION ($SDK_VERSION) does not match pyproject.toml version ($PYPROJECT_VERSION)"
96+
exit 1
97+
fi
98+
echo "✅ SDK_VERSION and pyproject.toml versions match"
99+
100+
# Check 2: First 3 digits of SDK version must match specs tag
101+
if [ "$SDK_VERSION_PREFIX" != "$SPECS_VERSION_PREFIX" ]; then
102+
echo "❌ ERROR: First 3 digits of SDK_VERSION ($SDK_VERSION_PREFIX) do not match specs tag ($SPECS_VERSION_PREFIX)"
103+
echo "SDK version $SDK_VERSION should start with $SPECS_VERSION_PREFIX"
104+
exit 1
105+
fi
106+
echo "✅ SDK version prefix matches specs tag"
107+
108+
- name: Store initial git state
109+
run: |
110+
echo "Storing initial git state..."
111+
# Store the current state of tracked files
112+
git ls-files | sort > /tmp/files_before.txt
113+
git status --porcelain > /tmp/status_before.txt
114+
115+
# Create checksums for all tracked files (filter out directories)
116+
git ls-files -z | xargs -0 -I {} sh -c 'test -f "{}" && sha256sum "{}"' | sort > /tmp/checksums_before.txt
117+
118+
- name: Run API generation script
119+
run: |
120+
echo "Running API generation script..."
121+
chmod +x scripts/generate-api.sh
122+
scripts/generate-api.sh
123+
124+
- name: Run WS generation script
125+
run: |
126+
echo "Running WebSocket generation script..."
127+
chmod +x scripts/generate-ws.sh
128+
scripts/generate-ws.sh
129+
130+
- name: Check for changes after script execution
131+
run: |
132+
echo "Storing state after running scripts..."
133+
# Store the state after running scripts
134+
git ls-files | sort > /tmp/files_after.txt
135+
git status --porcelain > /tmp/status_after.txt
136+
git ls-files -z | xargs -0 -I {} sh -c 'test -f "{}" && sha256sum "{}"' | sort > /tmp/checksums_after.txt
137+
138+
echo "Checking for file changes..."
139+
140+
# Check if any tracked files were modified
141+
if ! cmp -s /tmp/status_before.txt /tmp/status_after.txt; then
142+
echo "❌ ERROR: Git status changed after running generation scripts"
143+
echo "Status before:"
144+
cat /tmp/status_before.txt
145+
echo "Status after:"
146+
cat /tmp/status_after.txt
147+
echo ""
148+
echo "Detailed changes:"
149+
git status
150+
git diff --name-only
151+
exit 1
152+
fi
153+
154+
# Check if file list changed (new files created)
155+
if ! cmp -s /tmp/files_before.txt /tmp/files_after.txt; then
156+
echo "❌ ERROR: File list changed after running generation scripts"
157+
echo "New or removed files detected:"
158+
diff /tmp/files_before.txt /tmp/files_after.txt || true
159+
exit 1
160+
fi
161+
162+
# Check if any file contents changed
163+
if ! cmp -s /tmp/checksums_before.txt /tmp/checksums_after.txt; then
164+
echo "❌ ERROR: File contents changed after running generation scripts"
165+
echo "Files with different checksums:"
166+
diff /tmp/checksums_before.txt /tmp/checksums_after.txt || true
167+
echo ""
168+
echo "Git diff:"
169+
git diff
170+
exit 1
171+
fi
172+
173+
# Check for any untracked files that might have been created
174+
UNTRACKED_FILES=$(git ls-files --others --exclude-standard)
175+
if [ -n "$UNTRACKED_FILES" ]; then
176+
echo "❌ ERROR: Generation scripts created new untracked files:"
177+
echo "$UNTRACKED_FILES"
178+
exit 1
179+
fi
180+
181+
echo "✅ No changes detected after running generation scripts"
182+
183+
- name: Summary
184+
run: |
185+
echo "🎉 All version consistency checks passed!"
186+
echo "✅ Specs submodule points to tag: $SPECS_TAG"
187+
echo "✅ SDK_VERSION and pyproject.toml versions match: $SDK_VERSION"
188+
echo "✅ First 3 digits match specs version: $SPECS_VERSION_PREFIX"
189+
echo "✅ Generation scripts produced no changes"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,3 +627,4 @@ testing.py
627627

628628
# End of https://www.gitignore.io/api/osx,python,pycharm,windows,visualstudio,visualstudiocode
629629
examples/config.json
630+
README_DEV.md

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "specs"]
2+
path = specs
3+
url = https://github.com/Reya-Labs/reya-api-specs.git

.openapi-generator/FILES

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
sdk/__init__.py
2+
sdk/open_api/__init__.py
3+
sdk/open_api/api/__init__.py
4+
sdk/open_api/api/market_data_api.py
5+
sdk/open_api/api/order_entry_api.py
6+
sdk/open_api/api/reference_data_api.py
7+
sdk/open_api/api/specs_api.py
8+
sdk/open_api/api/wallet_data_api.py
9+
sdk/open_api/api_client.py
10+
sdk/open_api/api_response.py
11+
sdk/open_api/configuration.py
12+
sdk/open_api/exceptions.py
13+
sdk/open_api/models/__init__.py
14+
sdk/open_api/models/account.py
15+
sdk/open_api/models/account_balance.py
16+
sdk/open_api/models/asset_definition.py
17+
sdk/open_api/models/cancel_order_request.py
18+
sdk/open_api/models/cancel_order_response.py
19+
sdk/open_api/models/candle_history_data.py
20+
sdk/open_api/models/create_order_request.py
21+
sdk/open_api/models/create_order_response.py
22+
sdk/open_api/models/execution_type.py
23+
sdk/open_api/models/fee_tier_parameters.py
24+
sdk/open_api/models/global_fee_parameters.py
25+
sdk/open_api/models/liquidity_parameters.py
26+
sdk/open_api/models/market_definition.py
27+
sdk/open_api/models/market_summary.py
28+
sdk/open_api/models/order.py
29+
sdk/open_api/models/order_status.py
30+
sdk/open_api/models/order_type.py
31+
sdk/open_api/models/pagination_parameters.py
32+
sdk/open_api/models/perp_execution.py
33+
sdk/open_api/models/perp_execution_list.py
34+
sdk/open_api/models/perp_execution_list_data_inner.py
35+
sdk/open_api/models/perp_execution_list_meta.py
36+
sdk/open_api/models/position.py
37+
sdk/open_api/models/price.py
38+
sdk/open_api/models/request_error.py
39+
sdk/open_api/models/request_error_code.py
40+
sdk/open_api/models/server_error.py
41+
sdk/open_api/models/server_error_code.py
42+
sdk/open_api/models/side.py
43+
sdk/open_api/models/spot_execution.py
44+
sdk/open_api/models/spot_execution_list.py
45+
sdk/open_api/models/spot_execution_list_data_inner.py
46+
sdk/open_api/models/time_in_force.py
47+
sdk/open_api/models/wallet_configuration.py
48+
sdk/open_api/rest.py

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.14.0

.pre-commit-config.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,46 @@ repos:
55
- id: check-toml
66
- id: check-yaml
77
- id: end-of-file-fixer
8-
exclude: LICENSE
8+
exclude: LICENSE|^sdk/async_api/|^sdk/open_api/
99
- repo: https://github.com/asottile/pyupgrade
1010
rev: v3.19.1
1111
hooks:
1212
- id: pyupgrade
1313
args: [--py39-plus]
14-
#exclude: hyperliquid/utils/types.py$
14+
exclude: ^sdk/async_api/|^sdk/open_api/
1515
- repo: https://github.com/PyCQA/isort
1616
rev: 6.0.0
1717
hooks:
1818
- id: isort
19+
exclude: ^sdk/async_api/|^sdk/open_api/
1920
- repo: https://github.com/psf/black-pre-commit-mirror
2021
rev: 25.1.0
2122
hooks:
2223
- id: black
24+
exclude: ^sdk/async_api/|^sdk/open_api/
2325
- repo: https://github.com/PyCQA/flake8
2426
rev: 7.1.1
2527
hooks:
2628
- id: flake8
2729
# ignoring formatting related lints, which are handled by black
2830
args: ['--ignore=E501,E203,W503']
31+
exclude: ^sdk/async_api/|^sdk/open_api/
2932
- repo: https://github.com/PyCQA/bandit
3033
rev: 1.8.2
3134
hooks:
3235
- id: bandit
36+
exclude: ^sdk/async_api/|^sdk/open_api/
37+
args: [--skip=B101]
3338
- repo: https://github.com/pylint-dev/pylint
3439
rev: v3.3.4
3540
hooks:
3641
- id: pylint
37-
exclude: examples/.*$
42+
exclude: ^sdk/async_api/|^sdk/open_api/
3843
- repo: https://github.com/python-poetry/poetry
3944
rev: 2.0.1
4045
hooks:
4146
- id: poetry-check
47+
exclude: ^sdk/open_api/
4248
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
4349
rev: 0.2.3
4450
hooks:
@@ -49,13 +55,15 @@ repos:
4955
rev: 0.31.1
5056
hooks:
5157
- id: check-github-workflows
58+
exclude: ^sdk/open_api/
5259
- repo: local
5360
hooks:
5461
- id: mypy
5562
name: mypy
56-
entry: poetry run mypy --config-file pyproject.toml ./
63+
entry: poetry run mypy --config-file pyproject.toml ./ --exclude sdk/async_api
5764
pass_filenames: false
5865
language: system
66+
exclude: ^sdk/open_api/
5967
- repo: meta
6068
hooks:
6169
- id: check-hooks-apply

0 commit comments

Comments
 (0)