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

Work in progress: update pytezos #9

Merged
merged 4 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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:
- "*"

jobs:
tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v2
with:
python-version: 3.12

- name: Install needed debian packages
run: sudo apt install libsodium-dev libgmp-dev

- name: Install project
run: pip install -e .

- name: Install pytest and pytest-cov
run: pip install pytest pytest-cov

- name: Run tests
run: pytest
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ install_requires =
coincurve >= 20.0.0
typing_extensions
fastecdsa
pysodium

[options.packages.find]
where = src
Expand Down
34 changes: 5 additions & 29 deletions src/aleph_pytezos/__init__.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
"""
Welcome to PyTezos!
from importlib.metadata import version

To start playing with the Tezos blockchain you need to get a PyTezosClient instance.
Just type:
# Change here if project is renamed and does not equal the package name
dist_name = "aleph-pytezos"
__version__ = version(dist_name)

>>> from pytezos import pytezos
>>> pytezos

And follow the interactive documentation.
"""

import importlib.metadata

from pytezos.client import PyTezosClient
from pytezos.contract.interface import Contract
from pytezos.contract.interface import ContractInterface
from pytezos.crypto.key import Key
from pytezos.logging import logger
from pytezos.michelson.forge import forge_micheline
from pytezos.michelson.forge import unforge_micheline
from pytezos.michelson.format import micheline_to_michelson
from pytezos.michelson.micheline import MichelsonRuntimeError
from pytezos.michelson.parse import michelson_to_micheline
from pytezos.michelson.types.base import MichelsonType
from pytezos.michelson.types.base import Undefined
from pytezos.michelson.types.core import Unit

__version__ = importlib.metadata.version('pytezos')

pytezos = PyTezosClient()
__all__ = ["__version__"]
12 changes: 4 additions & 8 deletions src/aleph_pytezos/crypto/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@

from mnemonic import Mnemonic

from pytezos.crypto.encoding import base58_decode
from pytezos.crypto.encoding import base58_encode
from pytezos.crypto.encoding import scrub_input
from pytezos.jupyter import InlineDocstring
from pytezos.jupyter import get_class_docstring
from aleph_pytezos.crypto.encoding import base58_decode, scrub_input, base58_encode

VALID_MNEMONIC_LENGTHS = [12, 15, 18, 21, 24]
DEFAULT_LANGUAGE = 'english'
Expand Down Expand Up @@ -100,7 +96,7 @@ def validate_mnemonic(mnemonic: str, language: str = DEFAULT_LANGUAGE) -> None:
raise ValueError('Mnemonic checksum verification failed')


class Key(metaclass=InlineDocstring):
class Key:
"""Represents a public or secret key for Tezos. Ed25519, Secp256k1 and P256
are supported.
"""
Expand All @@ -122,8 +118,8 @@ def __repr__(self) -> str:
super().__repr__(),
'\nPublic key hash',
self.public_key_hash(),
'\nHelpers',
get_class_docstring(self.__class__),
'\nClass',
self.__class__,
]
return '\n'.join(res)

Expand Down
Loading