Skip to content

Commit

Permalink
Merge branch 'release/v1.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
onetechnical committed May 2, 2022
2 parents e6f5aa9 + 13bf253 commit 896d2aa
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 31 deletions.
22 changes: 17 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,41 @@ workflows:
version: 2
test:
jobs:
- unit-test
- integration-test
- unit-test:
matrix:
parameters:
python-version: ["3.8", "3.9", "3.10"]
- integration-test:
matrix:
parameters:
python-version: ["3.8", "3.9", "3.10"]
- docset

jobs:
unit-test:
parameters:
python-version:
type: string
docker:
- image: python:3.7.9
- image: python:<< parameters.python-version >>
steps:
- checkout
- run: pip install -r requirements.txt
- run: black --check .
- run: python3 test_unit.py
integration-test:
parameters:
python-version:
type: string
machine:
image: "ubuntu-2004:202104-01"
steps:
- checkout
- run: make docker-test
- run: PYTHON_VERSION=<< parameters.python-version >> make docker-test
docset:
docker:
# NOTE: We might eventually need Docker authentication here.
- image: cimg/python:3.9
- image: cimg/python:3.8
steps:
- checkout
- run:
Expand Down
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-20.04
tools:
python: "3.8"

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# Changelog

# v1.13.0
## Added
- Adding condition for allowing rcv to be none if close to is set (#317)
- Adding foreign-app-addr to dryrun creator (#321)
## Changed
- Matrix test python versions integration tests (#327)
- Matrix test across Python versions for unit tests (#325)
- Bump minimum Python version to 3.8 (#323)
- Add minimum Python version policy to README (#322)
- Consistently reference `pip3` in README (#319)
## Fixed
- Fixed typo in lsig trace (#320)

# v1.12.0
## Fixed
## Fixed
- Catch TypeError and ValueError in verify functions (#309)
## Added
- Dryrun response (#283)
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.7.9
ARG PYTHON_VERSION
FROM python:$PYTHON_VERSION

# Copy SDK code into the container
RUN mkdir -p $HOME/py-algorand-sdk
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ INTEGRATIONS = "@abi or @algod or @applications or @applications.verified or @as
integration:
behave --tags=$(INTEGRATIONS) test -f progress2

PYTHON_VERSION ?= 3.8
docker-test:
./run_integration.sh
PYTHON_VERSION='$(PYTHON_VERSION)' ./run_integration.sh
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,23 @@ Run `$ pip3 install py-algorand-sdk` to install the package.

Alternatively, choose a [distribution file](https://pypi.org/project/py-algorand-sdk/#files), and run `$ pip3 install [file name]`.

## Supported Python versions
py-algorand-sdk's minimum Python version policy attempts to balance several constraints.
* Make it easy for the community to use py-algorand-sdk by minimizing or excluding the need to customize Python installations.
* Provide maintainers with access to newer language features that produce more robust software.

Given these constraints, the minimum Python version policy is:
Target Python version on newest [Ubuntu LTS](https://wiki.ubuntu.com/Releases) released >= 6 months ago.

The rationale is:
* If a major Linux OS distribution bumps a Python version, then it's sufficiently available to the community for us to upgrade.
* The 6 month time buffer ensures we delay upgrades until the community starts using a recently released LTS version.

## SDK Development

Install dependencies

- `pip install -r requirements.txt`
- `pip3 install -r requirements.txt`

Run tests

Expand Down
3 changes: 3 additions & 0 deletions algosdk/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
LOGIC_SIG_MAX_SIZE = 1000
"""int: max size of a teal program and its arguments in bytes"""

ZERO_ADDRESS = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ"
"""str: algorand encoded address of 32 zero bytes"""

# for backward compatibility:
kmd_auth_header = KMD_AUTH_HEADER
algod_auth_header = ALGOD_AUTH_HEADER
Expand Down
2 changes: 1 addition & 1 deletion algosdk/dryrun_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def lsig_trace(self, spc: StackPrinterConfig = None) -> str:
spc = StackPrinterConfig(top_of_stack_first=False)

return self.trace(
self.logic_sig_trace, self.logic_sig_disassembly, spaces=spc
self.logic_sig_trace, self.logic_sig_disassembly, spc=spc
)


Expand Down
11 changes: 9 additions & 2 deletions algosdk/future/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def _undictify(d):
"amt": d["amt"] if "amt" in d else 0,
"receiver": encoding.encode_address(d["rcv"])
if "rcv" in d
else None,
else constants.ZERO_ADDRESS,
}
return args

Expand Down Expand Up @@ -1348,6 +1348,7 @@ def __init__(
self.receiver = receiver
else:
raise error.ZeroAddressError

self.amount = amt
if (not isinstance(self.amount, int)) or self.amount < 0:
raise error.WrongAmountType
Expand Down Expand Up @@ -1386,7 +1387,7 @@ def _undictify(d):
args = {
"receiver": encoding.encode_address(d["arcv"])
if "arcv" in d
else None,
else constants.ZERO_ADDRESS,
"amt": d["aamt"] if "aamt" in d else 0,
"index": d["xaid"] if "xaid" in d else None,
"close_assets_to": encoding.encode_address(d["aclose"])
Expand Down Expand Up @@ -3131,6 +3132,12 @@ def create_dryrun(
accts.extend(txn.accounts)
if txn.foreign_apps:
apps.extend(txn.foreign_apps)
accts.extend(
[
logic.get_application_address(aidx)
for aidx in txn.foreign_apps
]
)
if txn.foreign_assets:
assets.extend(txn.foreign_assets)

Expand Down
9 changes: 6 additions & 3 deletions algosdk/testing/dryrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dataclasses import dataclass
from typing import List, Union

from algosdk.constants import payment_txn, appcall_txn
from algosdk.constants import payment_txn, appcall_txn, ZERO_ADDRESS
from algosdk.future import transaction
from algosdk.encoding import encode_address, msgpack_encode
from algosdk.v2client.models import (
Expand All @@ -18,7 +18,6 @@
)


ZERO_ADDRESS = encode_address(bytes(32))
PRINTABLE = frozenset(string.printable)


Expand Down Expand Up @@ -478,7 +477,11 @@ def _dryrun_request(self, prog_drr_txns, lsig, app, sender):
return drr

def _checked_request(
self, prog_drr_txns, lsig=None, app=None, sender=ZERO_ADDRESS
self,
prog_drr_txns,
lsig=None,
app=None,
sender=ZERO_ADDRESS,
):
"""
Helper function to make a dryrun request and perform basic validation
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# -- Project information -----------------------------------------------------

project = "algosdk"
copyright = "2020 Algorand"
copyright = "2022 Algorand"
author = "Algorand"


Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx==4.0.1
sphinx-rtd-theme
sphinx==4.2.0
sphinx-rtd-theme==1.0.0
m2r2
2 changes: 1 addition & 1 deletion run_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mkdir -p test/features
cp -r test-harness/features/* test/features

# Build SDK testing environment
docker build -t py-sdk-testing -f Dockerfile "$(pwd)"
docker build -t py-sdk-testing --build-arg PYTHON_VERSION="${PYTHON_VERSION}" -f Dockerfile "$(pwd)"

# Start test harness environment
./test-harness/scripts/up.sh
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
description="Algorand SDK in Python",
author="Algorand",
author_email="[email protected]",
version="v1.12.0",
version="v1.13.0",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
Expand All @@ -22,7 +22,7 @@
"msgpack>=1.0.0,<2",
],
packages=setuptools.find_packages(),
python_requires=">=3.5",
python_requires=">=3.8",
package_data={"": ["data/langspec.json"]},
include_package_data=True,
)
24 changes: 24 additions & 0 deletions test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1942,6 +1942,30 @@ def test_payment_txn(self):
paytxn, encoding.msgpack_encode(encoding.msgpack_decode(paytxn))
)

def test_payment_txn_future(self):
paytxn = (
"iKVjbG9zZcQgYMak0FPHfqBp4So5wS5p7g+O4rLkqwo/ILSjXWQVKpGjZmVlzQPoom"
"Z2KqNnZW6qc2FuZG5ldC12MaJnaMQgNCTHAIMgeYC+4MCSbMinkrlsgtRD6jhfJEXz"
"IP3mH9SibHbNBBKjc25kxCARM5ng7Z1RkubT9fUef5nT9w0MGQKRGbwgOva8/tx3qqR"
"0eXBlo3BheQ=="
)
self.assertEqual(
paytxn,
encoding.msgpack_encode(encoding.future_msgpack_decode(paytxn)),
)

def test_asset_xfer_txn_future(self):
axfer = (
"iaZhY2xvc2XEIGDGpNBTx36gaeEqOcEuae4PjuKy5KsKPyC0o11kFSqRo2ZlZc0D6KJmdi"
"qjZ2VuqnNhbmRuZXQtdjGiZ2jEIDQkxwCDIHmAvuDAkmzIp5K5bILUQ+o4XyRF8yD95h/U"
"omx2zQQSo3NuZMQgETOZ4O2dUZLm0/X1Hn+Z0/cNDBkCkRm8IDr2vP7cd6qkdHlwZaVheGZ"
"lcqR4YWlkCg=="
)
self.assertEqual(
axfer,
encoding.msgpack_encode(encoding.future_msgpack_decode(axfer)),
)

def test_multisig_txn(self):
msigtxn = (
"gqRtc2lng6ZzdWJzaWeSgqJwa8Qg1ke3gkLuR0MUN/Ku0oyiRVIm9P1QFDaiEhT5v"
Expand Down

0 comments on commit 896d2aa

Please sign in to comment.