Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-confuse for openSUSE:Factory
checked in at 2026-11-26 15:55:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-confuse (Old)
and /work/SRC/openSUSE:Factory/.python-confuse.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-confuse"
Thu Nov 26 15:55:31 2026 rev:6 rq:1400846 version:2.3.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-confuse/python-confuse.changes
2026-03-27 06:47:44.297598125 +0100
+++
/work/SRC/openSUSE:Factory/.python-confuse.new.1340718/python-confuse.changes
2026-11-26 15:57:13.531460945 +0100
@@ -1,0 +2,22 @@
+Mon Nov 9 15:44:23 UTC 2026 - Danilo Spinella <[email protected]>
+
+- Update to 2.3.1:
+ * Return None for empty strings in as_optional_path(), while
+ preserving support for bytes paths and filename validation
+ errors for invalid types.
+- Update to 2.3.0:
+ * Add an as_optional_path accessor for optional path
+ configuration values.
+- Update to 2.2.1:
+ * Require typing_extensions on older Python versions (and use
+ typing on newer versions).
+ * Narrow Path template shorthand handling to concrete
+ pathlib.Path values for more accurate type checking.
+ * Fix confuse.Path which now points to confuse.templates.Path
+ instead of pathlib.Path.
+- Run the test suite with pytest, which the upstream tests are
+ written for
+- Describe the package in its description instead of repeating the
+ summary
+
+-------------------------------------------------------------------
Old:
----
confuse-2.2.0.tar.gz
New:
----
confuse-2.3.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-confuse.spec ++++++
--- /var/tmp/diff_new_pack.PVEVj4/_old 2026-11-26 15:57:14.268492174 +0100
+++ /var/tmp/diff_new_pack.PVEVj4/_new 2026-11-26 15:57:14.270492259 +0100
@@ -16,27 +16,32 @@
#
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-confuse
-Version: 2.2.0
+Version: 2.3.1
Release: 0
Summary: Painless YAML configuration
License: MIT
URL: https://github.com/beetbox/confuse
Source:
https://github.com/beetbox/confuse/archive/refs/tags/v%{version}.tar.gz#/confuse-%{version}.tar.gz
BuildRequires: %{python_module PyYAML}
+BuildRequires: %{python_module packaging}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module poetry-core}
-BuildRequires: %{python_module typing-extensions}
+# the test suite imports pytest (pytest.raises) in most modules
BuildRequires: %{python_module pytest}
+BuildRequires: %{python_module typing-extensions}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-PyYAML
+# upstream pyproject.toml asks for typing_extensions only for python_version <
3.13
+Requires: (python-typing_extensions >= 4.4 if python-base < 3.13)
BuildArch: noarch
%python_subpackages
%description
-Painless YAML configuration.
+Confuse is a configuration library for Python that reads YAML files. It handles
+defaults, overrides, type checking, command-line and environment variable
+integration, and standard OS-specific configuration locations.
%prep
%setup -q -n confuse-%{version}
@@ -49,7 +54,8 @@
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
-%pyunittest -v
+# upstream tests are written for pytest (pytest.raises with match=)
+%pytest -v
%files %{python_files}
%doc README.rst
++++++ confuse-2.2.0.tar.gz -> confuse-2.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/.github/workflows/main.yml
new/confuse-2.3.1/.github/workflows/main.yml
--- old/confuse-2.2.0/.github/workflows/main.yml 2026-01-28
11:39:36.000000000 +0100
+++ new/confuse-2.3.1/.github/workflows/main.yml 2026-11-01
15:20:22.000000000 +0100
@@ -27,9 +27,16 @@
python-version: ${{ matrix.python-version }}
cache: poetry
+ - name: Install system dependencies on Ubuntu
+ if: matrix.platform == 'ubuntu-latest'
+ run: |
+ sudo apt update
+ sudo apt install --yes --no-install-recommends pandoc
+
- name: Test
run: |-
- poetry install
+ poetry install --extras=docs
+ poe docs
poe test-with-coverage
- name: Upload test results to Codecov
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/.github/workflows/make_release.yaml
new/confuse-2.3.1/.github/workflows/make_release.yaml
--- old/confuse-2.2.0/.github/workflows/make_release.yaml 2026-01-28
11:39:36.000000000 +0100
+++ new/confuse-2.3.1/.github/workflows/make_release.yaml 2026-11-01
15:20:22.000000000 +0100
@@ -6,6 +6,7 @@
version:
description: 'Version of the new release, just as a number with no
prepended "v"'
required: true
+ type: string
env:
PYTHON_VERSION: "3.10"
@@ -17,7 +18,18 @@
name: Bump version, commit and create tag
runs-on: ubuntu-latest
steps:
+ - name: Generate release app token
+ id: release-token
+ uses: actions/create-github-app-token@v2
+ with:
+ app-id: ${{ vars.RELEASE_APP_ID }}
+ private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
+ owner: ${{ github.repository_owner }}
+ repositories: ${{ github.event.repository.name }}
+
- uses: actions/checkout@v6
+ with:
+ token: ${{ steps.release-token.outputs.token }}
- name: Install Python tools
uses: BrandonLWhite/[email protected]
- uses: actions/setup-python@v6
@@ -25,8 +37,11 @@
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
+ - name: Install dependencies
+ run: poetry install --with=release --extras=docs
+
- name: Bump project version
- run: poetry version "${{ env.NEW_VERSION }}"
+ run: poe bump "${{ env.NEW_VERSION }}"
- uses: EndBug/add-and-commit@v9
id: commit_and_tag
@@ -36,9 +51,11 @@
tag: "${{ env.NEW_TAG }} --force"
build:
- name: Build the distribution package
+ name: Get changelog and build the distribution package
runs-on: ubuntu-latest
needs: increment-version
+ outputs:
+ changelog: ${{ steps.generate_changelog.outputs.changelog }}
steps:
- uses: actions/checkout@v6
with:
@@ -51,6 +68,22 @@
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
+ - name: Install dependencies
+ run: poetry install --with=release --extras=docs
+
+ - name: Install pandoc
+ run: sudo apt update && sudo apt install pandoc -y
+
+ - name: Obtain the changelog
+ id: generate_changelog
+ run: |
+ poe docs
+ {
+ echo 'changelog<<EOF'
+ poe --quiet changelog
+ echo EOF
+ } >> "$GITHUB_OUTPUT"
+
- name: Build a binary wheel and a source tarball
run: poetry build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/confuse/__init__.py
new/confuse-2.3.1/confuse/__init__.py
--- old/confuse-2.2.0/confuse/__init__.py 2026-01-28 11:39:36.000000000
+0100
+++ new/confuse-2.3.1/confuse/__init__.py 2026-11-01 15:20:22.000000000
+0100
@@ -4,5 +4,9 @@
from .exceptions import * # noqa: F403
from .sources import * # noqa: F403
from .templates import * # noqa: F403
+from .templates import Path as Path
from .util import * # type: ignore[no-redef] # noqa: F403
from .yaml_util import * # noqa: F403
+
+__version__ = "2.3.1"
+__author__ = "Adrian Sampson <[email protected]>"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/confuse/core.py
new/confuse-2.3.1/confuse/core.py
--- old/confuse-2.2.0/confuse/core.py 2026-01-28 11:39:36.000000000 +0100
+++ new/confuse-2.3.1/confuse/core.py 2026-11-01 15:20:22.000000000 +0100
@@ -30,11 +30,16 @@
import errno
import os
+import sys
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, TypeVar, overload
+if sys.version_info < (3, 11):
+ from typing_extensions import Self
+else:
+ from typing import Self
+
import yaml
-from typing_extensions import Self
from . import templates, util, yaml_util
from .exceptions import ConfigError, ConfigTypeError, NotFoundError
@@ -326,6 +331,16 @@
"""Get the value as a `pathlib.Path` object. Equivalent to
`get(Path())`."""
return self.get(templates.Path())
+ def as_optional_path(self) -> Path | None:
+ """Get the value as a `pathlib.Path` object or `None`.
+
+ If the value is an empty string or `None`, then `None` is returned.
+ """
+ if self.get(templates.Template(default=None)) == "":
+ return None
+
+ return self.get(templates.Optional(templates.Path()))
+
def as_choice(self, choices: Sequence[R] | dict[str, R] | type[R]) -> R:
"""Get the value from a list of choices. Equivalent to
`get(Choice(choices))`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/confuse/templates.py
new/confuse-2.3.1/confuse/templates.py
--- old/confuse-2.2.0/confuse/templates.py 2026-01-28 11:39:36.000000000
+0100
+++ new/confuse-2.3.1/confuse/templates.py 2026-11-01 15:20:22.000000000
+0100
@@ -4,12 +4,16 @@
import os
import pathlib
import re
+import sys
from collections import abc
from collections.abc import Hashable, Iterable, Mapping
from functools import singledispatchmethod
from typing import TYPE_CHECKING, Any, Generic, NoReturn, overload
-from typing_extensions import TypeVar
+if sys.version_info < (3, 13):
+ from typing_extensions import TypeVar
+else:
+ from typing import TypeVar
from . import exceptions, util
@@ -20,7 +24,7 @@
T = TypeVar("T")
T_co = TypeVar("T_co", covariant=True)
K = TypeVar("K", bound=Hashable, default=str)
-P = TypeVar("P", bound=pathlib.PurePath | str, default=str)
+P = TypeVar("P", bound=pathlib.Path | str, default=str)
V = TypeVar("V", default=object)
ConfigKey = int | str | bytes
ConfigKeyT = TypeVar("ConfigKeyT", bound=ConfigKey, default=str)
@@ -734,7 +738,7 @@
return os.path.abspath(path_str)
-class Path(Filename[pathlib.PurePath]):
+class Path(Filename[pathlib.Path]):
"""A template that validates strings as `pathlib.Path` objects.
Filenames are parsed equivalent to the `Filename` template and then
@@ -859,7 +863,7 @@
@overload
def as_template(value: list[T]) -> OneOf[T]: ...
@overload
-def as_template(value: pathlib.PurePath) -> Path: ...
+def as_template(value: pathlib.Path) -> Path: ...
@overload
def as_template(value: None) -> Template[None]: ...
@overload
@@ -893,7 +897,7 @@
return Number()
elif isinstance(value, float):
return Number(value)
- elif isinstance(value, pathlib.PurePath):
+ elif isinstance(value, pathlib.Path):
return Path(value)
elif value is None:
return Template(None)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/docs/changelog.rst
new/confuse-2.3.1/docs/changelog.rst
--- old/confuse-2.2.0/docs/changelog.rst 2026-01-28 11:39:36.000000000
+0100
+++ new/confuse-2.3.1/docs/changelog.rst 2026-11-01 15:20:22.000000000
+0100
@@ -1,103 +1,219 @@
Changelog
=========
-v2.2.0
-------
+Changelog goes here! Please add your entry to the bottom of one of the lists
+below!
-- Drop support for Python 3.9.
-- Ship inline type information via a `py.typed` marker for type checkers.
+.. Uncomment the relevant section when you add the first entry
+
+Unreleased
+----------
+
+..
+ New features
+ ~~~~~~~~~~~~
+
+..
+ Bug fixes
+ ~~~~~~~~~
+
+..
+ For plugin developers
+ ~~~~~~~~~~~~~~~~~~~~~
+
+..
+ Other changes
+ ~~~~~~~~~~~~~
+
+2.3.1 (November 01, 2026)
+-------------------------
+
+Bug fixes
+~~~~~~~~~
+
+- Return ``None`` for empty strings in ``as_optional_path()``, while preserving
+ support for bytes paths and filename validation errors for invalid types.
+
+2.3.0 (September 22, 2026)
+--------------------------
+
+- Add an ``as_optional_path`` accessor for optional path configuration values.
+
+2.2.1 (January 28, 2026)
+------------------------
+
+- Narrow ``Path`` template shorthand handling to concrete ``pathlib.Path``
+ values for more accurate type checking.
+- Fix ``confuse.Path`` which now points to ``confuse.templates.Path`` instead
of
+ ``pathlib.Path``.
+
+Other changes
+~~~~~~~~~~~~~
+
+- Require ``typing_extensions`` on older Python versions (and use ``typing`` on
+ newer versions). [#189](https://github.com/beetbox/confuse/issues/189)
+
+2.2.0 (January 28, 2026)
+------------------------
+
+New features
+~~~~~~~~~~~~
+
+- Ship inline type information via a ``py.typed`` marker for type checkers.
- Tighten and extend type hints across the public API, templates, and sources.
+
+Other changes
+~~~~~~~~~~~~~
+
+- Drop support for Python 3.9.
- Add strict mypy configuration and align tests/examples with the new typing.
-- Include `docs` and `tests` directory in source distributions.
+- Include ``docs`` and ``tests`` directory in source distributions.
+
+2.1.0 (October 27, 2025)
+------------------------
+
+New features
+~~~~~~~~~~~~
+
+- Added typehints to ``as_*`` functions which allows for enhanced type checking
+ and IDE support.
-v2.1.0
-------
+Other changes
+~~~~~~~~~~~~~
- Drop support for versions of Python below 3.9.
- Removed 'u' prefix from string literals for Python 3.0+ compatibility.
- Removed a number of python 2 leftovers.
-- Removed deprecated `pkgutil.get_loader` usage in favor of
- `importlib..util.find_spec` for better compatibility with modern Python
+- Removed deprecated ``pkgutil.get_loader`` usage in favor of
+ ``importlib.util.find_spec`` for better compatibility with modern Python
versions.
-- Added typehints to `as_*` functions which allows for enhanced type checking
- and IDE support.
- Added a minimal release workflow for GitHub Actions to automate the release
process.
- Added support for Python 3.13 and Python 3.14.
- Modernized package and tests setup.
-v2.0.1
-------
+2.0.1 (April 01, 2023)
+----------------------
+
+Other changes
+~~~~~~~~~~~~~
-- Remove a `<4` Python version requirement bound.
+- Remove a ``<4`` Python version requirement bound.
-v2.0.0
-------
+2.0.0 (July 16, 2022)
+---------------------
+
+Other changes
+~~~~~~~~~~~~~
- Drop support for versions of Python below 3.6.
-v1.7.0
-------
+1.7.0 (November 27, 2021)
+-------------------------
+
+New features
+~~~~~~~~~~~~
- Add support for reading configuration values from environment variables (see
- `EnvSource`).
+ ``EnvSource``).
+
+Bug fixes
+~~~~~~~~~
+
- Resolve a possible race condition when creating configuration directories.
-v1.6.0
-------
+1.6.0 (September 26, 2021)
+--------------------------
+
+New features
+~~~~~~~~~~~~
-- A new `Configuration.reload` method makes it convenient to reload and
re-parse
- all YAML files from the file system.
+- A new ``Configuration.reload`` method makes it convenient to reload and
+ re-parse all YAML files from the file system.
-v1.5.0
-------
+1.5.0 (June 28, 2021)
+---------------------
-- A new `MappingValues` template behaves like `Sequence` but for mappings with
- arbitrary keys.
-- A new `Optional` template allows other templates to be null.
-- `Filename` templates now have an option to resolve relative to a specific
+New features
+~~~~~~~~~~~~
+
+- A new ``MappingValues`` template behaves like ``Sequence`` but for mappings
+ with arbitrary keys.
+- A new ``Optional`` template allows other templates to be null.
+- ``Filename`` templates now have an option to resolve relative to a specific
directory. Also, configuration sources now have a corresponding global option
to resolve relative to the base configuration directory instead of the
location of the specific configuration file.
-- There is a better error message for `Sequence` templates when the data from
+
+Bug fixes
+~~~~~~~~~
+
+- There is a better error message for ``Sequence`` templates when the data from
the configuration is not a sequence.
-v1.4.0
-------
+1.4.0 (November 21, 2020)
+-------------------------
+
+Bug fixes
+~~~~~~~~~
+
+- ``pathlib.PurePath`` objects can now be converted to ``Path`` templates.
+- ``AttrDict`` now properly supports (over)writing attributes via dot notation.
+
+1.3.0 (June 27, 2020)
+---------------------
-- `pathlib.PurePath` objects can now be converted to `Path` templates.
-- `AttrDict` now properly supports (over)writing attributes via dot notation.
+New features
+~~~~~~~~~~~~
-v1.3.0
-------
+- When using ``None`` as a template, the result is a value whose default is
+ ``None``. Previously, this was equivalent to leaving the key off entirely,
+ i.e., a template with no default. To get the same effect now, use
+ ``confuse.REQUIRED`` in the template.
-- Break up the `confuse` module into a package. (All names should still be
- importable from `confuse`.)
-- When using `None` as a template, the result is a value whose default is
- `None`. Previously, this was equivalent to leaving the key off entirely,
i.e.,
- a template with no default. To get the same effect now, use
`confuse.REQUIRED`
- in the template.
-
-v1.2.0
-------
-
-- `float` values (like ``4.2``) can now be used in templates (just like ``42``
- works as an `int` template).
-- The `Filename` and `Path` templates now correctly accept default values.
-- It's now possible to provide custom PyYAML `Loader` objects for parsing
config
- files.
+Other changes
+~~~~~~~~~~~~~
-v1.1.0
-------
+- Break up the ``confuse`` module into a package. (All names should still be
+ importable from ``confuse``.)
+
+1.2.0 (June 26, 2020)
+---------------------
+
+New features
+~~~~~~~~~~~~
+
+- ``float`` values (like ``4.2``) can now be used in templates (just like
``42``
+ works as an ``int`` template).
+- It's now possible to provide custom PyYAML ``Loader`` objects for parsing
+ config files.
+
+Bug fixes
+~~~~~~~~~
+
+- The ``Filename`` and ``Path`` templates now correctly accept default values.
+
+1.1.0 (April 08, 2020)
+----------------------
+
+New features
+~~~~~~~~~~~~
- A new ``Path`` template produces a pathlib_ Path object.
-- Drop support for Python 3.4 (following in the footsteps of PyYAML).
- String templates support environment variable expansion.
+Other changes
+~~~~~~~~~~~~~
+
+- Drop support for Python 3.4 (following in the footsteps of PyYAML).
+
.. _pathlib: https://docs.python.org/3/library/pathlib.html
-v1.0.0
-------
+1.0.0 (May 30, 2019)
+--------------------
+
+Other changes
+~~~~~~~~~~~~~
The first stable release, and the first that beets_ depends on externally.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/docs/conf.py
new/confuse-2.3.1/docs/conf.py
--- old/confuse-2.2.0/docs/conf.py 2026-01-28 11:39:36.000000000 +0100
+++ new/confuse-2.3.1/docs/conf.py 2026-11-01 15:20:22.000000000 +0100
@@ -1,16 +1,9 @@
import datetime as dt
import os
-import re
import sys
-from pathlib import Path
-MATCH_VERSION_LINE = re.compile(r"version = \W((\d+\.\d+)\.\d.*?)\W").fullmatch
-
-pyproject = Path(__file__).parent.parent / "pyproject.toml"
-version_line_match = next(
- filter(None, map(MATCH_VERSION_LINE, pyproject.read_text().splitlines()))
-)
-release, version = version_line_match.groups()
+version = "2.3"
+release = "2.3.1"
sys.path.insert(0, os.path.abspath(".."))
@@ -18,7 +11,6 @@
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
- "sphinx.ext.autosectionlabel",
"sphinx_rtd_theme",
]
source_suffix = ".rst"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/docs/examples.rst
new/confuse-2.3.1/docs/examples.rst
--- old/confuse-2.2.0/docs/examples.rst 2026-01-28 11:39:36.000000000 +0100
+++ new/confuse-2.3.1/docs/examples.rst 2026-11-01 15:20:22.000000000 +0100
@@ -209,6 +209,8 @@
... print(err)
categories.no_description.description not found
+.. _filename-template:
+
Filename
--------
@@ -253,7 +255,7 @@
- ``log``: a filename that follows the default ``Filename`` template behavior
The initial user config file will be at ``~/.config/ExampleApp/config.yaml``,
-where it will be discovered automatically using the :ref:`Search Paths`, and
has
+where it will be discovered automatically using the :ref:`search-paths`, and
has
the following contents:
.. code-block:: yaml
@@ -469,13 +471,13 @@
... return sys.stderr
... return output
>>> config = confuse.RootView([])
->>> config.set({"log": "/tmp/log.txt"}) # `log` set to a filename
+>>> config.set({"log": "/tmp/log.txt"}) # ``log`` set to a filename
>>> get_log_output(config)
'/tmp/log.txt'
->>> config.set({"log": None}) # `log` set to None (ie, null in YAML)
+>>> config.set({"log": None}) # ``log`` set to None (ie, null in YAML)
>>> get_log_output(config)
<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>
->>> config.clear() # Clear config so that `log` is missing
+>>> config.clear() # Clear config so that ``log`` is missing
>>> get_log_output(config)
<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>
@@ -510,10 +512,10 @@
... if output is None:
... return sys.stderr
... return output
->>> config.set({"log": None}) # `log` set to None is still OK...
+>>> config.set({"log": None}) # ``log`` set to None is still OK...
>>> get_log_output_no_missing(config)
<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>
->>> config.clear() # but `log` missing now raises an error
+>>> config.clear() # but ``log`` missing now raises an error
>>> try:
... get_log_output_no_missing(config)
... except confuse.ConfigError as err:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/docs/usage.rst
new/confuse-2.3.1/docs/usage.rst
--- old/confuse-2.2.0/docs/usage.rst 2026-01-28 11:39:36.000000000 +0100
+++ new/confuse-2.3.1/docs/usage.rst 2026-11-01 15:20:22.000000000 +0100
@@ -17,7 +17,7 @@
The first parameter is required; it's the name of your application, which will
be used to search the system for a config file named ``config.yaml``. See
-:ref:`Search Paths` for the specific locations searched.
+:ref:`search-paths` for the specific locations searched.
The second parameter is optional: it's the name of a module that will guide the
search for a *defaults* file. Use this if you want to include a
@@ -93,7 +93,7 @@
configuration at once. However, this will return only the
*highest-priority*
configuration source, masking any lower-priority values for keys that are
not present in the top source. This pitfall is especially likely when using
- :ref:`Command-Line Options` or :ref:`Environment Variables`, which may
place
+ :ref:`command-line-options` or :ref:`environment-variables`, which may
place
an empty configuration at the top of the stack. A subsequent call to
``config.get()`` might then return no configuration at all.
@@ -112,11 +112,11 @@
default the filename is relative to the application's config directory
(``Configuration.config_dir()``, as described below). However, if the config
file was loaded with the ``base_for_paths`` parameter set to ``True`` (see
- :ref:`Manually Specifying Config Files`), then a relative path refers to the
+ :ref:`manually-specifying-config-files`), then a relative path refers to the
directory containing the config file. A relative path from any other source
(e.g., command-line options) is relative to the working directory. For full
control over relative path resolution, use the ``Filename`` template directly
- (see :ref:`Filename`).
+ (see :ref:`filename-template`).
- ``as_choice(choices)``: Check that a value is one of the provided choices.
The
argument should be a sequence of possible values. If the sequence is a
``dict``, then this method returns the associated value instead of the key.
@@ -138,6 +138,8 @@
``config['direction'].as_choice(['up', 'down'])`` will raise a
``ConfigValueError`` unless the ``direction`` value is either "up" or "down".
+.. _command-line-options:
+
Command-Line Options
--------------------
@@ -181,7 +183,7 @@
This will allow the user to override the configured value for key ``foo`` by
passing ``--foo <something>`` on the command line.
-Overriding nested values can be accomplished by passing `dots=True` and have
+Overriding nested values can be accomplished by passing ``dots=True`` and have
dot-delimited properties on the incoming object.
.. code-block:: python
@@ -191,7 +193,7 @@
config.set_args(args, dots=True)
print(config["foo"]["bar"].get())
-`set_args` works with generic dictionaries too.
+``set_args`` works with generic dictionaries too.
.. code-block:: python
@@ -212,6 +214,8 @@
unspecified command-line switches. Otherwise, the argparse/optparse default
value will hide options configured elsewhere.
+.. _environment-variables:
+
Environment Variables
---------------------
@@ -306,6 +310,8 @@
variables, the order of calls to ``set_args`` and ``set_env`` will determine
the
precedence, with the last call having the highest precedence.
+.. _search-paths:
+
Search Paths
------------
@@ -319,8 +325,8 @@
- macOS: ``~/.config/app`` and ``~/Library/Application Support/app``
- Other Unix: ``~/.config/app`` and ``/etc/app``
-- Windows: ``%APPDATA%\app`` where the `APPDATA` environment variable falls
back
- to ``%HOME%\AppData\Roaming`` if undefined
+- Windows: ``%APPDATA%\app`` where the ``APPDATA`` environment variable falls
+ back to ``%HOME%\AppData\Roaming`` if undefined
Both macOS and other Unix operating sytems also try to use the
``XDG_CONFIG_HOME`` and ``XDG_CONFIG_DIRS`` environment variables if set then
@@ -331,10 +337,12 @@
appended: for an application named ``AppName``, the environment variable is
``APPNAMEDIR``.
+.. _manually-specifying-config-files:
+
Manually Specifying Config Files
--------------------------------
-You may want to leverage Confuse's features without :ref:`Search Paths`. This
+You may want to leverage Confuse's features without :ref:`search-paths`. This
can be done by manually specifying the YAML files you want to include, which
also allows changing how relative paths in the file will be resolved:
@@ -349,7 +357,7 @@
config.set_file("subdirectory/default_config.yaml")
# Add config items from a second file. If some items were already defined,
# they will be overwritten (new file precedes the previous ones). With
- # `base_for_paths` set to True, relative path values in this file will be
+ # ``base_for_paths`` set to True, relative path values in this file will be
# resolved relative to the config file's directory (i.e., 'subdirectory').
config.set_file("subdirectory/local_config.yaml", base_for_paths=True)
@@ -431,15 +439,15 @@
Custom YAML Loaders
~~~~~~~~~~~~~~~~~~~
-You can also specify your own PyYAML_ `Loader` object to parse YAML files.
-Supply the `loader` parameter to a `Configuration` constructor, like this:
+You can also specify your own PyYAML_ ``Loader`` object to parse YAML files.
+Supply the ``loader`` parameter to a ``Configuration`` constructor, like this:
.. code-block:: python
config = confuse.Configuration("name", loader=yaml.Loaded)
To imbue a loader with Confuse's special parser overrides, use its
-`add_constructors` method:
+``add_constructors`` method:
.. code-block:: python
@@ -459,7 +467,7 @@
signatures with dozens of keyword arguments, decreasing code legibility and
testability.
-In such systems, one option is to pass a single `Configuration` object through
+In such systems, one option is to pass a single ``Configuration`` object
through
to each component. To avoid even this, however, it's sometimes appropriate to
use a little bit of shared global state. As evil as shared global state usually
is, configuration is (in my opinion) one valid use: since configuration is
@@ -470,7 +478,7 @@
To use global configuration, consider creating a configuration object in a
well-known module (say, the root of a package). But since this object will be
-initialized at module load time, Confuse provides a `LazyConfig` object that
+initialized at module load time, Confuse provides a ``LazyConfig`` object that
loads your configuration files on demand instead of when the object is
constructed. (Doing complicated stuff like parsing YAML at module load time is
generally considered a Bad Idea.)
@@ -498,7 +506,7 @@
---------
You can also mark certain configuration values as "sensitive" and avoid
-including them in output. Just set the `redact` flag:
+including them in output. Just set the ``redact`` flag:
.. code-block:: python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/extra/release.py
new/confuse-2.3.1/extra/release.py
--- old/confuse-2.2.0/extra/release.py 1970-01-01 01:00:00.000000000 +0100
+++ new/confuse-2.3.1/extra/release.py 2026-11-01 15:20:22.000000000 +0100
@@ -0,0 +1,281 @@
+#!/usr/bin/env python3
+
+"""A utility script for automating the beetbox package release process."""
+
+from __future__ import annotations
+
+import re
+import subprocess
+from collections.abc import Callable
+from contextlib import redirect_stdout
+from datetime import datetime, timezone
+from functools import partial
+from io import StringIO
+from pathlib import Path
+from typing import NamedTuple, TypeAlias
+
+import click
+import tomli
+from packaging.version import Version, parse
+from sphinx.ext import intersphinx
+
+from docs import conf
+
+BASE = Path(__file__).parent.parent.absolute()
+PYPROJECT = BASE / "pyproject.toml"
+with PYPROJECT.open("rb") as f:
+ PYPROJECT_CONTENTS = tomli.load(f)
+CHANGELOG = BASE / "docs" / "changelog.rst"
+PACKAGE_NAME = PYPROJECT_CONTENTS["project"]["name"]
+
+VERSION_HEADER = r"\d+\.\d+\.\d+ \([^)]+\)"
+RST_LATEST_CHANGES = re.compile(
+ rf"{VERSION_HEADER}\n--+\s+(.+?)\n\n+{VERSION_HEADER}", re.DOTALL
+)
+HEADING_NAMES = ["New features", "Bug fixes", "For plugin developers", "Other
changes"]
+HEADINGS = [f"..\n {name}\n {'~' * len(name)}\n" for name in
HEADING_NAMES]
+
+Replacement: TypeAlias = "tuple[str, str | Callable[[re.Match[str]], str]]"
+
+
+class Ref(NamedTuple):
+ """A reference to documentation with ID, path, and optional title."""
+
+ id: str
+ path: str | None
+ title: str | None
+
+ @classmethod
+ def from_line(cls, line: str) -> Ref:
+ """Create Ref from a Sphinx objects.inv line.
+
+ Each line has the following structure:
+ <id> [optional title : ] <relative-url-path>
+
+ See the output of
+ python -m sphinx.ext.intersphinx docs/_build/html/objects.inv
+ """
+ if len(line_parts := line.split(" ", 1)) == 1:
+ return cls(line, None, None)
+
+ id_, path_with_name = line_parts
+ parts = [p.strip() for p in path_with_name.split(":", 1)]
+
+ if len(parts) == 1:
+ path, name = parts[0], None
+ else:
+ name, path = parts
+
+ return cls(id_, path, name)
+
+ @property
+ def url(self) -> str:
+ """Full documentation URL."""
+ return f"https://{PACKAGE_NAME}.readthedocs.io/en/stable/{self.path}"
+
+ @property
+ def name(self) -> str:
+ """Display name (title if available, otherwise ID)."""
+ return self.title or self.id
+
+
+def get_refs() -> dict[str, Ref]:
+ """Parse Sphinx objects.inv and return dict of documentation references."""
+ objects_filepath = Path("docs/_build/html/objects.inv")
+ if not objects_filepath.exists():
+ raise ValueError("Documentation does not exist. Run 'poe docs' first.")
+
+ captured_output = StringIO()
+
+ with redirect_stdout(captured_output):
+ intersphinx.inspect_main([str(objects_filepath)])
+
+ lines = captured_output.getvalue().replace("\t", " ").splitlines()
+ return {
+ r.id: r
+ for ln in lines
+ if ln.startswith(" ") and (r := Ref.from_line(ln.strip()))
+ }
+
+
+def create_rst_replacements() -> list[Replacement]:
+ """Generate list of pattern replacements for RST changelog."""
+ refs = get_refs()
+
+ def make_ref_link(ref_id: str, name: str | None = None) -> str:
+ if ref_id.endswith("-cmd"):
+ name = f"{ref_id.removesuffix('-cmd')} command"
+ try:
+ ref = refs[ref_id]
+ except KeyError:
+ return f"``{name or ref_id}``"
+ else:
+ return rf"`{name or ref.name} <{ref.url}>`_"
+
+ explicit_replacements = dict(
+ line.removeprefix(".. ").split(" replace:: ")
+ for line in filter(None, getattr(conf, "rst_epilog", "").splitlines())
+ )
+ replacements: list[Replacement] = [
+ # Replace explicitly defined substitutions from rst_epilog
+ # |MyClass| -> :class:`some.module.MyClass`
+ (r"\|\w[^ ]*\|", lambda m: explicit_replacements.get(m[0], m[0])),
+ # Replace Sphinx directives by documentation URLs, e.g.,
+ # :ref:`/plugins/autobpm` -> [AutoBPM
Plugin](DOCS/plugins/autobpm.html) # noqa: E501
+ # :ref:`list-cmd` -> [list command](DOCS/reference/cli.html#list-cmd)
+ (
+ r":(?:ref|doc|class|conf):`+~?(?:([^`<]+)<)?/?([\w.:/_-]+)>?`+",
+ lambda m: make_ref_link(m[2], m[1]),
+ ),
+ # Convert bug references to GitHub issue links
+ (r":bug:`(\d+)`", r":bug: (#\1)"),
+ # Convert user references to GitHub @mentions
+ (r":user:`(\w+)`", r"\@\1"),
+ ]
+ if commands := "|".join(r.split("-")[0] for r in refs if
r.endswith("-cmd")):
+ replacements.append(
+ (
+ # Convert command references to documentation URLs
+ # `beet move` or `move` command -> [move
command](DOCS/reference/cli.html#move-cmd) # noqa: E501
+ rf"`+beet ({commands})`+|`+({commands})`+(?= command)",
+ lambda m: make_ref_link(f"{m[1] or m[2]}-cmd"),
+ )
+ )
+ if plugins := "|".join(r.split("/")[-1] for r in refs if
r.startswith("plugins/")):
+ replacements.append(
+ # Convert plugin references to documentation URLs
+ # `fetchart` plugin -> [fetchart](DOCS/plugins/fetchart.html)
+ (rf"`+({plugins})`+", lambda m: make_ref_link(f"plugins/{m[1]}")),
+ )
+
+ return replacements
+
+
+order_bullet_points = partial(
+ re.compile(r"(\n- .*?(?=\n(?! *(-|\d\.) )|$))", flags=re.DOTALL).sub,
+ lambda m: "\n- ".join(sorted(m.group().split("\n- "), key=str.lower)),
+)
+
+
+def update_docs_config(text: str, new: Version) -> str:
+ new_major_minor = f"{new.major}.{new.minor}"
+ text = re.sub(r"(?<=version = )[^\n]+", f'"{new_major_minor}"', text)
+ return re.sub(r"(?<=release = )[^\n]+", f'"{new}"', text)
+
+
+def remove_unused_headers(text: str, _: Version) -> str:
+ return re.sub(rf"({'|'.join(HEADINGS)})\n", "", text)
+
+
+def update_changelog(text: str, new: Version) -> str:
+ new_header = f"{new} ({datetime.now(timezone.utc).date():%B %d, %Y})"
+ headings_block = "\n".join(HEADINGS)
+ return re.sub(
+ # do not match if the new version is already present
+ r"\nUnreleased\n--+\n",
+ rf"""
+Unreleased
+----------
+
+{headings_block}
+{new_header}
+{"-" * len(new_header)}
+""",
+ text,
+ )
+
+
+UpdateVersionCallable = Callable[[str, Version], str]
+FILENAME_AND_UPDATE_TEXT: list[tuple[Path, UpdateVersionCallable]] = [
+ (
+ PYPROJECT,
+ lambda text, new: re.sub(r"(?<=\nversion = )[^\n]+", f'"{new}"', text),
+ ),
+ (
+ BASE / PACKAGE_NAME / "__init__.py",
+ lambda text, new: re.sub(r"(?<=__version__ = )[^\n]+", f'"{new}"',
text),
+ ),
+ (CHANGELOG, remove_unused_headers),
+ (CHANGELOG, update_changelog),
+ (BASE / "docs" / "conf.py", update_docs_config),
+]
+
+
+def validate_new_version(
+ ctx: click.Context, param: click.Argument, value: Version
+) -> Version:
+ """Validate the version is newer than the current one."""
+ current = parse(PYPROJECT_CONTENTS["project"]["version"])
+
+ if not value > current:
+ msg = f"version must be newer than {current}"
+ raise click.BadParameter(msg)
+
+ return value
+
+
+def bump_version(new: Version) -> None:
+ """Update the version number in specified files."""
+ for path, perform_update in FILENAME_AND_UPDATE_TEXT:
+ with path.open("r+") as f:
+ contents = f.read()
+ f.seek(0)
+ f.write(perform_update(contents, new))
+ f.truncate()
+
+
+def rst2md(text: str) -> str:
+ """Use Pandoc to convert text from ReST to Markdown."""
+ return (
+ subprocess.check_output(
+ ["pandoc", "--from=rst", "--to=gfm+hard_line_breaks"],
+ input=text.encode(),
+ )
+ .decode()
+ .strip()
+ )
+
+
+def get_changelog_contents() -> str | None:
+ if m := RST_LATEST_CHANGES.search(CHANGELOG.read_text()):
+ return m.group(1)
+
+ return None
+
+
+def changelog_as_markdown(rst: str) -> str:
+ """Get the latest changelog entry as hacked up Markdown."""
+ for pattern, repl in create_rst_replacements():
+ rst = re.sub(pattern, repl, rst, flags=re.M | re.DOTALL)
+
+ md = rst2md(rst)
+
+ # order bullet points in each of the lists alphabetically to
+ # improve readability
+ return order_bullet_points(md)
+
+
[email protected]()
+def cli() -> None:
+ pass
+
+
[email protected]()
[email protected]("version", type=Version, callback=validate_new_version)
+def bump(version: Version) -> None:
+ """Bump the version in project files."""
+ bump_version(version)
+
+
[email protected]()
+def changelog() -> None:
+ """Get the most recent version's changelog as Markdown."""
+ if changelog := get_changelog_contents():
+ try:
+ print(changelog_as_markdown(changelog))
+ except ValueError as e:
+ raise click.exceptions.UsageError(str(e))
+
+
+if __name__ == "__main__":
+ cli()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/poetry.lock
new/confuse-2.3.1/poetry.lock
--- old/confuse-2.2.0/poetry.lock 2026-01-28 11:39:36.000000000 +0100
+++ new/confuse-2.3.1/poetry.lock 2026-11-01 15:20:22.000000000 +0100
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 2.2.1 and should not be
changed by hand.
+# This file is automatically @generated by Poetry 2.4.1 and should not be
changed by hand.
[[package]]
name = "alabaster"
@@ -225,7 +225,7 @@
description = "Composable command line interface toolkit"
optional = false
python-versions = ">=3.10"
-groups = ["lint"]
+groups = ["lint", "release"]
files = [
{file = "click-8.3.1-py3-none-any.whl", hash =
"sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6"},
{file = "click-8.3.1.tar.gz", hash =
"sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a"},
@@ -240,12 +240,12 @@
description = "Cross-platform colored terminal text."
optional = false
python-versions =
"!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
-groups = ["main", "dev", "lint"]
+groups = ["main", "dev", "lint", "release"]
files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash =
"sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash =
"sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
]
-markers = {main = "extra == \"docs\" and sys_platform == \"win32\"", dev =
"sys_platform == \"win32\"", lint = "sys_platform == \"win32\" or
platform_system == \"Windows\""}
+markers = {main = "extra == \"docs\" and sys_platform == \"win32\"", dev =
"sys_platform == \"win32\"", lint = "sys_platform == \"win32\" or
platform_system == \"Windows\"", release = "platform_system == \"Windows\""}
[[package]]
name = "coverage"
@@ -1633,7 +1633,7 @@
description = "A lil' TOML parser"
optional = false
python-versions = ">=3.8"
-groups = ["main", "dev", "lint"]
+groups = ["main", "dev", "lint", "release"]
files = [
{file = "tomli-2.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash =
"sha256:b5ef256a3fd497d4973c11bf142e9ed78b150d36f5773f1ca6088c230ffc5867"},
{file = "tomli-2.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash =
"sha256:5572e41282d5268eb09a697c89a7bee84fae66511f87533a6f88bd2f7b652da9"},
@@ -1715,12 +1715,12 @@
description = "Backported and Experimental Type Hints for Python 3.9+"
optional = false
python-versions = ">=3.9"
-groups = ["dev", "lint"]
+groups = ["main", "dev", "lint"]
files = [
{file = "typing_extensions-4.15.0-py3-none-any.whl", hash =
"sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"},
{file = "typing_extensions-4.15.0.tar.gz", hash =
"sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"},
]
-markers = {dev = "python_version == \"3.10\""}
+markers = {main = "python_version < \"3.13\"", dev = "python_version ==
\"3.10\""}
[[package]]
name = "urllib3"
@@ -1747,4 +1747,4 @@
[metadata]
lock-version = "2.1"
python-versions = ">=3.10"
-content-hash =
"a66b26695a7b01066dcc6a13ae4fe8a2b09cf25853594d2b6adc3a63dcbdf4ac"
+content-hash =
"7b22181ff0549091ac6969954ec0136e055d7c5cb066a67c7b867b61811ee168"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/pyproject.toml
new/confuse-2.3.1/pyproject.toml
--- old/confuse-2.2.0/pyproject.toml 2026-01-28 11:39:36.000000000 +0100
+++ new/confuse-2.3.1/pyproject.toml 2026-11-01 15:20:22.000000000 +0100
@@ -1,6 +1,6 @@
[project]
name = "confuse"
-version = "2.2.0"
+version = "2.3.1"
description = "Painless YAML config files"
authors = [{ name = "Adrian Sampson", email = "[email protected]" }]
readme = "README.rst"
@@ -18,6 +18,7 @@
]
dependencies = [
"pyyaml",
+ "typing_extensions >= 4.4; python_version < '3.13'",
]
[dependency-groups]
@@ -36,6 +37,10 @@
[project.optional-dependencies]
docs = ["sphinx >= 7.4.7", "sphinx-rtd-theme >= 3.0.2"]
+[tool.poetry.group.release.dependencies]
+click = ">=8.1.7"
+tomli = ">=2.0.1"
+
[project.urls]
Homepage = "https://github.com/beetbox/confuse"
Repository = "https://github.com/beetbox/confuse"
@@ -55,6 +60,15 @@
{ path = "test", format = "sdist" },
]
+[tool.poe.tasks.bump]
+help = "Bump project version and update relevant files"
+cmd = "python ./extra/release.py bump $version"
+args = { version = { help = "The new version to set", positional = true,
required = true } }
+
+[tool.poe.tasks.changelog]
+help = "Print the latest version's changelog in Markdown"
+cmd = "python ./extra/release.py changelog"
+
[tool.poe.tasks.check-docs-links]
help = "Check the documentation for broken URLs"
cmd = "make -C docs linkcheck"
@@ -87,7 +101,8 @@
[tool.poe.tasks.lint-docs]
help = "Lint the documentation"
-shell = "sphinx-lint --enable all --disable default-role $(git ls-files
'*.rst')"
+interpreter = "bash"
+shell = "sphinx-lint --enable all $(git ls-files '*.rst')"
[tool.poe.tasks.test]
help = "Run tests with pytest"
@@ -137,3 +152,8 @@
[tool.ruff.format]
quote-style = "double"
+
+[tool.ruff.lint.flake8-pytest-style]
+fixture-parentheses = false
+mark-parentheses = false
+parametrize-names-type = "csv"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/setup.cfg new/confuse-2.3.1/setup.cfg
--- old/confuse-2.2.0/setup.cfg 2026-01-28 11:39:36.000000000 +0100
+++ new/confuse-2.3.1/setup.cfg 2026-11-01 15:20:22.000000000 +0100
@@ -32,6 +32,7 @@
allow_any_generics = false
allow_subclassing_any = true
allow_untyped_calls = true
+explicit_package_bases = true
strict = true
[mypy-test.*]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/test/extra/test_release.py
new/confuse-2.3.1/test/extra/test_release.py
--- old/confuse-2.2.0/test/extra/test_release.py 1970-01-01
01:00:00.000000000 +0100
+++ new/confuse-2.3.1/test/extra/test_release.py 2026-11-01
15:20:22.000000000 +0100
@@ -0,0 +1,201 @@
+"""Tests for the release utils."""
+
+import os
+import shutil
+import sys
+from datetime import datetime, timezone
+
+import pytest
+from packaging.version import Version
+
+release = pytest.importorskip("extra.release")
+
+RUNNING_IN_CI = os.environ.get("GITHUB_ACTIONS") == "true"
+
+pytestmark = pytest.mark.skipif(
+ not ((RUNNING_IN_CI and sys.platform != "win32") or
bool(shutil.which("pandoc"))),
+ reason="pandoc isn't available",
+)
+
+
[email protected]
+def rst_changelog():
+ return """
+Unreleased
+----------
+
+New features
+~~~~~~~~~~~~
+
+- Some substitute
+ multi-line change.
+ :bug:`5467`
+- See :class:`~nonexisting_ref` for non-existing reference.
+- See :ref:`Nice title <nonexisting_ref>` for non-existing named reference.
+
+You can do something with this command:
+
+::
+
+ $ do-something
+
+Bug fixes
+~~~~~~~~~
+
+- Some fix that refers to an issue.
+ :bug:`5467`
+- Some fix that mentions user :user:`username`.
+- Some fix thanks to
+ :user:`username`. :bug:`5467`
+- Some fix with its own bullet points using incorrect indentation:
+
+ - First nested bullet point
+ with some text that wraps to the next line
+ - Second nested bullet point
+
+- Another fix with an enumerated list
+
+ 1. First
+ and some details
+ 2. Second
+ and some details
+
+Long parapgraph naaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmmmmmeeeeeeeeeeeeeee ending
+with a colon:
+
+.. For plugin developers
+.. ~~~~~~~~~~~~~~~~~~~~~
+
+Other changes
+~~~~~~~~~~~~~
+
+- Changed ``bitesize`` label to ``good first issue``. Our `contribute`_ page
is now
+ automatically populated with these issues. :bug:`4855`
+
+.. _contribute: https://github.com/beetbox/beets/contribute
+
+2.1.0 (November 22, 2024)
+-------------------------
+
+Bug fixes
+~~~~~~~~~
+
+- Fixed something."""
+
+
[email protected]
+def md_changelog():
+ return r"""# Unreleased
+
+## New features
+
+- See `Nice title` for non-existing named reference.
+- See `nonexisting_ref` for non-existing reference.
+- Some substitute multi-line change. :bug: (#5467)
+
+You can do something with this command:
+
+ $ do-something
+
+## Bug fixes
+
+- Another fix with an enumerated list
+ 1. First and some details
+ 2. Second and some details
+- Some fix thanks to @username. :bug: (#5467)
+- Some fix that mentions user @username.
+- Some fix that refers to an issue. :bug: (#5467)
+- Some fix with its own bullet points using incorrect indentation:
+ - First nested bullet point with some text that wraps to the next line
+ - Second nested bullet point
+
+Long parapgraph naaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmmmmmeeeeeeeeeeeeeee
ending with a colon:
+
+## Other changes
+
+- Changed `bitesize` label to `good first issue`. Our
[contribute](https://github.com/beetbox/beets/contribute) page is now
automatically populated with these issues. :bug: (#4855)
+
+# 2.1.0 (November 22, 2024)
+
+## Bug fixes
+
+- Fixed something.""" # noqa: E501
+
+
+def test_convert_rst_to_md(rst_changelog, md_changelog):
+ actual = release.changelog_as_markdown(rst_changelog)
+
+ assert actual == md_changelog
+
+
+def test_bump_version_applies_sequential_changelog_updates(tmp_path,
monkeypatch):
+ changelog = tmp_path / "changelog.rst"
+ changelog.write_text(
+ """
+Unreleased
+----------
+
+..
+ New features
+ ~~~~~~~~~~~~
+
+Bug fixes
+~~~~~~~~~
+
+- Fixed a bug.
+
+..
+ Other changes
+ ~~~~~~~~~~~~~
+
+2.2.1 (January 01, 2025)
+------------------------
+"""
+ )
+ monkeypatch.setattr(
+ release,
+ "FILENAME_AND_UPDATE_TEXT",
+ [
+ (changelog, release.remove_unused_headers),
+ (changelog, release.update_changelog),
+ ],
+ )
+
+ release.bump_version(Version("2.3.0"))
+
+ today = datetime.now(timezone.utc).date()
+ formatted_date = f"{today:%B %d, %Y}"
+ assert (
+ changelog.read_text()
+ == f"""
+Unreleased
+----------
+
+..
+ New features
+ ~~~~~~~~~~~~
+
+..
+ Bug fixes
+ ~~~~~~~~~
+
+..
+ For plugin developers
+ ~~~~~~~~~~~~~~~~~~~~~
+
+..
+ Other changes
+ ~~~~~~~~~~~~~
+
+2.3.0 ({formatted_date})
+-------{"-" * len(formatted_date)}-
+
+Bug fixes
+~~~~~~~~~
+
+- Fixed a bug.
+
+2.2.1 (January 01, 2025)
+------------------------
+"""
+ )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/test/test_valid.py
new/confuse-2.3.1/test/test_valid.py
--- old/confuse-2.2.0/test/test_valid.py 2026-01-28 11:39:36.000000000
+0100
+++ new/confuse-2.3.1/test/test_valid.py 2026-11-01 15:20:22.000000000
+0100
@@ -1,11 +1,17 @@
import enum
import os
+import pathlib
import unittest
from collections.abc import Mapping, Sequence
from typing import Any
import pytest
+try:
+ from typing import assert_type # type: ignore[attr-defined]
+except ImportError: # Python < 3.11
+ from typing_extensions import assert_type
+
import confuse
from . import _root
@@ -461,19 +467,20 @@
class PathTest(unittest.TestCase):
def test_path_value(self):
- import pathlib
-
config = _root({"foo": "foo/bar"})
valid = config["foo"].get(confuse.Path())
assert valid == pathlib.Path(os.path.abspath("foo/bar"))
def test_default_value(self):
- import pathlib
-
config = _root({})
valid = config["foo"].get(confuse.Path("foo/bar"))
assert valid == pathlib.Path("foo/bar")
+ def test_optional_value_type(self):
+ config = _root({"foo": "foo/bar"})
+ valid = config["foo"].get(confuse.Optional(confuse.Path()))
+ assert_type(valid, pathlib.Path | None)
+
def test_default_none(self):
config = _root({})
valid = config["foo"].get(confuse.Path(None))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/confuse-2.2.0/test/test_validation.py
new/confuse-2.3.1/test/test_validation.py
--- old/confuse-2.2.0/test/test_validation.py 2026-01-28 11:39:36.000000000
+0100
+++ new/confuse-2.3.1/test/test_validation.py 2026-11-01 15:20:22.000000000
+0100
@@ -1,5 +1,6 @@
import enum
import os
+import pathlib
import unittest
import pytest
@@ -31,7 +32,7 @@
config["foo"].get(int)
-class BuiltInValidatorTest(unittest.TestCase):
+class TestBuiltInValidator:
def test_as_filename_with_non_file_source(self):
config = _root({"foo": "foo/bar"})
value = config["foo"].as_filename()
@@ -61,15 +62,32 @@
def test_as_path(self):
config = _root({"foo": "foo/bar"})
path_str = os.path.join(os.getcwd(), "foo", "bar")
- try:
- import pathlib
- except ImportError:
- with pytest.raises(ImportError):
- value = config["foo"].as_path()
- else:
- value = config["foo"].as_path()
- path = pathlib.Path(path_str)
- assert value == path
+ value = config["foo"].as_path()
+ path = pathlib.Path(path_str)
+ assert value == path
+
+ @pytest.mark.parametrize(
+ "config, expected_value",
+ [
+ ({"foo": "foo/bar"}, pathlib.Path(os.getcwd(), "foo", "bar")),
+ ({"foo": ""}, None),
+ ({"foo": None}, None),
+ ({}, None),
+ ],
+ )
+ def test_as_optional_path(self, config, expected_value):
+ config = _root(config)
+ value = config["foo"].as_optional_path()
+ assert value == expected_value
+
+ @pytest.mark.parametrize("value", [0, False, [], {}, 42])
+ def test_as_optional_path_wrong_type(self, value):
+ config = _root({"foo": value})
+ with pytest.raises(
+ confuse.ConfigTypeError,
+ match=f"^foo: must be a filename, not {type(value).__name__}$",
+ ):
+ config["foo"].as_optional_path()
def test_as_choice_correct(self):
config = _root({"foo": "bar"})