-
Notifications
You must be signed in to change notification settings - Fork 28
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 pyscard dependency optional #580
Conversation
Not sure how to verify that pyscard is still included in the pre-built binaries. |
Looks like flit by default installs all dependencies so we should be good: https://flit.pypa.io/en/stable/cmdline.html#cmdoption-flit-install-deps |
pynitrokey/cli/nk3/piv.py
Outdated
@click.argument("args", nargs=-1, type=click.UNPROCESSED) | ||
def piv(args: list[str]) -> None: | ||
"""Nitrokey PIV App""" | ||
local_critical(PCSC_ABSENT) |
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.
I would set support_hint=False
because this is not an unexpected error (so we don’t need the logs) and it is easy to miss the actual error message in all that noise.
To limit the need to install pyscard, it is made optional. | ||
If you make it an optional dependency of your package, please patch ``pynitrokey/cli/nk3/pcsc_absent.py`` to indicate users how they can install it. |
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.
Should we recommend to always enable it if possible?
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.
I'm in favor of allowing users to make use of a minimal set of dependencies.
pynitrokey/cli/nk3/pcsc_absent.py
Outdated
@@ -0,0 +1 @@ | |||
PCSC_ABSENT = "pyscard is not available, please consult https://docs.nitrokey.com/nitrokey3/linux/troubleshooting#pcsc-unavailable for more information" |
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.
PCSC_ABSENT = "pyscard is not available, please consult https://docs.nitrokey.com/nitrokey3/linux/troubleshooting#pcsc-unavailable for more information" | |
PCSC_ABSENT = "This command requires the pyscard library that is not available on your system. Please consult https://docs.nitrokey.com/nitrokey3/linux/troubleshooting#pcsc-unavailable for more information" |
AFAIR it is easy to build the installer locally. I can test it later today or tomorrow to verify the behavior. |
The Linux onefile build includes pcsc so the Windows builds should be fine too. |
|
b7fc6e6
to
6ba89cd
Compare
6ba89cd
to
1f795ef
Compare
I think we can merge this now, right? |
This PR allows using nitropy without pyscard installed.
Changes
Checklist
Make sure to run
make check
andmake fix
before creating a PR, otherwise the CI will fail.Test Environment and Execution
Relevant Output Example
Fixes #579