Skip to content

Commit 54a33ef

Browse files
authored
Merge pull request #88 from icon-project/feature-uv
Migrate to uv
2 parents 9de7ac1 + 5f68661 commit 54a33ef

File tree

8 files changed

+1387
-156
lines changed

8 files changed

+1387
-156
lines changed

.github/workflows/iconsdk-publish-test-pypi.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.
Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: unittest and publish to pypi
22
on:
33
push:
4-
branches: [master]
4+
branches: ["master"]
55
pull_request:
6+
branches: ["master"]
67
release:
78
types: [published]
89

@@ -11,47 +12,39 @@ jobs:
1112
runs-on: ubuntu-latest
1213
strategy:
1314
matrix:
14-
python-version: ["3.9", "3.10", "3.11"]
15+
python-version:
16+
- "3.9"
17+
- "3.10"
18+
- "3.11"
1519
steps:
16-
- uses: actions/checkout@v3
17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v4
20+
- uses: actions/checkout@v4
21+
- name: Install uv and setup Python ${{ matrix.python-version }}
22+
uses: astral-sh/setup-uv@v6
1923
with:
2024
python-version: ${{ matrix.python-version }}
21-
cache: pip
22-
- name: Install dependency
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install -e .[tests]
2625
- name: Run Test
2726
run: |
28-
python -m pytest -ra
27+
uv run --frozen pytest
2928
3029
deploy:
3130
needs: unittest
32-
if: github.event_name == 'release'
31+
if: ${{ github.event_name == 'release' }}
3332
runs-on: ubuntu-latest
3433
environment: release
3534
permissions:
3635
id-token: write
3736
steps:
38-
- uses: actions/checkout@v3
39-
- name: Set up Python ${{ matrix.python-version }}
40-
uses: actions/setup-python@v4
37+
- uses: actions/checkout@v4
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v6
4140
with:
4241
python-version: "3.9"
43-
cache: pip
44-
- name: Install dependency
42+
- name: Install dependencies
4543
run: |
46-
python -m pip install --upgrade pip
47-
pip install wheel
48-
echo "::notice:: pip list"
49-
pip list
44+
uv sync --all-groups
5045
- name: Build package
51-
id: build_package
5246
run: |
53-
python setup.py sdist bdist_wheel
54-
echo "::notice:: ls -al dist"
55-
ls -al dist
47+
uv build
5648
- name: Publish package
57-
uses: pypa/gh-action-pypi-publish@release/v1
49+
run: |
50+
uv publish

iconsdk/wallet/wallet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def load(file_path: PathLikeObject, password: str) -> KeyWallet:
103103
:return: An instance of Wallet class.
104104
"""
105105
try:
106-
with open(file_path, 'rb') as file:
106+
with open(file_path, 'r') as file:
107107
private_key: bytes = extract_key_from_keyfile(file, bytes(password, 'utf-8'))
108108
private_key_object = PrivateKey(private_key)
109109
wallet = KeyWallet(private_key_object)
@@ -154,7 +154,7 @@ def to_dict(self, password: str) -> Dict[str, Any]:
154154

155155
@classmethod
156156
def from_dict(cls, jso: Dict[str, Any], password: str) -> KeyWallet:
157-
private_key: bytes = decode_keyfile_json(jso, password)
157+
private_key: bytes = decode_keyfile_json(jso, bytes(password, 'utf-8'))
158158
return KeyWallet.load(private_key)
159159

160160
def get_private_key(self, hexadecimal: bool = True) -> Union[str, bytes]:

pyproject.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "iconsdk"
7+
version = "2.6.0rc1"
8+
description = """
9+
ICON SDK for Python is a collection of libraries that allow you to
10+
interact with local or remote ICON nodes using HTTP connections.
11+
"""
12+
authors = [
13+
{ name = "ICON Foundation", email = "foo@icon.foundation" }
14+
]
15+
requires-python = ">=3.9"
16+
dependencies = [
17+
"aiohttp>=3.12.13",
18+
"coincurve>=21.0.0",
19+
"eth-keyfile>=0.9.1",
20+
"multimethod>=2.0",
21+
"requests>=2.32.4",
22+
"websocket-client>=1.8.0",
23+
]
24+
license = { text = "Apache License 2.0" }
25+
readme = "README.md"
26+
classifiers = [
27+
"Development Status :: 5 - Production/Stable",
28+
"Intended Audience :: Developers",
29+
"Intended Audience :: System Administrators",
30+
"Operating System :: OS Independent",
31+
"License :: OSI Approved :: Apache Software License",
32+
"Programming Language :: Python",
33+
"Programming Language :: Python :: 3.9",
34+
"Programming Language :: Python :: 3.10",
35+
"Programming Language :: Python :: 3.11",
36+
"Programming Language :: Python :: 3 :: Only",
37+
]
38+
39+
[project.urls]
40+
Repository = "https://github.com/icon-project/icon-sdk-python"
41+
Releases = "https://github.com/icon-project/icon-sdk-python/releases"
42+
43+
[dependency-groups]
44+
dev = [
45+
"pytest>=8.4.0",
46+
"requests-mock>=1.12.1",
47+
]
48+
49+
[tool.hatch.build.targets.wheel]
50+
packages = ["iconsdk"]

requirements.txt

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

setup.cfg

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

setup.py

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

0 commit comments

Comments
 (0)