Skip to content

Support for Anchor 0.32.1#166

Open
markovejnovic wants to merge 11 commits intokevinheavey:mainfrom
plocca-inc:anchor-0.32.1
Open

Support for Anchor 0.32.1#166
markovejnovic wants to merge 11 commits intokevinheavey:mainfrom
plocca-inc:anchor-0.32.1

Conversation

@markovejnovic
Copy link

@markovejnovic markovejnovic commented Feb 1, 2026

Hey all.

This PR adds support for Anchor 0.32.1. I mostly based my work off of #163 but I tried to improve the code quality a little bit and also ensure all tests pass.

Note: I was unable to find the source/IDLs for a lot of the existing test IDLs. Consequently, I have deleted some test IDLs. I would urge you figure out how to find those source files again, and drop the relevant commit (read further).

Prior to merge:

Validation

Type Checks

$ make lint
uv run ruff src tests
uv run mypy src tests
Success: no issues found in 115 source files

Tests

I had a little bit of trouble running make test since solana-test-validator wasn't properly cleaned up on my machine so I ran the tests manually, pkilling the validator. I didn't bother to investigate the validator persiting after test execution. The warnings I got probably hint at the issue, but that's way beyond the scope of this PR.

$ pkill -f solana-test-validator; rm -rf .pytest_cache/d/.x
process/localnet
$ uv run --all-extras pytest tests/unit
=================== test session starts ===================
platform darwin -- Python 3.11.14, pytest-7.4.4, pluggy-1.5
.0
rootdir: /Users/marko/Desktop/anchorpy
configfile: pytest.ini
plugins: xprocess-0.18.1, anyio-4.3.0, asyncio-0.21.2, anch
orpy-0.32.1
asyncio: mode=Mode.STRICT
collected 11 items                                        

tests/unit/test_accounts_array.py .                 [  9%]
tests/unit/test_accounts_coder.py .                 [ 18%]
tests/unit/test_clientgen.py .                      [ 27%]
tests/unit/test_event_parser.py .                   [ 36%]
tests/unit/test_idl.py ..                           [ 54%]
tests/unit/test_instruction_coder.py .              [ 63%]
tests/unit/test_transaction.py ..                   [ 81%]
tests/unit/test_types_coder.py ..                   [100%]

=================== 11 passed in 0.17s ====================
pytest-xprocess reminder::Be sure to terminate the started 
process by running 'pytest --xkill' if you have not explici
tly done so in your fixture with 'xprocess.getinfo(<process
_name>).terminate()'.
$ pkill -f solana-test-validator; rm -rf .pytest_cache/d/.x
process/localnet
$ uv run --all-extras pytest tests/client_gen
=================== test session starts ===================
platform darwin -- Python 3.11.14, pytest-7.4.4, pluggy-1.5
.0
rootdir: /Users/marko/Desktop/anchorpy
configfile: pytest.ini
plugins: xprocess-0.18.1, anyio-4.3.0, asyncio-0.21.2, anch
orpy-0.32.1
asyncio: mode=Mode.STRICT
collected 9 items                                         

tests/client_gen/test_client_gen.py .....           [ 55%]
tests/client_gen/test_functional.py ....            [100%]

==================== 9 passed in 6.12s ====================
pytest-xprocess reminder::Be sure to terminate the started 
process by running 'pytest --xkill' if you have not explici
tly done so in your fixture with 'xprocess.getinfo(<process
_name>).terminate()'.
$ pkill -f solana-test-validator; rm -rf .pytest_cache/d/.x
process/localnet
$ uv run --all-extras pytest tests/test_cli.py 
=================== test session starts ===================
platform darwin -- Python 3.11.14, pytest-7.4.4, pluggy-1.5
.0
rootdir: /Users/marko/Desktop/anchorpy
configfile: pytest.ini
plugins: xprocess-0.18.1, anyio-4.3.0, asyncio-0.21.2, anch
orpy-0.32.1
asyncio: mode=Mode.STRICT
collected 1 item                                          

tests/test_cli.py .                                 [100%]

==================== warnings summary =====================
tests/test_cli.py::test_shell
  /Users/marko/Desktop/anchorpy/.venv/lib/python3.11/site-p
ackages/traitlets/traitlets.py:1385: DeprecationWarning: Pa
ssing unrecognized arguments to super(InteractiveShellEmbed
).__init__(using='asyncio').
  object.__init__() takes exactly one argument (the instanc
e to initialize)
  This is deprecated in traitlets 4.2.This error will be ra
ised in a future release of traitlets.
    warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-w
arnings.html
============== 1 passed, 1 warning in 2.66s ===============
pytest-xprocess reminder::Be sure to terminate the started 
process by running 'pytest --xkill' if you have not explici
tly done so in your fixture with 'xprocess.getinfo(<process
_name>).terminate()'.

kevinheavey/anchorpy-idl#5 changes

Three key changes:

  • Exposed some python types that look like they were intended to be public anyways.
  • Added IdlTypeDefined::defined which was declared as public in the .pyi
  • Made IdlDefinedFieldsNamed iterable in the python code, so that the legacy API could still be used in anchorpy. My reasoning was that doing this minimizes the blast radius in this repo.
  • Changed the docs constructors to accept None where the .pyi specified.

@markovejnovic markovejnovic force-pushed the anchor-0.32.1 branch 3 times, most recently from a231fde to f2cc5b7 Compare February 1, 2026 03:55
@markovejnovic markovejnovic force-pushed the anchor-0.32.1 branch 6 times, most recently from 773bf1e to 00ce459 Compare February 1, 2026 05:18
@markovejnovic markovejnovic marked this pull request as ready for review February 1, 2026 05:18
@markovejnovic
Copy link
Author

Btw, if you want to hop on a quick call to review this PR (and/or help me understand what other things need to be built), feel free to DM me @suis_siva

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants