-
Notifications
You must be signed in to change notification settings - Fork 50
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
Revise extra dependency handling #179
Comments
securesystemslib does not work properly without its extra dependencies cryptography, pynacl and colorama (see secure-systems-lab/securesystemslib#179). To build in-toto for debian, we need these dependency, and thus add them explicitly to debian/control.
securesystemslib does not work properly without its extra dependencies cryptography, pynacl and colorama (see secure-systems-lab/securesystemslib#179). To build in-toto for debian, we need these dependency, and thus add them explicitly to debian/control. Signed-off-by: Lukas Puehringer <[email protected]>
When looking at available options for testing for the presence of optional dependencies it seems there's an old mechanism securesystemslib's tox environment tests Python 2.7, 3.5 and 3.6 - but that doesn't necessarily mean those are the only versions we care to support. PyPI lists securesystemslib-0.11.3 as supporting Python 2.7, 3.4, 3.5 and 3.6. It may be reasonable to take the same approach as Ansible (see Ansible commit 2732cde) and use However with Python 2's EOL being close I wanted to get some feedback on whether it's even desirable to continue to maintain Python2 support in securesystemslib? |
Thanks for your assessment, @joshuagl . What's the benefit of using In my mind, we would encapsulate imports and use of optional libraries in non-public modules like so: # in `securesystemslib/optional_foo_private_module.py`
try:
import foo
except ImportError:
NO_FOO = True
def foo():
if NO_FOO:
raise("<Helpful message about missing foo>")
foo.foo() This would keep our public interface clean of import-related case handling. # in `secureystemslib/public_interface.py`
import optional_foo_private_module
def foo():
"""Call foo or raise helpful error message if not installed. """
optional_foo_private_module.foo() What do you think about that pattern? Regarding Python 2.7, we discussed this recently and decided that we'll keep it around for a little longer. But I agree, we won't be able to do this for too long. We'll run into troubles at the latest when our dependencies drop support. Still, I would prefer if we could resolve this issue without dropping 2.7. |
I had noticed that the |
Looking at outstanding native dependencies that need handling: Sphincs (#169) and CCID/PIV (#170) can be handled in a similar fashion to other key algorithm modules, that is: setting a constant to I have a WIP patch for GPG, I also need to figure out how to test it. The gpg command is rarely missing on modern Linux, as most distro package managers pull it in as a dependency, and testing only on Windows feels insufficient. |
💯
Leaving a comment on the two PRs, pointing to the discussion here, and your awesome fix in #200 should go a long way. Would you mind doing that?
Throwing the same error sounds like a good idea. And I think the semantics even work if the
Might |
This is fixed for existing code in #200 and #206. Authors of pending relevant PRs have been informed to follow the new strategy (#170 (comment), #169 (comment)). I have created a separate feature request for a fine-tune code coverage measurement setup in #208. Thanks for the hard work, @joshuagl! Closing here. |
[Updated on Jan 23, 2020]
Description of issue or feature request:
securesystemslib lists some dependencies that require C-code (
cryptography
requiresopenssl
,pynacl
requireslibsodium
) as optional to allow for a pure-python installation. The runtime handling of missing optional dependencies should be revised.Current behavior:
cryptography
andpynacl
are listed as optional (extra) dependencies, butsecuresystemslib
does not fare (consistently) well, if installed without them.Expected behavior:
Public facing modules (e.g.Fixed with Improve handling of native dependencies #200interface.py
andkeys.py
) must be importable, even if the optional dependencies are not installed.Each public facing function always should be callable and present meaningful user-feedback if an optional dependency that is required for that function is not installed.Fixed with Improve handling of native dependencies #200Also address or keep in mind recently merged or pending functionality, that has non-pure Python dependencies (Add gpg support and custom (sub)process module #174, sphincs+ support, for post-quantum crypto #169, External Signing using CCID/PIV interface. #170).
-
Optional:Fixed with #200colorama
was made a strict dependency in #178 to quickfix #155. @SantiagoTorres, to consider making it a optional again (with respect to required adoptions as outlined above).The text was updated successfully, but these errors were encountered: