hyperliquid-dex / hyperliquid-python-sdk

SDK for Hyperliquid API trading with Python.
MIT License
238 stars 97 forks source link

Update eth-abi dependency #40

Closed ben9809 closed 1 week ago

ben9809 commented 4 months ago

This pull request updates the eth-abi dependency in the hyperliquid-python-sdk project. The changes are as follows:

  1. Updated the eth-abi version in pyproject.toml to support both Python 3.7 and Python 3.8+.
  2. The 3.0.1 version also presents some bugs that have been fixed in the next releases of the package
  3. Made necessary changes in the codebase to accommodate the eth-abi update.

This update ensures that hyperliquid SDK stays up-to-date with the latest eth-abi version, improving its compatibility and performance with Ethereum-based operations.

Please review the changes and let me know if there are any concerns or suggestions.

0xTrip commented 3 months ago

Also getting conflicts with other Eth based development applications.

ben9809 commented 3 months ago

I think eth-utils, eth-account, and msgpack should be updated too because the newest versions fix so many bugs and memory leakages

traderben commented 3 months ago

Sorry it took me so long to review this, but I don't think this works on python 3.7

To test it I built a wheel: poetry build My poetry installation is setup to use python 3.10 I then copied this wheel to another directory and activate a python 3.7 virtual environment. I then attempted to install the wheel file: python -m pip install hyperliquid_python_sdk-0.5.0-py3-none-any.whl Processing ./hyperliquid_python_sdk-0.5.0-py3-none-any.whl Collecting eth-abi<4.0.0,>=3.0.1; python_version >= "3.7" and python_version < "3.8" Using cached eth_abi-3.0.1-py3-none-any.whl (28 kB) Collecting msgpack<2.0.0,>=1.0.5 Downloading msgpack-1.0.5.tar.gz (127 kB) |████████████████████████████████| 127 kB 3.6 MB/s Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing wheel metadata ... error ERROR: Command errored out with exit status 1: command: /Users/ben/.pyenv/versions/3.7/bin/python3 /Users/ben/.pyenv/versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/tmp3z0d3zs3 cwd: /private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-install-gosxsvzg/msgpack Complete output (61 lines): running dist_info creating /private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-modern-metadata-ngfcgwvu/msgpack.egg-info writing /private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-modern-metadata-ngfcgwvu/msgpack.egg-info/PKG-INFO writing dependency_links to /private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-modern-metadata-ngfcgwvu/msgpack.egg-info/dependency_links.txt writing top-level names to /private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-modern-metadata-ngfcgwvu/msgpack.egg-info/top_level.txt writing manifest file '/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-modern-metadata-ngfcgwvu/msgpack.egg-info/SOURCES.txt' reading manifest file '/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-modern-metadata-ngfcgwvu/msgpack.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching '*.c' under directory 'msgpack' adding license file 'COPYING' writing manifest file '/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-modern-metadata-ngfcgwvu/msgpack.egg-info/SOURCES.txt' creating '/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-modern-metadata-ngfcgwvu/msgpack-1.0.5.dist-info' Traceback (most recent call last): File "/Users/ben/.pyenv/versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in main() File "/Users/ben/.pyenv/versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main json_out['return_val'] = hook(hook_input['kwargs']) File "/Users/ben/.pyenv/versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel return hook(metadata_directory, config_settings) File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 380, in prepare_metadata_for_build_wheel self.run_setup() File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 338, in run_setup exec(code, locals()) File "", line 98, in File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/init.py", line 107, in setup return distutils.core.setup(attrs) File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/dist.py", line 1234, in run_command super().run_command(command) File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/command/dist_info.py", line 104, in run bdist_wheel = self.get_finalized_command('bdist_wheel') File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/_distutils/cmd.py", line 304, in get_finalized_command cmd_obj = self.distribution.get_command_obj(command, create) File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 860, in get_command_obj klass = self.get_command_class(command) File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/dist.py", line 979, in get_command_class self.cmdclass[command] = cmdclass = ep.load() File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/overlay/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/init.py", line 208, in load module = import_module(match.group('module')) File "/Users/ben/.pyenv/versions/3.7.10/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/normal/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 27, in from .macosx_libfile import calculate_macosx_platform_tag File "/private/var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/pip-build-env-r3z_hv_n/normal/lib/python3.7/site-packages/wheel/macosx_libfile.py", line 43, in import ctypes File "/Users/ben/.pyenv/versions/3.7.10/lib/python3.7/ctypes/init.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes'

ERROR: Command errored out with exit status 1: /Users/ben/.pyenv/versions/3.7/bin/python3 /Users/ben/.pyenv/versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/yy/p2gk9yz56fq646yjws6bgh3w0000gn/T/tmp3z0d3zs3 Check the logs for full command output.

I don't see why this change would cause this error, but I don't have an issue with following the same steps to install the wheel without this change

traderben commented 2 months ago

Python 3.7 is end of life and we have very little 3.7 usage: https://pypistats.org/packages/hyperliquid-python-sdk Hopefully I'll have time to drop 3.7 support and then it should be easier to upgrade these dependencies

ben9809 commented 2 months ago

@traderben I think it would be a good idea to drop the 3.7 version.

Let me know when you plan to do it, I could help upgrade the other dependencies in case!

traderben commented 3 weeks ago

I published a new version that drops support for 3.7

traderben commented 1 week ago

https://github.com/hyperliquid-dex/hyperliquid-python-sdk/pull/60 upgraded the eth-abi dependency, so I'm going to close this PR. Feel free to open a new one if there's a compelling reason to upgrade further