Skip to content

Commit 8e63ca8

Browse files
authored
Merge pull request #20 from OpShin/feat/plutus-v3
Feat/plutus v3
2 parents 477a1c8 + 1c12b48 commit 8e63ca8

30 files changed

+3184
-2451
lines changed

.github/workflows/python-app.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Tests and QA
55

66
on:
77
push:
8-
branches: "*"
8+
branches: "**"
99
pull_request:
10-
branches: "*"
10+
branches: "**"
1111

1212
permissions:
1313
contents: read
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-24.04
1818
strategy:
1919
matrix:
20-
python-version: [ '3.10', '3.11' ]
20+
python-version: ['3.11', '3.12', '3.13', '3.14']
2121

2222
steps:
2323
- name: Checkout code
@@ -28,27 +28,30 @@ jobs:
2828
with:
2929
python-version: ${{ matrix.python-version }}
3030

31-
- name: Install Poetry
32-
uses: snok/install-poetry@v1
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v6
3333

3434
- name: Install dependencies
35-
run: poetry install --no-interaction --with dev
35+
run: |
36+
uv sync --dev
37+
uv run python -c "from importlib.metadata import version; print(version('cbor2'))" > .cbor2_version
38+
CBOR2_VERSION=$(cat .cbor2_version)
39+
CBOR2_BUILD_C_EXTENSION=0 uv pip install --no-binary cbor2 "cbor2==$CBOR2_VERSION" --force-reinstall
3640
3741
- name: Run linters
3842
run: |
39-
poetry run black --check .
43+
uv run black --check .
4044
4145
- name: Build contracts
4246
run: |
4347
bash tests/build_contracts.sh
4448
4549
- name: Test with pytest
4650
run: |
47-
poetry run coverage run -m pytest
48-
# add further tests with `poetry run coverage run -a ...`
51+
uv run coverage run -m pytest
4952
5053
- name: Upload coverage data to coveralls.io
51-
run: poetry run coveralls
54+
run: uv run coveralls
5255
env:
5356
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5457
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.cbor
22
.vscode
33
.idea
4+
SESSIONS.db*
45
# Created by https://www.toptal.com/developers/gitignore/api/latex
56
# Edit at https://www.toptal.com/developers/gitignore?templates=latex
67

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ git clone https://github.com/OpShin/plutus-bench.git
2626
cd plutus-bench
2727
# install the package
2828
pip install .
29+
bash ensure_pure_cbor2.sh
2930
# run the mock server
3031
uvicorn plutus_bench.mockfrost.server:app
3132
```

ensure_pure_cbor2.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
# Script to ensure cbor2 is installed with pure Python implementation
3+
4+
set -x
5+
6+
# Check if poetry is available, otherwise use python directly
7+
if command -v poetry &> /dev/null; then
8+
PYTHON="poetry run python"
9+
else
10+
PYTHON="python"
11+
fi
12+
13+
echo "Checking cbor2 version..."
14+
$PYTHON -c "from importlib.metadata import version; print(version('cbor2'))" > .cbor2_version
15+
CBOR2_VERSION=$(cat .cbor2_version)
16+
echo "Found cbor2 version: $CBOR2_VERSION"
17+
18+
echo "Checking cbor2 implementation..."
19+
$PYTHON -c "
20+
import cbor2, inspect, sys
21+
decoder_path = inspect.getfile(cbor2.CBORDecoder)
22+
using_c_ext = decoder_path.endswith('.so')
23+
print(f'Implementation path: {decoder_path}')
24+
print(f'Using C extension: {using_c_ext}')
25+
sys.exit(1 if using_c_ext else 0)
26+
"
27+
28+
if [ $? -ne 0 ]; then
29+
echo "Reinstalling cbor2 with pure Python implementation..."
30+
$PYTHON -m pip uninstall -y cbor2 || uv pip uninstall -y cbor2
31+
CBOR2_BUILD_C_EXTENSION=0 $PYTHON -m pip install --no-binary cbor2 "cbor2==$CBOR2_VERSION" --force-reinstall || CBOR2_BUILD_C_EXTENSION=0 uv pip install --no-binary cbor2 "cbor2==$CBOR2_VERSION" --force-reinstall
32+
echo "Successfully reinstalled cbor2 with pure Python implementation"
33+
else
34+
echo "Already using pure Python implementation of cbor2"
35+
fi
36+
37+
# Clean up
38+
rm -f .cbor2_version

0 commit comments

Comments
 (0)