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

Refactor: instance list to handle PAYG instance #215

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9f5b694
Refactor: instance list to handle PAYG instance
1yam Jun 19, 2024
d45691a
Fix: Only need to fetch node_list once
1yam Jun 19, 2024
d09c126
Refactor: use NodeInfo class from commands node
1yam Jun 28, 2024
7fa2df8
Cleanup: Code did not respect black, isort and ruff
hoh Jun 7, 2024
d101654
Fix: Bug: Coroutine was never awaited
hoh Jun 7, 2024
db75c2a
Fix: Invalid type annotations
hoh Jun 7, 2024
c916dcf
Fix: Missed `from __future__ import annotations`
hoh Jun 7, 2024
71e064e
Fix: Project did not migrate to `pyproject.toml`
hoh Jun 10, 2024
362bbc7
Fix: `black`, `isort` broken with switch to pyproject.toml
hoh Jun 10, 2024
fa8a301
Fix: Job names were ambiguous
hoh Jun 10, 2024
c7225d0
Fix: Ubuntu 24.04 prevents global pip installs
hoh Jun 10, 2024
0a9926e
Fix: One failed matrix dimension cancelled the job
hoh Jun 10, 2024
7a9ad65
Fix: workflows failed on macOS
hoh Jun 10, 2024
1ed60c5
Fix: Remove indirect dependencies of `aleph-sdk-python`.
hoh Jun 14, 2024
6945aff
Fix: pkg_resources is obsolete to get package version
hoh Jun 14, 2024
deaf249
Fix: README.md was obsolete
hoh Jun 19, 2024
2580207
Fix: Type error due to str instead of ItemHash
hoh Jun 19, 2024
93bb3ff
Fix: Unable to Create PAYG Instance from CLI (#216)
hoh Jun 26, 2024
96880c3
feat: add x.com to list of forbidden host
Psycojoker Jun 26, 2024
d7ccbeb
feat(models): type MachineInfo.from_unsanitized_input
Psycojoker Jun 26, 2024
f8a18fb
feat(network): more verbose message error for better debugging
Psycojoker Jun 26, 2024
8a97719
ci: remove macOS 11 support
Psycojoker Jun 26, 2024
f7e6553
refactor: remove unused variable
Psycojoker Jun 26, 2024
70958a0
fix(node): add missing return type annotation
Psycojoker Jun 26, 2024
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
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:
- master

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
51 changes: 51 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Pytest and code Coverage

on:
push:
branches:
- "*"
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:
pytest:
strategy:
fail-fast: false
matrix:
os: [ macos-12, macos-13, macos-14, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 ]
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v4

- name: Install required system packages for macOS
run: sudo apt-get install -y python3-pip libsecp256k1-dev
if: startsWith(matrix.os, 'ubuntu-')

- name: Install required system packages for macOS
if: startsWith(matrix.os, 'macos-')
run: |
brew update
brew tap cuber/homebrew-libsecp256k1
brew install libsecp256k1
brew install automake

- run: python3 -m venv /tmp/venv
- run: /tmp/venv/bin/python -m pip install --upgrade pip hatch coverage

# Only run coverage on one OS
- run: /tmp/venv/bin/hatch run testing:test
if: matrix.os != 'ubuntu-24.04'
- run: /tmp/venv/bin/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
19 changes: 10 additions & 9 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ on:
- master

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

steps:
Expand All @@ -35,23 +36,23 @@ 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 venv /tmp/venv
/tmp/venv/bin/python3 -m pip install --upgrade hatch hatch-vcs

- name: Build source and wheel packages
run: |
python3 -m build
/tmp/venv/bin/hatch build

- name: Install the Python wheel
run: |
python3 -m pip install dist/aleph_client-*.whl
python3 -m venv /tmp/install-venv
/tmp/install-venv/bin/python3 -m pip install dist/aleph_client-*.whl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- master

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

steps:
- uses: actions/checkout@v2
Expand Down
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# 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

### Windows

The software is not tested on Windows, but should work using
the Windows Subsystem for Linux (WSL).

## Installation

### From PyPI

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

> pip install aleph-client

### Using a container

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

## Installation for development

We recommend using [hatch](https://hatch.pypa.io/) for development.

Hatch is a modern, extensible Python project manager.
It creates a virtual environment for each project and manages dependencies.

> pip install hatch

### Running tests

> hatch test

or

> hatch run testing:cov

### Formatting code

> hatch run linting:format

### Checking types

> hatch run linting:typing

## Publish to PyPI

> hatch build
> hatch upload

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

> pip install aleph-sdk-python[nuls2]

To install from source and still be able to modify the source code:

> pip install -e .

63 changes: 0 additions & 63 deletions README.rst

This file was deleted.

4 changes: 1 addition & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
import shutil
import sys

__location__ = os.path.join(
os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe()))
)
__location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
Loading
Loading