Skip to content

Commit 1a4e997

Browse files
authored
Prepare release 1.1.0 (#32)
* Global update and refactoring * Temporarily remove support python 3.15 * Try to resolve Not supported URL scheme http+docker issue * Update docker lib version * Try to fix building docs * Update README * Add missing rpc methods * Account initialization with custom protocol * Fix account not found error
1 parent 6f6c776 commit 1a4e997

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1939
-1404
lines changed

.cruft.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.flake8

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
11+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1212

1313
steps:
1414
- uses: actions/checkout@v4
1515
- name: Install Poetry
1616
run: pipx install poetry
1717

1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
cache: "poetry"
@@ -31,6 +31,6 @@ jobs:
3131
poetry run pytest
3232
3333
- name: Upload coverage to Codecov
34-
uses: codecov/codecov-action@v1
34+
uses: codecov/codecov-action@v4
3535
with:
3636
file: ./coverage.xml

.isort.cfg

Lines changed: 0 additions & 5 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 26 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,27 @@
1-
# Read up on pre-commit
2-
# https://ljvmiranda921.github.io/notebook/2018/06/21/precommits-using-black-and-flake8/
3-
41
repos:
5-
6-
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v3.0.1
8-
hooks:
9-
- id: trailing-whitespace
10-
- id: end-of-file-fixer
11-
- id: check-docstring-first
12-
- id: check-executables-have-shebangs
13-
- id: check-json
14-
- id: check-yaml
15-
- id: check-toml
16-
- id: debug-statements
17-
- id: check-merge-conflict
18-
19-
- repo: https://github.com/ambv/black
20-
rev: 19.10b0
21-
hooks:
22-
- id: black
23-
language_version: python3
24-
25-
- repo: https://github.com/myint/docformatter
26-
rev: v1.3.1
27-
hooks:
28-
- id: docformatter
29-
args: [
30-
-i,
31-
--wrap-summaries=120,
32-
--wrap-descriptions=120,
33-
--pre-summary-newline,
34-
]
35-
36-
- repo: https://github.com/humitos/mirrors-autoflake
37-
rev: v1.1
38-
hooks:
39-
- id: autoflake
40-
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
41-
exclude: 'viz/__init__.py'
42-
43-
- repo: https://github.com/asottile/seed-isort-config
44-
rev: v2.1.1
45-
hooks:
46-
- id: seed-isort-config
47-
48-
- repo: https://github.com/timothycrosley/isort
49-
rev: 4.3.21
50-
hooks:
51-
- id: isort
52-
53-
- repo: https://gitlab.com/pycqa/flake8
54-
rev: 3.8.1
55-
hooks:
56-
- id: flake8
57-
additional_dependencies: [
58-
'pep8-naming',
59-
'flake8-comprehensions',
60-
'flake8-bugbear',
61-
'flake8-pytest-style',
62-
'flake8-variables-names',
63-
'flake8-class-attributes-order',
64-
'dlint',
65-
]
66-
67-
- repo: https://github.com/pre-commit/mirrors-mypy
68-
rev: v0.770
69-
hooks:
70-
- id: mypy
71-
args: [--ignore-missing-imports, --check-untyped-defs, --disallow-incomplete-defs]
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-merge-conflict
8+
- id: check-yaml
9+
- id: check-toml
10+
- id: check-json
11+
- id: debug-statements
12+
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.14.10
15+
hooks:
16+
- id: ruff
17+
args: ["--fix"]
18+
- id: ruff-format
19+
20+
- repo: https://github.com/pre-commit/mirrors-mypy
21+
rev: v1.19.1
22+
hooks:
23+
- id: mypy
24+
args:
25+
- --ignore-missing-imports
26+
- --check-untyped-defs
27+
- --disallow-incomplete-defs

.readthedocs.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.9"
7+
8+
sphinx:
9+
configuration: docs/conf.py
10+
11+
python:
12+
install:
13+
- requirements: docs/requirements.txt
14+
- method: pip
15+
path: .

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
We follow [Semantic Versions](https://semver.org/).
44

5+
## Version 1.1.0
6+
7+
- Refactoring and support for Python from 3.8 to 3.14
8+
- Update dependencies
9+
- Fix docs build
10+
511
## Version 1.0.2
612

713
- Add `delegate_vesting_shares` method

Pipfile

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 79 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,78 @@
33
![Tests Status](https://github.com/VIZ-Blockchain/viz-python-lib/actions/workflows/tests.yml/badge.svg)
44
[![Documentation Status](https://readthedocs.org/projects/viz-python-lib/badge/?version=latest)](https://viz-python-lib.readthedocs.io/en/latest/?badge=latest)
55

6-
**This library is in alpha state, API unstable**
6+
## Usage examples
77

8-
Built on top of [python-graphenelib](https://github.com/xeroc/python-graphenelib/)
8+
Read dynamic global properties:
99

10-
## Dependencies
10+
```python
11+
from viz import Client
12+
from pprint import pprint
1113

12-
#### Linux dependencies
14+
viz = Client(node="wss://node.viz.cx/ws")
15+
pprint(viz.info())
16+
```
1317

14-
```sh
15-
sudo apt-get install libffi-dev libssl-dev python-dev
18+
Award someone:
19+
20+
```python
21+
from viz import Client
22+
23+
node = "wss://node.viz.cx/ws"
24+
viz = Client(node=node, keys=["5...your_private_regular_key..."])
25+
initiator = "your_account"
26+
percent = 10.5
27+
viz.award("id", percent, "with love", None, initiator)
1628
```
1729

18-
#### Windows dependencies
30+
Award someone with fixed reward:
1931

20-
Install regular version of [OpenSSL](https://slproweb.com/products/Win32OpenSSL.html) (not Light) suitable for your core processor.
32+
```python
33+
from viz import Client
2134

22-
#### MacOS dependencies
35+
node = "wss://node.viz.cx/ws"
36+
viz = Client(node=node, keys=["5...your_private_regular_key..."])
37+
initiator = "your_account"
38+
reward_amount = 3.5 # "3.50 VIZ"
39+
max_energy = 30 # 30%
40+
viz.fixed_award("id", reward_amount, max_energy, "with fixed reward", None, initiator)
41+
```
2342

24-
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. This means that you will need to install and export some OpenSSL settings yourself, before you can install viz-python-lib:
43+
Send a custom operation:
2544

26-
```sh
27-
brew install openssl
45+
```python
46+
from viz import Client
47+
48+
node = "wss://node.viz.cx/ws"
49+
viz = Client(node=node, keys=["5...your_private_regular_key..."])
50+
account = "your_account"
51+
protocol = "color.place"
52+
json = {"x":35, "y":70, "color":"#e50000"}
53+
viz.custom(protocol, json, None, [account])
2854
```
2955

30-
and then use the following commands:
56+
Get account with custom protocol latest block:
3157

32-
```sh
33-
export CFLAGS="-I$(brew --prefix openssl)/include"
34-
export LDFLAGS="-L$(brew --prefix openssl)/lib"
58+
```python
59+
from viz import Client
60+
from viz.account import Account
61+
from viz.block import Block
62+
from viz.instance import set_shared_blockchain_instance
63+
64+
viz = Client('wss://node.viz.cx/ws')
65+
set_shared_blockchain_instance(viz)
66+
67+
protocol = "V"
68+
account = Account('id', viz, protocol)
69+
counter_inside_protocol = account["custom_sequence"]
70+
last_used_in_block = account["custom_sequence_block_num"]
71+
block = Block(last_used_in_block)
72+
```
73+
74+
Any direct RPC call:
75+
76+
```python
77+
viz.rpc.some_rpc_method()
3578
```
3679

3780
## Installation
@@ -51,22 +94,31 @@ cd viz-python-lib/
5194
poetry install
5295
```
5396

54-
## Usage
97+
## Development
5598

56-
Basic read query example:
99+
### Dependencies
57100

58-
```python
59-
from viz import Client
60-
from pprint import pprint
101+
#### Linux dependencies
61102

62-
node = 'wss://node.viz.cx/ws'
103+
```sh
104+
sudo apt-get install libffi-dev libssl-dev python-dev
105+
```
63106

64-
viz = Client(node=node)
65-
pprint(viz.info())
107+
#### Windows dependencies
108+
109+
Install regular version of [OpenSSL](https://slproweb.com/products/Win32OpenSSL.html) (not Light) suitable for your core processor.
110+
111+
#### MacOS dependencies
112+
113+
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. This means that you will need to install and export some OpenSSL settings yourself, before you can install viz-python-lib:
114+
115+
```sh
116+
brew install openssl
66117
```
67118

68-
Direct RPC calls:
119+
and then use the following commands:
69120

70-
```python
71-
viz.rpc.some_rpc_method()
121+
```sh
122+
export CFLAGS="-I$(brew --prefix openssl)/include"
123+
export LDFLAGS="-L$(brew --prefix openssl)/lib"
72124
```

docs/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# Configuration file for the Sphinx documentation builder.
43
#
@@ -58,7 +57,7 @@ def _get_project_meta():
5857
# Used to write beautiful docstrings:
5958
"sphinx.ext.napoleon",
6059
# Used to include .md files:
61-
"m2r",
60+
"m2r2",
6261
# Auto-generate API documentation
6362
"autoapi.extension",
6463
]

0 commit comments

Comments
 (0)