Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jaraco/keyring
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v24.3.0
Choose a base ref
...
head repository: jaraco/keyring
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v24.3.1
Choose a head ref

Commits on Nov 12, 2023

  1. Copy the full SHA
    b85781e View commit details

Commits on Nov 13, 2023

  1. Copy the full SHA
    b9c4d84 View commit details

Commits on Nov 15, 2023

  1. Upgrade GitHub Actions checkout (jaraco/skeleton#94)

    Also, upgrade from `pypy3.9` to `pypy3.10` and remove the `continue-on-error` for Python 3.12.
    
    As recommended at jaraco/cssutils#41
    cclauss authored Nov 15, 2023
    Copy the full SHA
    75d9cc1 View commit details
  2. GitHub Actions: Combine tox jobs diffcov and docs (jaraco/skeleton#95)

    Code reuse
    
    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
    cclauss and jaraco authored Nov 15, 2023
    Copy the full SHA
    5732ebe View commit details

Commits on Nov 17, 2023

  1. Merge pull request #660 from mtelka/shebang

    Remove useless shebang from cli.py
    jaraco authored Nov 17, 2023
    Copy the full SHA
    8db4564 View commit details

Commits on Nov 19, 2023

  1. Copy the full SHA
    c0df50c View commit details
  2. Add test for do_set

    jaraco committed Nov 19, 2023
    Copy the full SHA
    c73e9da View commit details

Commits on Nov 20, 2023

  1. called_once_with is not valid

    jaraco committed Nov 20, 2023
    Copy the full SHA
    0d1417c View commit details
  2. Merge pull request #663 from jaraco/feature/test-set-cli

    Add test for do_set
    jaraco authored Nov 20, 2023
    Copy the full SHA
    f90ac2a View commit details

Commits on Nov 28, 2023

  1. Copy the full SHA
    26f420a View commit details

Commits on Nov 29, 2023

  1. Copy the full SHA
    33dd012 View commit details

Commits on Dec 1, 2023

  1. Copy the full SHA
    0cebfeb View commit details

Commits on Dec 4, 2023

  1. Copy the full SHA
    97a5f44 View commit details

Commits on Dec 5, 2023

  1. Merge https://github.com/jaraco/skeleton

    # Conflicts:
    #	README.rst
    jaraco committed Dec 5, 2023
    Copy the full SHA
    0bbdc63 View commit details
  2. Enable testing merge queues @ GitHub Actions CI/CD (jaraco/skeleton#93)

    This allows org-hosted projects to start enabling merge queues in the
    repository settings. With that, GitHub would trigger a separate event
    against a merge commit derived from merging several pull requests with
    the target branch.
    webknjaz authored Dec 5, 2023
    Copy the full SHA
    8bff8b0 View commit details

Commits on Dec 11, 2023

  1. Copy the full SHA
    e4bd609 View commit details

Commits on Dec 22, 2023

  1. Drop minimum requirement on pytest-mypy as most environments are alre…

    …ady running much later. Closes jaraco/skeleton#96.
    jaraco committed Dec 22, 2023
    Copy the full SHA
    596e683 View commit details
  2. Use the ruff formatter (jaraco/skeleton#99)

    * Use the ruff formatter, instead of black
    
    Based on:
    - ruff-pre-commit README.md | Using Ruff with pre-commit
      https://github.com/astral-sh/ruff-pre-commit/blob/main/README.md
    - The Ruff Formatter | Conflicting lint rules
      https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
    
    Support for the ruff formatter was added to pytest-ruff by commits from
    October 2023, released the same day as versions 0.2 and 0.2.1. Hence, it
    makes sense to require pytest-ruff ≥ 0.2.1 now.
    
    Support for `quote-style = "preserve"` was added to ruff in the last
    couple of weeks, therefore require the latest version, ruff ≥ 0.1.8.
    This option is equivalent to `skip-string-normalization` in black.
    
    Closes jaraco/skeleton#101.
    
    ---------
    
    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
    DimitriPapadopoulos and jaraco committed Dec 22, 2023
    Copy the full SHA
    b8c6c15 View commit details

Commits on Dec 23, 2023

  1. Merge https://github.com/jaraco/skeleton

    # Conflicts:
    #	README.rst
    jaraco committed Dec 23, 2023
    Copy the full SHA
    5242bcb View commit details

Commits on Dec 24, 2023

  1. Copy the full SHA
    a9c5dd5 View commit details

Commits on Dec 26, 2023

  1. ruff: extended-ignore → ignore (jaraco/skeleton#105)

    Applies Repo-Review suggestion:
    	RF201: Avoid using deprecated config settings
    	extend-ignore deprecated, use ignore instead (identical)
    DimitriPapadopoulos authored Dec 26, 2023
    Copy the full SHA
    db0d581 View commit details
  2. Copy the full SHA
    a8ad969 View commit details

Commits on Jan 2, 2024

  1. Bump year on badge

    jaraco committed Jan 2, 2024
    Copy the full SHA
    f6d9e10 View commit details

Commits on Jan 7, 2024

  1. Remove build and dist from excludes. It appears they are not needed a…

    …nd their presence blocks the names of packages like 'builder' and 'distutils'. Ref pypa/distutils#224.
    jaraco committed Jan 7, 2024
    Copy the full SHA
    dbcb074 View commit details
  2. Copy the full SHA
    d278905 View commit details
  3. Copy the full SHA
    63535c6 View commit details
  4. Copy the full SHA
    27b76d5 View commit details

Commits on Feb 4, 2024

  1. Copy the full SHA
    29e5d34 View commit details

Commits on Feb 6, 2024

  1. Tweak coverage configuration for type checking (jaraco/skeleton#97)

    * Tweak coverage configuration for type checking
    
    * Use `exclude_also` instead of `exclude_lines`
    
    Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
    
    * Add reference to the issue.
    
    ---------
    
    Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
    3 people authored Feb 6, 2024
    Copy the full SHA
    2a402a3 View commit details

Commits on Feb 7, 2024

  1. Copy the full SHA
    68ac292 View commit details
  2. Copy the full SHA
    6ef600e View commit details

Commits on Feb 10, 2024

  1. Copy the full SHA
    dd24411 View commit details

Commits on Feb 14, 2024

  1. ruff formatting

    dimbleby committed Feb 14, 2024
    Copy the full SHA
    fea7af3 View commit details
  2. appease mypy

    dimbleby committed Feb 14, 2024
    Copy the full SHA
    c5fab7a View commit details

Commits on Feb 23, 2024

  1. Registering project with tea.

    jaraco authored Feb 23, 2024
    Copy the full SHA
    44feebc View commit details

Commits on Feb 24, 2024

  1. Correct the name of tea.yaml.

    jaraco authored Feb 24, 2024
    Copy the full SHA
    bb73eea View commit details

Commits on Feb 27, 2024

  1. Copy the full SHA
    e0015a4 View commit details
  2. Fix EncodingWarnings

    jaraco committed Feb 27, 2024
    Copy the full SHA
    4a7d496 View commit details
  3. Copy the full SHA
    b629d28 View commit details
  4. Replace the type returned by priority to be a 'Number'.

    I tried using numbers.Number or numbers.Integral, but mypy complained about f'{:g}' only accepting Union[float, int].
    jaraco committed Feb 27, 2024
    Copy the full SHA
    5c26af2 View commit details
  5. 🧎‍♀️ Genuflect to the types.

    Removed the type declarations from subtypes to satisfy a nitpicky and IMHO incorrect check. Closes #667.
    jaraco committed Feb 27, 2024
    Copy the full SHA
    c7d3d59 View commit details
  6. Copy the full SHA
    5c2c45d View commit details
  7. Merge pull request #666 from dimbleby/priority-typing

    simplify and fix typing of priority()
    jaraco authored Feb 27, 2024
    Copy the full SHA
    f34f4e4 View commit details
  8. Add news fragment.

    jaraco committed Feb 27, 2024
    Copy the full SHA
    558e2b3 View commit details
  9. Finalize

    jaraco committed Feb 27, 2024
    Copy the full SHA
    3727268 View commit details
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -7,3 +7,7 @@ disable_warnings =

[report]
show_missing = True
exclude_also =
# jaraco/skeleton#97
@overload
if TYPE_CHECKING:
57 changes: 25 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: tests

on: [push, pull_request]
on:
merge_group:
push:
branches-ignore:
# disabled for jaraco/skeleton#103
# - gh-readonly-queue/** # Temporary merge queue-related GH-made branches
pull_request:

permissions:
contents: read
@@ -36,61 +42,49 @@ jobs:
platform: ubuntu-latest
- python: "3.10"
platform: ubuntu-latest
- python: pypy3.9
- python: pypy3.10
platform: ubuntu-latest
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.python == '3.12' }}
continue-on-error: ${{ matrix.python == '3.13' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install tox
run: |
python -m pip install tox
run: python -m pip install tox
- name: Run
run: tox

diffcov:
collateral:
strategy:
fail-fast: false
matrix:
job:
- diffcov
- docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install tox
run: |
python -m pip install tox
- name: Evaluate coverage
run: tox
env:
TOXENV: diffcov

docs:
runs-on: ubuntu-latest
env:
TOXENV: docs
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
- name: Install tox
run: |
python -m pip install tox
- name: Run
run: tox
run: python -m pip install tox
- name: Eval ${{ matrix.job }}
run: tox -e ${{ matrix.job }}

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- test
- docs
- collateral

runs-on: ubuntu-latest

@@ -109,14 +103,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install tox
run: |
python -m pip install tox
run: python -m pip install tox
- name: Run
run: tox -e release
env:
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
hooks:
- id: black
- id: ruff
- id: ruff-format
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -7,6 +7,6 @@ python:

# required boilerplate readthedocs/readthedocs.org#10401
build:
os: ubuntu-22.04
os: ubuntu-lts-latest
tools:
python: "3"
python: latest
9 changes: 9 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v24.3.1
=======

Bugfixes
--------

- Minor fixes to account for emergent typing and linter concerns.


v24.3.0
=======

14 changes: 5 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
@@ -3,22 +3,18 @@

.. image:: https://img.shields.io/pypi/pyversions/keyring.svg

.. image:: https://github.com/jaraco/keyring/workflows/tests/badge.svg
.. image:: https://github.com/jaraco/keyring/actions/workflows/main.yml/badge.svg
:target: https://github.com/jaraco/keyring/actions?query=workflow%3A%22tests%22
:alt: tests

.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code style: Black

.. image:: https://readthedocs.org/projects/keyring/badge/?version=latest
:target: https://keyring.readthedocs.io/en/latest/?badge=latest

.. image:: https://img.shields.io/badge/skeleton-2023-informational
.. image:: https://img.shields.io/badge/skeleton-2024-informational
:target: https://blog.jaraco.com/skeleton

.. image:: https://tidelift.com/badges/package/pypi/keyring
@@ -176,9 +172,6 @@ use cases. Simply install them to make them available:

- `keyrings.cryptfile <https://pypi.org/project/keyrings.cryptfile>`_
- Encrypted text file storage.
- `keyring_jeepney <https://pypi.org/project/keyring_jeepney>`__ - a
pure Python backend using the secret service DBus API for desktop
Linux.
- `keyrings.alt <https://pypi.org/project/keyrings.alt>`_ - "alternate",
possibly-insecure backends, originally part of the core package, but
available for opt-in.
@@ -197,6 +190,9 @@ use cases. Simply install them to make them available:
- OSX keychain key-management, for private, public, and symmetric keys.
- `keyring_pass.PasswordStoreBackend <https://github.com/nazarewk/keyring_pass>`_
- Password Store (pass) backend for python's keyring
- `keyring_jeepney <https://pypi.org/project/keyring_jeepney>`__ - a
pure Python backend using the secret service DBus API for desktop
Linux (requires ``keyring<24``).


Write your own keyring backend
2 changes: 1 addition & 1 deletion keyring/_compat.py
Original file line number Diff line number Diff line change
@@ -4,4 +4,4 @@
try:
from jaraco.classes import properties # pragma: no-cover
except ImportError:
from . import _properties_compat as properties # pragma: no-cover
from . import _properties_compat as properties # type: ignore[no-redef] # pragma: no-cover
3 changes: 2 additions & 1 deletion keyring/backend.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Keyring implementation support
"""

from __future__ import annotations

import os
@@ -46,7 +47,7 @@ def __init__(self):
self.set_properties_from_env()

@properties.classproperty
def priority(self) -> typing.Union[int, float]:
def priority(self) -> float:
"""
Each backend class must supply a priority, a number (float or integer)
indicating the priority of the backend relative to all other backends.
2 changes: 1 addition & 1 deletion keyring/backends/SecretService.py
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ class Keyring(backend.SchemeSelectable, KeyringBackend):
appid = 'Python keyring library'

@properties.classproperty
def priority(cls) -> int:
def priority(cls) -> float:
with ExceptionRaisedContext() as exc:
secretstorage.__name__
if exc:
2 changes: 1 addition & 1 deletion keyring/backends/Windows.py
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ class WinVaultKeyring(KeyringBackend):
persist = Persistence()

@properties.classproperty
def priority(cls) -> int:
def priority(cls) -> float:
"""
If available, the preferred backend on Windows.
"""
3 changes: 2 additions & 1 deletion keyring/backends/chainer.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
Keyring Chainer - iterates over other viable backends to
discover passwords in each.
"""

from .. import backend
from .._compat import properties
from . import fail
@@ -18,7 +19,7 @@ class ChainerBackend(backend.KeyringBackend):
viable = True

@properties.classproperty
def priority(cls) -> int:
def priority(cls) -> float:
"""
If there are backends to chain, high priority
Otherwise very low priority since our operation when empty
2 changes: 1 addition & 1 deletion keyring/backends/fail.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ class Keyring(KeyringBackend):
"""

@properties.classproperty
def priority(cls) -> int:
def priority(cls) -> float:
return 0

def get_password(self, service, username, password=None):
2 changes: 1 addition & 1 deletion keyring/backends/libsecret.py
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ def schema(self):
),
)

@properties.NonDataProperty
@properties.NonDataProperty # type: ignore
def collection(self):
return Secret.COLLECTION_DEFAULT

6 changes: 3 additions & 3 deletions keyring/backends/macOS/api.py
Original file line number Diff line number Diff line change
@@ -82,9 +82,9 @@ def create_query(**kwargs):
return CFDictionaryCreate(
None,
(c_void_p * len(kwargs))(*[k_(k) for k in kwargs.keys()]),
(c_void_p * len(kwargs))(
*[create_cfstr(v) if isinstance(v, str) else v for v in kwargs.values()]
),
(c_void_p * len(kwargs))(*[
create_cfstr(v) if isinstance(v, str) else v for v in kwargs.values()
]),
len(kwargs),
_found.kCFTypeDictionaryKeyCallBacks,
_found.kCFTypeDictionaryValueCallBacks,
2 changes: 1 addition & 1 deletion keyring/backends/null.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ class Keyring(KeyringBackend):
"""

@properties.classproperty
def priority(cls) -> int:
def priority(cls) -> float:
return -1

def get_password(self, service, username, password=None):
12 changes: 9 additions & 3 deletions keyring/cli.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
"""Simple command line interface to get/set password from a keyring"""

import getpass
@@ -134,8 +133,15 @@ def pass_from_pipe(cls):

@staticmethod
def strip_last_newline(str):
"""Strip one last newline, if present."""
return str[: -str.endswith('\n')]
r"""Strip one last newline, if present.
>>> CommandLineTool.strip_last_newline('foo')
'foo'
>>> CommandLineTool.strip_last_newline('foo\n')
'foo'
"""
slc = slice(-1 if str.endswith('\n') else None)
return str[slc]


def main(argv=None):
8 changes: 6 additions & 2 deletions keyring/completion.py
Original file line number Diff line number Diff line change
@@ -36,8 +36,12 @@ def get_action(parser, option):

def install_completion(parser):
preamble = dict(
bash=files(__package__).joinpath('backend_complete.bash').read_text(),
zsh=files(__package__).joinpath('backend_complete.zsh').read_text(),
bash=files(__package__)
.joinpath('backend_complete.bash')
.read_text(encoding='utf-8'),
zsh=files(__package__)
.joinpath('backend_complete.zsh')
.read_text(encoding='utf-8'),
)
shtab.add_argument_to(parser, preamble=preamble)
get_action(parser, '--keyring-path').complete = shtab.DIR
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -2,7 +2,4 @@
requires = ["setuptools>=56", "setuptools_scm[toml]>=3.4.1"]
build-backend = "setuptools.build_meta"

[tool.black]
skip-string-normalization = true

[tool.setuptools_scm]
11 changes: 3 additions & 8 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -7,14 +7,6 @@ filterwarnings=
# Ensure ResourceWarnings are emitted
default::ResourceWarning

# shopkeep/pytest-black#55
ignore:<class 'pytest_black.BlackItem'> is not using a cooperative constructor:pytest.PytestDeprecationWarning
ignore:The \(fspath. py.path.local\) argument to BlackItem is deprecated.:pytest.PytestDeprecationWarning
ignore:BlackItem is an Item subclass and should not be a collector:pytest.PytestWarning

# shopkeep/pytest-black#67
ignore:'encoding' argument not specified::pytest_black

# realpython/pytest-mypy#152
ignore:'encoding' argument not specified::pytest_mypy

@@ -24,4 +16,7 @@ filterwarnings=
# pypa/build#615
ignore:'encoding' argument not specified::build.env

# dateutil/dateutil#1284
ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning:dateutil.tz.tz

## end upstream
24 changes: 24 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[lint]
ignore = [
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
"E114",
"E117",
"D206",
"D300",
"Q000",
"Q001",
"Q002",
"Q003",
"COM812",
"COM819",
"ISC001",
"ISC002",
]

[format]
# Enable preview, required for quote-style = "preserve"
preview = true
# https://docs.astral.sh/ruff/settings/#format-quote-style
quote-style = "preserve"
Loading