Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Python wrapper: use poetry #302

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 29 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine auditwheel
- name: Set up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.3"

- name: Fetch library artifacts
uses: actions/download-artifact@v4
Expand All @@ -269,7 +269,20 @@ jobs:
- name: Build wheel package
shell: sh
run: |
python setup.py bdist_wheel --python-tag=py3 --plat-name=${{ matrix.plat-name }}
poetry install --no-dev
poetry build

### Platform-specific wheel renaming:
wheel_file=$(find dist/ -type f -name '*.whl')
echo "Original wheel file: ${wheel_file}"

platform_name="${{ matrix.plat-name }}"
echo "Using platform name: ${platform_name}"

new_wheel_file=$(echo ${wheel_file} | sed "s/\(-any\)\?\.whl$/-${platform_name}.whl/")
echo "Renaming wheel file to: ${new_wheel_file}"

mv "${wheel_file}" "${new_wheel_file}"
working-directory: wrappers/python

- name: Run tests
Expand All @@ -278,14 +291,14 @@ jobs:
if: ${{ matrix.architecture != 'linux-aarch64' }}
shell: sh
run: |
pip install pytest pytest-asyncio dist/*
poetry install
echo "-- Test SQLite in-memory --"
python -m pytest --log-cli-level=WARNING -k "not contention"
poetry run pytest --log-cli-level=WARNING -k "not contention"
echo "-- Test SQLite file DB --"
TEST_STORE_URI=sqlite://test.db python -m pytest --log-cli-level=WARNING -k "not contention"
TEST_STORE_URI=sqlite://test.db poetry run pytest --log-cli-level=WARNING -k "not contention"
if [ -n "$POSTGRES_URL" ]; then
echo "-- Test Postgres DB --"
TEST_STORE_URI="$POSTGRES_URL" python -m pytest --log-cli-level=WARNING -k "not contention"
TEST_STORE_URI="$POSTGRES_URL" poetry run pytest --log-cli-level=WARNING -k "not contention"
fi
working-directory: wrappers/python
env:
Expand All @@ -296,28 +309,28 @@ jobs:
- if: ${{ runner.os == 'Linux' }}
name: Audit wheel
run: |
auditwheel show wrappers/python/dist/* | tee auditwheel.log
pip install auditwheel
auditwheel show wrappers/python/dist/*.whl | tee auditwheel.log
grep -q manylinux_2_17_ auditwheel.log

- if: |
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-python-wrapper == 'true')
name: Publish
name: Publish wheel
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload --skip-existing dist/*
twine upload --skip-existing dist/*.whl
working-directory: wrappers/python

build-javascript:
name: Build and test JavaScript wrapper
needs: [build-release]

strategy:
matrix:
architecture:
[linux-aarch64, linux-x86_64, darwin-universal]
architecture: [linux-aarch64, linux-x86_64, darwin-universal]
include:
- os: ubuntu-latest
architecture: linux-aarch64
Expand All @@ -327,7 +340,7 @@ jobs:
architecture: darwin-universal

runs-on: ${{ matrix.os }}

defaults:
run:
working-directory: wrappers/javascript
Expand Down
130 changes: 130 additions & 0 deletions wrappers/python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions wrappers/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[tool.poetry]
name = "aries_askar"
version = "0.3.2"
description = "Python wrapper for the Aries Askar cryptographic library"
authors = ["Hyperledger Aries Contributors <[email protected]>"]
readme = "README.md"
license = "Apache-2.0"
homepage = "https://github.com/hyperledger/aries-askar"
repository = "https://github.com/hyperledger/aries-askar"
keywords = ["cryptography", "aries", "verifiable credentials"]

[tool.poetry.dependencies]
python = "^3.8"
cached_property = "~1.5.2"

[tool.poetry.dev-dependencies]
pytest = "~8.3.2"
pytest-asyncio = "~0.23.7"

[build-system]
requires = ["poetry-core>=1.8.3"]
build-backend = "poetry.core.masonry.api"

[tool.setuptools.package-data]
aries_askar = ["aries_askar.dll", "libaries_askar.dylib", "libaries_askar.so"]

[tool.flake8]
max-line-length = 88
exclude = ["*/tests/**"]
extend-ignore = ["D202", "W503"]
per-file-ignores = { "*/__init__.py" = ["D104"] }

[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "strict"
2 changes: 0 additions & 2 deletions wrappers/python/requirements.dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/python/requirements.txt

This file was deleted.

13 changes: 0 additions & 13 deletions wrappers/python/setup.cfg

This file was deleted.

49 changes: 0 additions & 49 deletions wrappers/python/setup.py

This file was deleted.

Loading