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

Use Hatch for Project Management #111

Merged
merged 29 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2a7526b
Setup hatch for project & dependencies management
MHHukiewitz Mar 13, 2024
2777788
Fix build targets
MHHukiewitz Mar 13, 2024
99a4aa7
Add Mike as author
MHHukiewitz Mar 13, 2024
2d6e249
Remove unneeded files
MHHukiewitz Mar 13, 2024
3d48307
Add missing configs from setup.py
MHHukiewitz Mar 13, 2024
428469d
Update README.md to reflect latest changes and use hatch in setup
MHHukiewitz Mar 13, 2024
c3df27c
Add Flake8-pyproject plugin to enable flake8 configuration through py…
MHHukiewitz Mar 13, 2024
e0bd8f6
Revert faulty formatting
MHHukiewitz Mar 13, 2024
543d2c7
Move mypy.ini to pyproject.toml and make it lean
MHHukiewitz Mar 13, 2024
7b60805
Remove need for mypy.ini in workflow
MHHukiewitz Mar 13, 2024
4d4da2b
Fix mypy config
MHHukiewitz Mar 13, 2024
1b9e86c
Adding py.typed marker and automatically install type stubs when runn…
MHHukiewitz Mar 14, 2024
0504a51
Use LICENCE.txt file in pyproject.toml
MHHukiewitz Mar 14, 2024
8948883
Add classifiers
MHHukiewitz Mar 14, 2024
890773c
Use VCS version (git tag)
MHHukiewitz Mar 14, 2024
8dece12
Add envs for testing and linting
MHHukiewitz Mar 14, 2024
fb22bfb
Merge optional encryption dependencies from #110
MHHukiewitz Mar 14, 2024
9058e49
Fix test and coverage; remove need for docker files in pytest workflow
MHHukiewitz Mar 14, 2024
51d82de
Fix workflows
MHHukiewitz Mar 14, 2024
d44b5cb
Further improve hatch scripts and workflows
MHHukiewitz Mar 14, 2024
3ff50b1
Fix python-version matrix
MHHukiewitz Mar 14, 2024
e18c6b7
Fix missing test dependencies
MHHukiewitz Mar 14, 2024
fc77e27
Fix missing test dependencies for Python 3.12 and further improve wor…
MHHukiewitz Mar 14, 2024
a90fd86
Remove Python 3.12 from supported versions
MHHukiewitz Mar 14, 2024
1ff3155
Update pyproject.toml
MHHukiewitz Mar 14, 2024
ec194dc
Update pyproject.toml
MHHukiewitz Mar 14, 2024
a803ba2
Unify script/env names to equal aleph-vm conventions
MHHukiewitz Mar 15, 2024
ada98af
Fix codecov action param
MHHukiewitz Mar 15, 2024
965de9f
Add coverage.py for the codecov action
MHHukiewitz Mar 15, 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
31 changes: 0 additions & 31 deletions .coveragerc

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Workaround github issue https:/actions/runner-images/issues/7192
if: startsWith(matrix.os, 'ubuntu-')
Expand All @@ -29,7 +29,7 @@ jobs:
python-version: 3.11

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-build-wheels-${{ hashFiles('setup.cfg', 'setup.py') }}
Expand Down
37 changes: 11 additions & 26 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,26 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Workaround github issue https:/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

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-code-quality-${{ hashFiles('setup.cfg', 'setup.py') }}
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 update
sudo apt-get -y upgrade
sudo apt-get install -y libsecp256k1-dev

- name: Install required Python packages
run: |
python3 -m pip install -e .[testing,ethereum]

- name: Test with Black
run: |
black --check ./src/ ./tests/ ./examples/

- name: Test with isort
run: |
isort --check-only ./src/ ./tests/ ./examples/
run: sudo apt-get install -y libsecp256k1-dev

- name: Test with MyPy
run: |
mypy --config-file ./mypy.ini ./src/ ./tests/ ./examples/

