Skip to content

Commit

Permalink
Fix: Project did not migrate to pyproject.toml
Browse files Browse the repository at this point in the history
The project still used `setup.py` and `setup.cfg`.

This branch:
1. Migrates to pyproject.toml and `hatch`.
2. Updates workflows accordingly.
3. Changes README from reStructuredText to the easier Markdown.
4. Updates dependencies.
  • Loading branch information
hoh committed Jun 10, 2024
1 parent 0352fbc commit cff2ab2
Show file tree
Hide file tree
Showing 9 changed files with 361 additions and 247 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test code quality

on:
push:
pull_request:
branches:
- main

jobs:
code-quality:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Workaround github issue https://github.com/actions/runner-images/issues/7192
run: sudo echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc

- name: Install pip and hatch
run: |
sudo apt-get install -y python3-pip
pip3 install hatch hatch-vcs
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-code-quality-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-code-quality-
- name: Install required system packages only for Ubuntu Linux
run: sudo apt-get install -y libsecp256k1-dev

- name: Run Hatch lint
run: hatch run linting:all
37 changes: 37 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Pytest and code Coverage

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run every night at 04:00 (GitHub Actions timezone)
# in order to catch when unfrozen dependency updates
# break the use of the library.
- cron: '4 0 * * *'

jobs:
build:
strategy:
matrix:
os: [ macos-11, macos-12, macos-13, macos-14, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 ]
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v4
- run: sudo apt-get install -y python3-pip libsecp256k1-dev
- run: python -m pip install --upgrade pip hatch coverage

# Only run coverage on one OS
- run: hatch run testing:test
if: matrix.python-version != '3.11'
- run: hatch run testing:cov
if: matrix.os == 'ubuntu-24.04'
- uses: codecov/[email protected]
if: matrix.os == 'ubuntu-24.04'
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: aleph-im/aleph-sdk-python
14 changes: 6 additions & 8 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ on:
- master

jobs:
build:
strategy:
build:
strategy:
matrix:
os: [macos-11, macos-12, ubuntu-20.04, ubuntu-22.04]
os: [macos-11, macos-12, macos-13, macos-14, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
runs-on: ${{matrix.os}}

steps:
Expand All @@ -35,22 +35,20 @@ jobs:
with:
python-version: 3.11


- name: Install required system packages only for Ubuntu Linux
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y libsecp256k1-dev
- name: Install required Python packages
run: |
python3 -m pip install --upgrade build
python3 -m pip install --user --upgrade twine
python3 -m pip install --upgrade hatch hatch-vcs
- name: Build source and wheel packages
run: |
python3 -m build
hatch build
- name: Install the Python wheel
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
Expand Down
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# aleph-client

Python Client for the [aleph.im network](https://www.aleph.im), next generation network of
decentralized big data applications. Developement follows the [Aleph
Whitepaper](https://github.com/aleph-im/aleph-whitepaper).

## Documentation

Documentation can be found on https://docs.aleph.im/tools/aleph-client/

## Requirements

### Linux

Some cryptographic functionalities use curve secp256k1 and require
installing [libsecp256k1](https://github.com/bitcoin-core/secp256k1).

> apt-get install -y python3-pip libsecp256k1-dev
### macOs

> brew tap cuber/homebrew-libsecp256k1
> brew install libsecp256k1
## Installation

Using pip and [PyPI](https://pypi.org/project/aleph-client/):

> pip install aleph-client
## Installation for development

If you want NULS2 support you will need to install nuls2-python
(currently only available on github):

> pip install git+https://github.com/aleph-im/nuls2-python.git
To install from source and still be able to modify the source code:

> pip install -e .
## Using Docker

Use the Aleph client and it\'s CLI from within Docker or Podman with:

> docker run --rm -ti -v $(pwd)/<data:/data> ghcr.io/aleph-im/aleph-client/aleph-client:master --help
Warning: This will use an ephemeral key pair that will be discarded when
stopping the container.
63 changes: 0 additions & 63 deletions README.rst

This file was deleted.

Loading

0 comments on commit cff2ab2

Please sign in to comment.