Skip to content
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

Make dependencies for Ledger support optional #1474

Merged

Conversation

droserasprout
Copy link
Contributor

Introduced changes

ledgerwallet and bip-utils dependencies made optional. To use LedgerSigner the package needs to be installed with -E ledger.

These two libraries require lots of cryptography dependencies that significantly increase size of the virtualenv, Docker images, increase installation time and require compilation on many platforms.

LateException helper ensures that ImportError exception is raised only when Ledger code is actually used. Lazy imports could in addition improve import times, but require much more code changes.

Breaking changes

Existing users will need to add ledger extra to dependencies after the update.

Bonus: workaround

If you're dealing with the same issues, found this PR, and it's still open, here's how to override dependencies in pyproject.toml with PDM package manager. Unfortunately, Poetry doesn't support such tricks.

[tool.pdm.resolution]
excludes = ["bip-utils", "ledgerwallet"]

@enitrat
Copy link

enitrat commented Sep 6, 2024

great, we were stuck because of compatibility issues because of this.

@franciszekjob
Copy link
Collaborator

franciszekjob commented Sep 6, 2024

@droserasprout thanks for the PR! It looks good, will review it soon :)

@franciszekjob
Copy link
Collaborator

@droserasprout Could you please fix linting?

@droserasprout
Copy link
Contributor Author

There are multiple poetry install calls in the checks.yml workflow. I'm not sure which ones require extras, so added everywhere just in case.

@franciszekjob
Copy link
Collaborator

Ok, no worries. Will review it right after #1481 is merged, because this way "Tests" job in your PR will not be breaking.

@franciszekjob
Copy link
Collaborator

@droserasprout at first glance PR looks good, and passes tests (without network tests because env variables are not set).
However, we need to wait once #1473 is completed as it may changes LedgerSigner implementation. Will keep you updated.

Copy link
Collaborator

@franciszekjob franciszekjob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👍
I think that we need to install Ledger extra using poetry install -E ledger only in Tests job (ledger is tested only there), in the rest it can be removed. Could you check it please @droserasprout ?

@droserasprout
Copy link
Contributor Author

Done. I've updated a couple of section headers to make SETUP PYTHON part more copypastable.

@franciszekjob
Copy link
Collaborator

franciszekjob commented Sep 18, 2024

@droserasprout
I think it would be better to address it in separate PR. Could you please just keep changes related to optional ledger installation (in checks.yml file) and open other PR for cleanup? And then we can merge this one.

Copy link
Collaborator

@franciszekjob franciszekjob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@franciszekjob franciszekjob merged commit 2a84190 into software-mansion:development Sep 18, 2024
9 of 10 checks passed
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.

3 participants