diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 88a44dc5..fcf09ed5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,6 +22,7 @@ jobs: - "3.11" - "3.12" - "3.13" + - "3.14" steps: # https://github.com/actions/setup-python diff --git a/NEWS b/NEWS index 80629b51..28cb752e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +* Tue Aug 11 2026 Satoru SATOH - 0.16.0-1 +- fix: add py3.14 and make it as default test target +- fix: [security][doc] related changes for the removal of pickle backend +- fix: [security] remove pickle backend loader and dumper +- fix; [ruff] correction for ISC004 +- fix: [ruff] add copyright headers which were missing + * Mon Feb 16 2026 Satoru SATOH - 0.15.1-1 - fix: [doc] disable the badge of scrutinizer as it does not look worked - fix: [doc] add an extra empty line to avoid rst syntax error diff --git a/README.rst b/README.rst index 56ba9fda..811f42b1 100644 --- a/README.rst +++ b/README.rst @@ -245,7 +245,6 @@ and backends in charge are enabled and ready to use: JSON, json, ``json`` (standard lib) or ``simplejson`` [#]_ Ini-like, ini, ``configparser`` (standard lib) - Pickle, pickle, ``pickle`` (standard lib) XML, xml, ``ElementTree`` (standard lib) Java properties [#]_ , properties, None (native implementation with standard lib) B-sh, shellvars, None (native implementation with standard lib) diff --git a/docs/api/anyconfig.backend.pickle.rst b/docs/api/anyconfig.backend.pickle.rst deleted file mode 100644 index 84f7d47b..00000000 --- a/docs/api/anyconfig.backend.pickle.rst +++ /dev/null @@ -1,13 +0,0 @@ -:mod:`anyconfig.backend.pickle` -================================ - -.. automodule:: anyconfig.backend.pickle - :members: - :special-members: - :private-members: - :undoc-members: - :show-inheritance: - -.. toctree:: - - anyconfig.backend.pickle.stdlib diff --git a/docs/api/anyconfig.backend.pickle.stdlib.rst b/docs/api/anyconfig.backend.pickle.stdlib.rst deleted file mode 100644 index f51a9b28..00000000 --- a/docs/api/anyconfig.backend.pickle.stdlib.rst +++ /dev/null @@ -1,9 +0,0 @@ -:mod:`anyconfig.backend.pickle.stdlib` -======================================== - -.. automodule:: anyconfig.backend.pickle.stdlib - :members: - :special-members: - :private-members: - :undoc-members: - :show-inheritance: diff --git a/docs/api/anyconfig.backend.rst b/docs/api/anyconfig.backend.rst index ba1c4851..3144a380 100644 --- a/docs/api/anyconfig.backend.rst +++ b/docs/api/anyconfig.backend.rst @@ -6,7 +6,6 @@ anyconfig.backend.base anyconfig.backend.ini anyconfig.backend.json - anyconfig.backend.pickle anyconfig.backend.properties anyconfig.backend.python anyconfig.backend.sh diff --git a/docs/introduction.rst b/docs/introduction.rst index 825f6dfe..5b3dcbfb 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -203,7 +203,6 @@ and backends in charge are enabled and ready to use: JSON, json, ``json`` (standard lib) or ``simplejson`` [#]_ Ini-like, ini, ``configparser`` (standard lib) - Pickle, pickle, ``pickle`` (standard lib) XML, xml, ``ElementTree`` (standard lib) Java properties [#]_ , properties, None (native implementation with standard lib) B-sh, shellvars, None (native implementation with standard lib) diff --git a/pkg/package.spec.in b/pkg/package.spec.in index d69e7f86..55881903 100644 --- a/pkg/package.spec.in +++ b/pkg/package.spec.in @@ -96,6 +96,11 @@ rm -frv docs/build/html/_sources %endif %changelog +* Tue Aug 11 2026 Satoru SATOH - 0.16.0-1 +- new upstream release +- security fix +- see NEWS fore more details + * Mon Feb 16 2026 Satoru SATOH - 0.15.0-1 - new upstream release - fix dependencies to deprecated python3-toml package diff --git a/src/anyconfig/api/__init__.py b/src/anyconfig/api/__init__.py index 1f3a83f5..7187a6ca 100644 --- a/src/anyconfig/api/__init__.py +++ b/src/anyconfig/api/__init__.py @@ -118,7 +118,7 @@ ) -__version__ = "0.15.1" +__version__ = "0.16.0" def version() -> list[str]: diff --git a/src/anyconfig/backend/__init__.py b/src/anyconfig/backend/__init__.py index 7dfb9965..cc056227 100644 --- a/src/anyconfig/backend/__init__.py +++ b/src/anyconfig/backend/__init__.py @@ -10,7 +10,6 @@ from . import ( ini, json, - pickle, properties, python, sh, @@ -24,7 +23,7 @@ PARSERS: ParserClssT = [ - *ini.PARSERS, *json.PARSERS, *pickle.PARSERS, *properties.PARSERS, + *ini.PARSERS, *json.PARSERS, *properties.PARSERS, *python.PARSERS, *sh.PARSERS, *xml.PARSERS, ] diff --git a/src/anyconfig/backend/pickle/__init__.py b/src/anyconfig/backend/pickle/__init__.py deleted file mode 100644 index c0c9f8d9..00000000 --- a/src/anyconfig/backend/pickle/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (C) 2011 - 2024 Satoru SATOH -# SPDX-License-Identifier: MIT -# -"""Backend modules to load and dump pickle data. - -- pickle.stdlib: python standard library to load and dump pickle files - [default] - -Changelog: - -.. versionchanged:: 0.14.0 - - - Re-organized -""" -from . import stdlib -from ..base import ParserClssT - - -PARSERS: ParserClssT = [stdlib.Parser] diff --git a/src/anyconfig/backend/pickle/stdlib.py b/src/anyconfig/backend/pickle/stdlib.py deleted file mode 100644 index ed69df97..00000000 --- a/src/anyconfig/backend/pickle/stdlib.py +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (C) 2017 - 2024 Satoru SATOH -# SPDX-License-Identifier: MIT -# -r"""A backend module to load and dump pickle files. - -- Format to support: Pickle -- Requirements: It should be available always. - - - pickle/cPickle in python 2 standard library: - https://docs.python.org/2/library/pickle.html - - - pickle in python 3 standard library: - https://docs.python.org/3/library/pickle.html - -- Development Status :: 4 - Beta -- Limitations: The parser cannot load some primitive data such like '' (empty - string), ' ' (white space) and [] (empty list) as these are because of the - implementation of :func:`anyconfig.backend.base.load_with_fn`. -- Special options: All options of pickle.{load{s,},dump{s,}} should work. - -Changelog: - -.. versionchanged:: 0.9.7 - - - Add support of loading primitives other than mapping objects. - -.. versionadded:: 0.8.3 -""" -from __future__ import annotations - -import pickle -import typing - -from .. import base - - -LOAD_OPTS: tuple[str, ...] = ("fix_imports", "encoding", "errors") -DUMP_OPTS: tuple[str, ...] = ("protocol", "fix_imports") - - -class Parser(base.StringStreamFnParser): - """Parser for Pickle files.""" - - _cid: typing.ClassVar[str] = "pickle.stdlib" - _type: typing.ClassVar[str] = "pickle" - _extensions: tuple[str, ...] = ("pkl", "pickle") - _open_read_mode: typing.ClassVar[str] = "rb" - _open_write_mode: typing.ClassVar[str] = "wb" - - _load_opts = LOAD_OPTS - _dump_opts = DUMP_OPTS - _allow_primitives: typing.ClassVar[bool] = True - - _load_from_string_fn = base.to_method(pickle.loads) - _load_from_stream_fn = base.to_method(pickle.load) - _dump_to_string_fn = base.to_method(pickle.dumps) - _dump_to_stream_fn = base.to_method(pickle.dump) diff --git a/src/anyconfig/cli/_main.py b/src/anyconfig/cli/_main.py index d716b4ac..eacb956d 100644 --- a/src/anyconfig/cli/_main.py +++ b/src/anyconfig/cli/_main.py @@ -95,8 +95,8 @@ def try_validate(cnf: api.InDataExT, args: argparse.Namespace) -> None: msg_code = ("Validation succeeded", 0) else: msg_code = ( - "Validation failed:" - f"{(os.linesep + ' ').join(errors)}", + ("Validation failed:" + f"{(os.linesep + ' ').join(errors)}"), 1, ) diff --git a/src/anyconfig/models/__init__.py b/src/anyconfig/models/__init__.py index aa88620c..66f88859 100644 --- a/src/anyconfig/models/__init__.py +++ b/src/anyconfig/models/__init__.py @@ -1 +1,5 @@ +# +# Copyright (C) 2026 Satoru SATOH +# SPDX-License-Identifier: MIT +# """Provide basic model objects.""" diff --git a/src/anyconfig/schema/jsonschema/__init__.py b/src/anyconfig/schema/jsonschema/__init__.py index f0c3f2c5..03563d75 100644 --- a/src/anyconfig/schema/jsonschema/__init__.py +++ b/src/anyconfig/schema/jsonschema/__init__.py @@ -1 +1,5 @@ +# +# Copyright (C) 2011 - 2026 Satoru SATOH +# SPDX-License-Identifier: MIT +# """jsonschema generator and validator.""" diff --git a/tests/api/open/test_basics.py b/tests/api/open/test_basics.py index d44d34fe..baa1ee09 100644 --- a/tests/api/open/test_basics.py +++ b/tests/api/open/test_basics.py @@ -6,7 +6,6 @@ """Test cases for api.open.""" from __future__ import annotations -import pickle import typing import pytest @@ -32,18 +31,3 @@ def test_open_text_io(ipath, exp, opts): with TT.open(ipath, **opts) as inp: assert LD.load(inp, **opts) == exp - - -def test_open_byte_io(tmp_path): - cnf = {"a": 1, "b": "b"} - - path = tmp_path / "test.pickle" - pickle.dump(cnf, path.open(mode="wb")) - - opts = {"ac_parser": "pickle"} - - with TT.open(path, **opts) as fio: - assert fio.mode == "rb" - data: bytes = fio.read() - - assert LD.loads(data, **opts) == cnf diff --git a/tests/backend/dumpers/pickle/__init__.py b/tests/backend/dumpers/pickle/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/backend/dumpers/pickle/test_pickle_stdlib.py b/tests/backend/dumpers/pickle/test_pickle_stdlib.py deleted file mode 120000 index 8ac9c7c2..00000000 --- a/tests/backend/dumpers/pickle/test_pickle_stdlib.py +++ /dev/null @@ -1 +0,0 @@ -../json/test_json_stdlib.py \ No newline at end of file diff --git a/tests/backend/loaders/pickle/__init__.py b/tests/backend/loaders/pickle/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/backend/loaders/pickle/test_pickle_stdlib.py b/tests/backend/loaders/pickle/test_pickle_stdlib.py deleted file mode 120000 index 8ac9c7c2..00000000 --- a/tests/backend/loaders/pickle/test_pickle_stdlib.py +++ /dev/null @@ -1 +0,0 @@ -../json/test_json_stdlib.py \ No newline at end of file diff --git a/tests/common/paths.py b/tests/common/paths.py index e598aa2b..9b3781d2 100644 --- a/tests/common/paths.py +++ b/tests/common/paths.py @@ -47,7 +47,8 @@ def get_data( ) -> list[tuple[pathlib.Path, dict[str, pathlib.Path]]]: # find the dir holding input data files. pattern = "*.*" - if not any(x for x in topdir.iterdir() if x.is_file()): + if not any(x for x in topdir.iterdir() + if x.is_file() and x.suffix != ".pyc"): pattern = "*/" + pattern return sorted( diff --git a/tox.ini b/tox.ini index ffd9cf69..d2113597 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ envlist = py311 py312 py313 + py314 lint type-check min @@ -20,7 +21,8 @@ python = 3.10: py310 3.11: py311 3.12: py312 - 3.13: py313, type-check, lint, plugins, min + 3.13: py313 + 3.14: py314, type-check, lint, plugins, min [flake8] exclude = .git,.tox,dist,*egg,setup.py