-
Notifications
You must be signed in to change notification settings - Fork 4
Complete rework of the autonity library #59
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
Conversation
c900482 to
cb117be
Compare
4901a95 to
890a49b
Compare
5e800c1 to
6fda9d9
Compare
25cecbc to
ac0ed28
Compare
033534a to
1434319
Compare
|
@aiman I'm done with the contract wrapper factories as discussed, this is now ready for review. |
f04dce8 to
be80a48
Compare
As Pyright is more widely used than mypy for type checking.
Generate NumPy-style docstrings from NatSpec files.
|
I've addressed the comments from #59 (comment) in e287055 |
|
I'm reviewing a final time, this time from the point of view of a user, and also thinking about what the Changelog entry/entries should be... Any ideas? |
|
|
I'm having trouble running the tests for this branch inside of a devenv: $ git checkout master
git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
$ git clean -x -d -i
$ hatch
bash: hatch: command not found
$ which python
/usr/bin/python
$ /usr/bin/python --version
Python 3.11.6
$ which python3.12
which: no python3.12 in ...
$ devenv shell
• Building shell ...
• Using Cachix: nixpkgs-python, devenv
warning: Performing inefficient double copy of path '«github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/' to the store. This can typically be avoided by rewriting an attribute like `src = ./.` to `src = builtins.path { path = ./.; name = "source"; }`.
✔ Building shell in 6.3s.
• Entering shell
$ which python
~/.local/share/hatch/env/virtual/autonity/H65cO8gT/autonity/bin/python
$ python --version
Python 3.11.8
$ which hatch
/nix/store/87gcqzg7cra5nrfvfilrffmv9cgp7bad-hatch-1.9.0/bin/hatch
$ hatch run +py=3.12 test:python --version
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────── test.py3.12 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Python 3.12.4
$ hatch run +py=3.12 test:all
...
Success: no issues found in 27 source files
$ exit
exit
$ git checkout rework
Switched to branch 'rework'
Your branch is up to date with 'origin/rework'.
$ devenv shell
• Building shell ...
• Using Cachix: nixpkgs-python, devenv
warning: Performing inefficient double copy of path '«github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/' to the store. This can typically be avoided by rewriting an attribute like `src = ./.` to `src = builtins.path { path = ./.; name = "source"; }`.
✔ Building shell in 6.1s.
• Entering shell
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
autonity 4.0.0 requires web3==6.19.0, but you have web3 7.2.0 which is incompatible.
$ hatch run +py=3.12 test:python --version
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────── test.py3.12 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Python 3.12.4
$ hatch run +py=3.12 test:all
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────── test.py3.12 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
autonity 4.0.0 requires web3==6.19.0, but you have web3 7.2.0 which is incompatible.
Traceback (most recent call last):
File "/home/test/.local/share/hatch/env/virtual/autonity/H65cO8gT/test.py3.12/bin/pytest", line 5, in <module>
from pytest import console_main
File "/home/test/.local/share/hatch/env/virtual/autonity/H65cO8gT/test.py3.12/lib/python3.12/site-packages/pytest/__init__.py", line 9, in <module>
from _pytest.assertion import register_assert_rewrite
File "/home/test/.local/share/hatch/env/virtual/autonity/H65cO8gT/test.py3.12/lib/python3.12/site-packages/_pytest/assertion/__init__.py", line 11, in <module>
from _pytest.assertion import rewrite
File "/home/test/.local/share/hatch/env/virtual/autonity/H65cO8gT/test.py3.12/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 32, in <module>
from _pytest.assertion import util
File "/home/test/.local/share/hatch/env/virtual/autonity/H65cO8gT/test.py3.12/lib/python3.12/site-packages/_pytest/assertion/util.py", line 24, in <module>
from _pytest.config import Config
File "/home/test/.local/share/hatch/env/virtual/autonity/H65cO8gT/test.py3.12/lib/python3.12/site-packages/_pytest/config/__init__.py", line 58, in <module>
import _pytest.hookspec
File "/home/test/.local/share/hatch/env/virtual/autonity/H65cO8gT/test.py3.12/lib/python3.12/site-packages/_pytest/hookspec.py", line 305, in <module>
@hookspec(
^^^^^^^^^
TypeError: HookspecMarker.__call__() got an unexpected keyword argument 'warn_on_impl_args'Notice the error line:
This appears both on entering the devenv shell, and also when running the tests. |
This error doesn't seem to be related to devenv. I got the same without entering the devenv shell, after switching branches: git checkout master
hatch run true
git checkout rework
hatch run trueand it prints The error disappears after running Could it be that Hatch doesn't update the dependencies properly after switching branches? |
|
It may be better to drop the devenv support for the moment, as I notice Hatch in the repo |
This error appears to be a result of conflicting dependencies. As Hatch doesn't generate lockfiles, I've added the hatch-pip-compile plugin to inspect dependencies, however adding the lockfile itself resolved the error.
Yes this might be a Hatch bug that has been fixed, I only got the error with Hatch 1.9.0 but not with 1.12.0. |
|
Can we address these test warnings? |
Generate a test case for each method when there are multiple methods with the same name but different signatures.
The `plum` library raises warnings about not being able to resolve `eth_typing.ChecksumAddress` to dispatch the `stabilization.debt_amount` multimethod; nevertheless the dispatch seems to be working as expected.
I've suppressed these warnings in 636a39a and opened https://github.com/clearmatics/pyabigen/issues/7 to investigate the issue further. These warnings are raised by the plum library that has been added to handle overloaded contract functions, of which there is only one in autonity.py and it seems to be working as expected. |
aiman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Complete rework of the
autonitylibrary.autonity.networksmodule with parameters for Piccadilly and Bakerloo testnetsThe new library doesn't contain any of the Web3 helper functions of the old library because they mostly re-implemented existing Web3.py functionality and are out of scope of autonity.py.
All code of the
autonity.contractsmodule have been auto-generated. Note that the contract ABIs are now included in the generated Python files as Python dictionaries (similarly to the Go wrappers).Closes #73.
Closes #43 because Web3.py >=6.19.0 depends on eth-rlp 1.0.1 that includes ethereum/eth-rlp#19 i.e. the
typing-extensionsdependency could be removed.TODO:
@devNatSpec tag to docstrings