- name: Test with flake8
run: |
flake8 ./src/ ./tests/ ./examples/
- name: Run Hatch lint
run: hatch run lint:all
38 changes: 0 additions & 38 deletions .github/workflows/pytest-docker.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test/Coverage with Python

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: sudo apt-get install -y python3-pip libsecp256k1-dev
- run: python -m pip install --upgrade pip hatch
MHHukiewitz marked this conversation as resolved.
Show resolved Hide resolved
- run: hatch run test:run
if: matrix.python-version != '3.11'
- run: hatch run test:run-coverage-report
if: matrix.python-version == '3.11'
hoh marked this conversation as resolved.
Show resolved Hide resolved
- uses: codecov/[email protected]
if: matrix.python-version == '3.11'
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: aleph-im/aleph-vm
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Contributors
* Henry Taieb <[email protected]>
* Hugo Herter <[email protected]>
* Moshe Malawach <[email protected]>
* Mike Hukiewitz <[email protected]>
8 changes: 0 additions & 8 deletions CHANGELOG.rst

This file was deleted.

62 changes: 53 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ Python SDK for the Aleph.im network, next generation network of decentralized bi
Development follows the [Aleph Whitepaper](https:/aleph-im/aleph-whitepaper).

## Documentation
Documentation (albeit still vastly incomplete as it is a work in progress) can be found at [http://aleph-sdk-python.readthedocs.io/](http://aleph-sdk-python.readthedocs.io/) or built from this repo with:
The latest documentation, albeit incomplete, is available at [https://docs.aleph.im/libraries/python-sdk/](https://docs.aleph.im/libraries/python-sdk/).

```shell
$ python setup.py docs
```
For the full documentation, please refer to the docstrings in the source code.

## Requirements
### Linux
Expand All @@ -31,18 +29,64 @@ $ brew install libsecp256k1
Using pip and [PyPI](https://pypi.org/project/aleph-sdk-python/):

```shell
$ pip install aleph-sdk-python[ethereum,solana,tezos]
$ pip install aleph-sdk-python
```

### Additional dependencies
Some functionalities require additional dependencies. They can be installed like this:

```shell
$ pip install aleph-sdk-python[ethereum, dns]
```

The following extra dependencies are available:
- `ethereum` for Ethereum and Ethereum-compatible chains
- `solana` for Solana accounts and signatures
- `cosmos` for Substrate/Cosmos accounts and signatures
- `nuls2` for NULS2 accounts and signatures
- `polkadot` for Polkadot accounts and signatures
- `ledger` for Ledger hardware wallet support, see [Usage with LedgerHQ hardware](#usage-with-ledgerhq-hardware)
- `mqtt` for MQTT-related functionalities, see [examples/mqtt.py](examples/mqtt.py)
- `docs` for building the documentation, see [Documentation](#documentation)
- `dns` for DNS-related functionalities
- `all` installs all extra dependencies


## Installation for development
To install from source and still be able to modify the source code:
Setup a virtual environment using [hatch](https://hatch.pypa.io/):
```shell
$ hatch shell
```

Then install the SDK from source with all extra dependencies:

```shell
$ pip install -e .[testing]
$ pip install -e .[all]
```
or

### Running tests & Hatch scripts
You can use the test env defined for hatch to run the tests:

```shell
$ hatch run test:run
MHHukiewitz marked this conversation as resolved.
Show resolved Hide resolved
```

See `hatch env show` for more information about all the environments and their scripts.

### Generating the documentation [DEPRECATED]
The documentation is built using [Sphinx](https://www.sphinx-doc.org/).

To build the documentation, install the SDK with the `docs` extra dependencies:

```shell
$ pip install -e .[docs]
```

Then build the documentation:

```shell
$ python setup.py develop
$ cd docs
$ make html
```

## Usage with LedgerHQ hardware
Expand Down
39 changes: 0 additions & 39 deletions docker/python-3.10.dockerfile

This file was deleted.

39 changes: 0 additions & 39 deletions docker/python-3.11.dockerfile

This file was deleted.

39 changes: 0 additions & 39 deletions docker/python-3.9.dockerfile

This file was deleted.

Loading
Loading