diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 30a6766..8f19c11 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,16 @@ Package maintainers and users who have to manually update their installation may want to subscribe to `GitHub's tag feed `_. +Version 0.8.0 +============= + +- Keyring support has been removed, which means that ``password.fetch = + ["keyring", "example.com", "myuser"]`` doesn't work anymore. + + For existing setups: Use ``password.fetch = ["command", "keyring", "get", + "example.com", "myuser"]`` instead, which is more generic. See the + documentation for details. + Version 0.7.5 ============= diff --git a/docs/keyring.rst b/docs/keyring.rst index 28f1d80..b8abef8 100644 --- a/docs/keyring.rst +++ b/docs/keyring.rst @@ -38,38 +38,23 @@ You can fetch the username as well:: Or really any kind of parameter in a storage section. -System Keyring -============== +Accessing the system keyring +---------------------------- -While the command approach is quite flexible, it is often cumbersome to write a -script fetching the system keyring. +As shown above, you can use the ``command`` strategy to fetch your credentials +from arbitrary sources. A very common usecase is to fetch your password from +the system keyring. -Vdirsyncer can do this for you if you have the keyring_ package installed. How -you would obtain this package depends on how you installed vdirsyncer. If you -used pip, you can use the following command to also install keyring:: +The keyring_ Python package contains a command-line utility for fetching +passwords from the OS's password store. Installation:: - pip install vdirsyncer[keyring] + pip install keyring -Then you can use:: - - [storage foo] - type = caldav - username = myusername - password.fetch = ["keyring", "myservicename", "myusername"] - - -The password can than be set like this (in a python interpreter):: - - >>> import keyring - >>> keyring.set_password("myservicename", "myusername", "password") - -To test if you got it right you can run:: - - >>> keyring.get_password("myservicename", "myusername") - "password" - -.. _keyring: https://pypi.python.org/pypi/keyring +Basic usage:: + password.fetch = ["command", "keyring", "get", "example.com", "foouser"] + +.. _keyring: https://github.com/jaraco/keyring/ Password Prompt =============== diff --git a/setup.py b/setup.py index 64ed382..f436cc4 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,6 @@ setup( 'atomicwrites' ], extras_require={ - 'keyring': ['keyring'], 'remotestorage': ['requests-oauthlib'] } ) diff --git a/tests/cli/test_fetchparams.py b/tests/cli/test_fetchparams.py index 0f71dff..129aafb 100644 --- a/tests/cli/test_fetchparams.py +++ b/tests/cli/test_fetchparams.py @@ -2,18 +2,6 @@ from textwrap import dedent -import pytest - - -class EmptyKeyring(object): - def get_password(self, *a, **kw): - return None - - -@pytest.fixture(autouse=True) -def empty_password_storages(monkeypatch): - monkeypatch.setattr('vdirsyncer.cli.fetchparams.keyring', EmptyKeyring()) - def test_get_password_from_command(tmpdir, runner): runner.write_with_general(dedent(''' diff --git a/vdirsyncer/cli/fetchparams.py b/vdirsyncer/cli/fetchparams.py index 59009c9..b177b4b 100644 --- a/vdirsyncer/cli/fetchparams.py +++ b/vdirsyncer/cli/fetchparams.py @@ -10,11 +10,6 @@ SUFFIX = '.fetch' logger = log.get(__name__) -try: - import keyring -except ImportError: - keyring = None - def expand_fetch_params(config): config = dict(config) @@ -72,12 +67,6 @@ def _fetch_value(opts, key): return rv -def _strategy_keyring(username, host): - if not keyring: - raise RuntimeError('Keyring package not available.') - return keyring.get_password(username, host) - - def _strategy_command(*command): import subprocess command = (expand_path(command[0]),) + command[1:] @@ -94,7 +83,6 @@ def _strategy_prompt(text): STRATEGIES = { - 'keyring': _strategy_keyring, 'command': _strategy_command, 'prompt': _strategy_prompt, }