Skip to content

Commit 5c43e12

Browse files
Merge branch 'master' into feature/abi (#284)
1 parent 81edc2c commit 5c43e12

Some content is hidden

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

88 files changed

+6218
-5899
lines changed

.flake8

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[flake8]
2+
ignore =
3+
E203,
4+
E241,
5+
W291,
6+
E302,
7+
E501,
8+
W503,
9+
E741,
10+
11+
per-file-ignores =
12+
pyteal/compiler/optimizer/__init__.py: F401
13+
examples/application/asset.py: F403, F405
14+
examples/application/security_token.py: F403, F405
15+
examples/application/vote.py: F403, F405
16+
examples/signature/atomic_swap.py: F403, F405
17+
examples/signature/basic.py: F403, F405
18+
examples/signature/dutch_auction.py: F403, F405
19+
examples/signature/periodic_payment_deploy.py: F403, F405
20+
examples/signature/recurring_swap.py: F403, F405
21+
examples/signature/split.py: F403, F405
22+
examples/signature/periodic_payment.py: F403, F405
23+
examples/signature/recurring_swap_deploy.py: F403, F405
24+
pyteal/__init__.py: F401, F403
25+
pyteal/ir/ops.py: E221
26+
tests/module_test.py: F401, F403
27+
# Temporary ignores while merging
28+
pyteal/ast/abi/array_base_test.py: F403, F405
29+
pyteal/ast/abi/array_dynamic_test.py: F403, F405
30+
pyteal/ast/abi/array_static_test.py: F403, F405
31+
pyteal/ast/abi/bool_test.py: F403, F405
32+
pyteal/ast/abi/method_return_test.py: F403, F405
33+
pyteal/ast/abi/tuple_test.py: F403, F405
34+
pyteal/ast/abi/type_test.py: F403, F405
35+
pyteal/ast/abi/uint_test.py: F403, F405
36+
pyteal/ast/abi/util_test.py: F403, F405
37+
# End temporary ignores while merging

.github/workflows/build.yml

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ on:
66
- v**
77
branches:
88
- master
9+
910
jobs:
1011
build-test:
1112
runs-on: ubuntu-20.04
12-
container: python:${{ matrix.python }}-slim
13+
container: python:${{ matrix.python }}
1314
strategy:
1415
matrix:
1516
python: ['3.10']
@@ -19,16 +20,11 @@ jobs:
1920
uses: actions/checkout@v2
2021
with:
2122
fetch-depth: 0
22-
- name: Install pip dependencies
23-
run: |
24-
pip install -r requirements.txt
25-
pip install -e .
23+
- name: Install python dependencies
24+
run: make setup-development
2625
- name: Build and Test
27-
run: |
28-
python scripts/generate_init.py --check
29-
black --check .
30-
mypy pyteal
31-
pytest
26+
run: make build-and-test
27+
3228
build-docset:
3329
runs-on: ubuntu-20.04
3430
container: python:3.10 # Needs `make`, can't be slim
@@ -37,22 +33,16 @@ jobs:
3733
uses: actions/checkout@v2
3834
with:
3935
fetch-depth: 0
40-
- name: Install pip dependencies
41-
run: |
42-
pip install -r requirements.txt
43-
pip install -r docs/requirements.txt
44-
pip install doc2dash
36+
- name: Install python dependencies
37+
run: make setup-docs
4538
- name: Make docs
46-
run: |
47-
cd docs
48-
make html
49-
doc2dash --name pyteal --index-page index.html --online-redirect-url https://pyteal.readthedocs.io/en/ _build/html
50-
tar -czvf pyteal.docset.tar.gz pyteal.docset
39+
run: make bundle-docs
5140
- name: Archive docset
5241
uses: actions/upload-artifact@v2
5342
with:
5443
name: pyteal.docset
5544
path: docs/pyteal.docset.tar.gz
45+
5646
upload-to-pypi:
5747
runs-on: ubuntu-20.04
5848
container: python:3.10
@@ -64,9 +54,9 @@ jobs:
6454
with:
6555
fetch-depth: 0
6656
- name: Install dependencies
67-
run: pip install wheel
57+
run: make setup-wheel
6858
- name: Build package
69-
run: python setup.py sdist bdist_wheel
59+
run: make bdist-wheel
7060
- name: Release
7161
uses: pypa/gh-action-pypi-publish@release/v1
7262
with:

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.DS_Store
2-
31
# Byte-compiled / optimized / DLL files
42
__pycache__/
53
*.py[cod]
@@ -54,8 +52,8 @@ coverage.xml
5452
.pytest_cache/
5553

5654
# Tests generating TEAL output to compared against an expected example.
57-
tests/teal/*.teal
58-
!tests/teal/*_expected.teal
55+
tests/**/*.teal
56+
!tests/**/*_expected.teal
5957

6058
# Translations
6159
*.mo
@@ -76,6 +74,7 @@ instance/
7674

7775
# Sphinx documentation
7876
docs/_build/
77+
pyteal.docset*
7978

8079
# PyBuilder
8180
target/
@@ -133,3 +132,6 @@ dmypy.json
133132
# IDE
134133
.idea
135134
.vscode
135+
136+
# mac OS
137+
.DS_Store

.readthedocs.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-20.04
11+
tools:
12+
python: "3.10"
13+
# You can also specify other tool versions:
14+
# nodejs: "16"
15+
# rust: "1.55"
16+
# golang: "1.17"
17+
18+
# Build documentation in the docs/ directory with Sphinx
19+
sphinx:
20+
configuration: docs/conf.py
21+
22+
# If using Sphinx, optionally build your docs in additional formats such as PDF
23+
# formats:
24+
# - pdf
25+
26+
# Optionally declare the Python requirements required to build your docs
27+
python:
28+
install:
29+
- requirements: docs/requirements.txt

.readthedocs.yml

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

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.11.1
2+
3+
## Fixed
4+
* Fix readthedocs build issue introduced in v0.11.0 ([#276](https://github.com/algorand/pyteal/pull/276), [#279](https://github.com/algorand/pyteal/pull/279)).
5+
16
# 0.11.0
27

38
## Added

Makefile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
setup-development:
2+
pip install -e.[development]
3+
4+
setup-docs: setup-development
5+
pip install -r docs/requirements.txt
6+
pip install doc2dash
7+
8+
setup-wheel:
9+
pip install wheel
10+
11+
bdist-wheel:
12+
python setup.py sdist bdist_wheel
13+
14+
bundle-docs-clean:
15+
rm -rf docs/pyteal.docset
16+
17+
bundle-docs: bundle-docs-clean
18+
cd docs && \
19+
make html && \
20+
doc2dash --name pyteal --index-page index.html --online-redirect-url https://pyteal.readthedocs.io/en/ _build/html && \
21+
tar -czvf pyteal.docset.tar.gz pyteal.docset
22+
23+
generate-init:
24+
python -m scripts.generate_init
25+
26+
check-generate-init:
27+
python -m scripts.generate_init --check
28+
29+
ALLPY = docs examples pyteal scripts tests *.py
30+
black:
31+
black --check $(ALLPY)
32+
33+
flake8:
34+
flake8 $(ALLPY)
35+
36+
MYPY = pyteal scripts
37+
mypy:
38+
mypy $(MYPY)
39+
40+
lint: black flake8 mypy
41+
42+
test-unit:
43+
pytest
44+
45+
build-and-test: check-generate-init lint test-unit
46+
47+
# Extras:
48+
coverage:
49+
pytest --cov-report html --cov=pyteal

README.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
![PyTeal logo](https://github.com/algorand/pyteal/blob/master/docs/pyteal.png?raw=true)
1+
<!-- markdownlint-disable-file MD041 -->
22

3+
![PyTeal logo](https://github.com/algorand/pyteal/blob/master/docs/pyteal.png?raw=true)
34

45
# PyTeal: Algorand Smart Contracts in Python
56

@@ -8,59 +9,69 @@
89
[![Documentation Status](https://readthedocs.org/projects/pyteal/badge/?version=latest)](https://pyteal.readthedocs.io/en/latest/?badge=latest)
910
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
1011

11-
PyTeal is a Python language binding for [Algorand Smart Contracts (ASC1s)](https://developer.algorand.org/docs/features/asc1/).
12+
PyTeal is a Python language binding for [Algorand Smart Contracts (ASC1s)](https://developer.algorand.org/docs/features/asc1/).
1213

13-
Algorand Smart Contracts are implemented using a new language that is stack-based,
14-
called [Transaction Execution Approval Language (TEAL)](https://developer.algorand.org/docs/features/asc1/teal/).
14+
Algorand Smart Contracts are implemented using a new language that is stack-based,
15+
called [Transaction Execution Approval Language (TEAL)](https://developer.algorand.org/docs/features/asc1/teal/).
1516

16-
However, TEAL is essentially an assembly language. With PyTeal, developers can express smart contract logic purely using Python.
17+
However, TEAL is essentially an assembly language. With PyTeal, developers can express smart contract logic purely using Python.
1718
PyTeal provides high level, functional programming style abstractions over TEAL and does type checking at construction time.
1819

19-
### Install
20+
## Install
2021

2122
PyTeal requires Python version >= 3.10.
2223

2324
To manage multiple Python versions use tooling like [pyenv](https://github.com/pyenv/pyenv).
2425

25-
#### Recommended: Install from PyPi
26+
### Recommended: Install from PyPi
2627

2728
Install the latest official release from PyPi:
2829

2930
* `pip install pyteal`
3031

31-
#### Install Latest Commit
32+
### Install Latest Commit
3233

3334
If needed, it's possible to install directly from the latest commit on master to use unreleased features:
3435

3536
> **WARNING:** Unreleased code is experimental and may not be backwards compatible or function properly. Use extreme caution when installing PyTeal this way.
3637
3738
* `pip install git+https://github.com/algorand/pyteal`
3839

39-
### Documentation
40+
## Documentation
4041

4142
* [PyTeal Docs](https://pyteal.readthedocs.io/)
4243
* `docs/` ([README](docs/README.md)) contains raw docs.
4344

44-
### Development Setup
45+
## Development Setup
4546

4647
Setup venv (one time):
47-
* `python3 -m venv venv`
48+
49+
* `python3 -m venv venv`
4850

4951
Active venv:
50-
* `. venv/bin/activate` (if your shell is bash/zsh)
51-
* `. venv/bin/activate.fish` (if your shell is fish)
5252

53-
Pip install PyTeal in editable state
54-
* `pip install -e .`
53+
* `. venv/bin/activate` (if your shell is bash/zsh)
54+
* `. venv/bin/activate.fish` (if your shell is fish)
55+
56+
Pip install PyTeal in editable state with dependencies:
57+
58+
* `make setup-development`
59+
* OR if you don't have `make` installed:
60+
* `pip install -e.[development]`
61+
* Note, that if you're using `zsh` you'll need to escape the brackets: `pip install -e.\[development\]`
5562

56-
Install dependencies:
57-
* `pip install -r requirements.txt`
58-
5963
Type checking using mypy:
64+
6065
* `mypy pyteal`
6166

6267
Run tests:
68+
6369
* `pytest`
6470

6571
Format code:
72+
6673
* `black .`
74+
75+
Lint using flake8:
76+
77+
* `flake8 docs examples pyteal scripts tests *.py`

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# -- Project information -----------------------------------------------------
2020

2121
project = "PyTeal"
22-
copyright = "2021, Algorand"
22+
copyright = "2022, Algorand"
2323
author = "Algorand"
2424

2525

docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
sphinx_rtd_theme
1+
sphinx==4.2.0
2+
sphinx-rtd-theme==1.0.0
23
py-algorand-sdk

0 commit comments

Comments
 (0)