algorand / pyteal

Algorand Smart Contracts in Python
https://pyteal.readthedocs.io
MIT License
288 stars 130 forks source link

Python 3.12 compatibility issues #712

Closed aorumbayev closed 9 months ago

aorumbayev commented 9 months ago

Subject of the issue

Python 3.12 no longer includes setuptools by default see -> https://github.com/python/cpython/issues/95299.

Pyteal relies on setuptools hence, compilation on any 3.12 environment seems to be failing at the moment.

Steps to reproduce

I have a bare minimum example repo with reproducible bug.

  1. Clone https://github.com/aorumbayev/hello_pyteal_312
  2. poetry install
  3. poetry run python vote.py

Expected behaviour

TEAL code is compiled

Actual behaviour

  File "/Users/aorumbayev/MakerX/projects/algokit/hello_pyteal_312/vote.py", line 3, in <module>
    from pyteal import *
  File "/Users/aorumbayev/Library/Caches/pypoetry/virtualenvs/hello-pyteal-312-qPNrebUk-py3.12/lib/python3.12/site-packages/pyteal/__init__.py", line 1, in <module>
    from pyteal.ast import *
  File "/Users/aorumbayev/Library/Caches/pypoetry/virtualenvs/hello-pyteal-312-qPNrebUk-py3.12/lib/python3.12/site-packages/pyteal/ast/__init__.py", line 54, in <module>
    from pyteal.ast.pragma import Pragma
  File "/Users/aorumbayev/Library/Caches/pypoetry/virtualenvs/hello-pyteal-312-qPNrebUk-py3.12/lib/python3.12/site-packages/pyteal/ast/pragma.py", line 4, in <module>
    from pyteal.pragma import is_valid_compiler_version, pragma
  File "/Users/aorumbayev/Library/Caches/pypoetry/virtualenvs/hello-pyteal-312-qPNrebUk-py3.12/lib/python3.12/site-packages/pyteal/pragma/__init__.py", line 1, in <module>
    from pyteal.pragma.pragma import is_valid_compiler_version, pragma
  File "/Users/aorumbayev/Library/Caches/pypoetry/virtualenvs/hello-pyteal-312-qPNrebUk-py3.12/lib/python3.12/site-packages/pyteal/pragma/pragma.py", line 2, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'