Skip to content

Conversation

@dbast
Copy link
Contributor

@dbast dbast commented Jan 20, 2025

Main change: Updates the supported Python version range in pyproject.toml from 3.8-3.12 to 3.9-3.13. Python 3.8 is EOL and 3.13 is the latest Python stable version, as listed here https://devguide.python.org/versions/. Many (dev-) dependencies also already require Python >=3.9 and otherwise have to remain at old versions.

Also:

  • Fully regenerates the poetry.lock to support Python 3.13 (via added make lockfile-update-full target).
  • Split the install make target into several targets so that install is fully deterministic (installs what is specified in poetry.lock without further updating). One can still run make lockfile-update install install-types to have the old behaviour.
  • Removes the --no-update arg from poetry lock calls as that is default by poetry 2 and the arg does not exist anymore.
  • Increments the required poetry-core version in pyproject.toml to >=2, to prevent conflicts regarding supported poetry args and poetry behaviour (The previous pinning >=1 would allow poetry 1 and 2).
  • Adds the types packages installed by mypy --install-types (installs types-requests) to dev dependencies in pyproject.toml to be handled by poetry and to make things even more deterministic / reproducible.
  • Slightly incremented the mypy version pinning in pyproject.toml as mypy otherwise fails due updated dependencies.
  • Fixes the poetry deprecation warning The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. in current "Install dependency" workflow step, that can be seen here https://github.com/hyperliquid-dex/hyperliquid-python-sdk/actions/runs/12835420694/job/35794815057
  • Fixes the mypy errors so that make check runs locally without any findings (wasn't the case before):
    hyperliquid/info.py: note: In member "__init__" of class "Info":
    hyperliquid/info.py:29:31: error: Incompatible types in assignment (expression has type "None", variable has type "WebsocketManager")  [assignment]
                    self.ws_manager = None
                                      ^~~~
    hyperliquid/exchange.py: note: In member "market_close" of class "Exchange":
    hyperliquid/exchange.py:215:23: error: Incompatible types in assignment (expression has type "str", variable has type "ChecksumAddress")  [assignment]
                    address = self.account_address
                              ^~~~~~~~~~~~~~~~~~~~
    hyperliquid/exchange.py:217:23: error: Incompatible types in assignment (expression has type "str", variable has type "ChecksumAddress")  [assignment]
                    address = self.vault_address
                              ^~~~~~~~~~~~~~~~~~
    
  • Removes the existing requirements*.txt files as exporting those got removed from poetry and I don't see why those files exist in the repo as 1. pyproject.toml contains all the dependencies + their pinnings and 2. poetry enables reproducible installs via poetry.lock, that contains a full list of a all dependencies with hashes and transitive dependencies (pip is able to install the packages by reading from pyproject.toml, no need for pip install -r requirements*.txt).
  • Runs and applies make codestyle (=pyupgrade + black + isort)

Green workflow runs can be found in my fork of the repo: https://github.com/dbast/hyperliquid-python-sdk/actions/runs/12864803064

Fixes the 3 mypy errors:
```
hyperliquid/info.py: note: In member "__init__" of class "Info":
hyperliquid/info.py:29:31: error: Incompatible types in assignment (expression has type "None", variable has type "WebsocketManager")  [assignment]
                self.ws_manager = None
                                  ^~~~
hyperliquid/exchange.py: note: In member "market_close" of class "Exchange":
hyperliquid/exchange.py:215:23: error: Incompatible types in assignment (expression has type "str", variable has type "ChecksumAddress")  [assignment]
                address = self.account_address
                          ^~~~~~~~~~~~~~~~~~~~
hyperliquid/exchange.py:217:23: error: Incompatible types in assignment (expression has type "str", variable has type "ChecksumAddress")  [assignment]
                address = self.vault_address
                          ^~~~~~~~~~~~~~~~~~
```
@dbast
Copy link
Contributor Author

dbast commented Jan 20, 2025

Ready for review/merge. thanks

@traderben
Copy link
Contributor

Thanks for putting this together. I'm just double checking with the rest of the team to make sure no one is concerned about dropping 3.8 support. It looks like we still have a small amount of users on 3.8. Was supporting 3.8 causing any conflicts? It would be helpful to have a clear benefit to dropping support in case we get complaints.

Also, I currently have poetry 1.4 installed and everything still seems to work. I thought the poetry-core version would result in an error that would require an upgrade.

@traderben traderben merged commit 9154651 into hyperliquid-dex:master Feb 3, 2025
2 checks passed
@dbast dbast deleted the 3913 branch February 9, 2025 17:15
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