From ede89f826827cf81b91d0de678276f30b3b846fd Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Sun, 24 May 2026 21:49:08 +0200 Subject: [PATCH 1/9] chore(licenses): update license headers to use SPDX --- .editorconfig | 10 ++-------- AUTHORS.rst | 9 +++------ CHANGES.rst | 9 +++------ MANIFEST.in | 11 +++-------- README.rst | 9 +++------ base32_lib/__init__.py | 14 ++++---------- base32_lib/base32.py | 13 ++++--------- docs/conf.py | 12 +++--------- docs/index.rst | 9 +++------ pyproject.toml | 13 ++++--------- run-tests.sh | 10 +++------- tests/test_base32.py | 12 +++--------- 12 files changed, 38 insertions(+), 93 deletions(-) diff --git a/.editorconfig b/.editorconfig index 72c25e8..2a84cfb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,11 +1,5 @@ -# -*- coding: utf-8 -*- -# -# This file is part of base32-lib -# Copyright (C) 2015, 2016 CERN. -# -# base32-lib is free software; you can redistribute it and/or modify -# it under the terms of the Revised BSD License; see LICENSE file for -# more details. +# SPDX-FileCopyrightText: 2015, 2016 CERN. +# SPDX-License-Identifier: BSD-3-Clause # # In applying this license, CERN does not waive the privileges and immunities # granted to it by virtue of its status as an Intergovernmental Organization diff --git a/AUTHORS.rst b/AUTHORS.rst index 345a353..bc1ff31 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,10 +1,7 @@ .. - This file is part of base32-lib - Copyright (C) 2019 CERN. - Copyright (C) 2019 Northwestern University. - - base32-lib is free software; you can redistribute it and/or modify it - under the terms of the MIT License; see LICENSE file for more details. + SPDX-FileCopyrightText: 2019 CERN. + SPDX-FileCopyrightText: 2019 Northwestern University. + SPDX-License-Identifier: MIT Authors diff --git a/CHANGES.rst b/CHANGES.rst index b7153d3..fd422cd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,10 +1,7 @@ .. - This file is part of base32-lib - Copyright (C) 2019 CERN. - Copyright (C) 2019 Northwestern University. - - base32-lib is free software; you can redistribute it and/or modify it - under the terms of the MIT License; see LICENSE file for more details. + SPDX-FileCopyrightText: 2019 CERN. + SPDX-FileCopyrightText: 2019 Northwestern University. + SPDX-License-Identifier: MIT Changes ======= diff --git a/MANIFEST.in b/MANIFEST.in index eb10551..b2b4183 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,11 +1,6 @@ -# -*- coding: utf-8 -*- -# -# This file is part of base32-lib -# Copyright (C) 2019 CERN. -# Copyright (C) 2019 Northwestern University. - -# base32-lib is free software; you can redistribute it and/or modify it -# under the terms of the MIT License; see LICENSE file for more details. +# SPDX-FileCopyrightText: 2019 CERN. +# SPDX-FileCopyrightText: 2019 Northwestern University. +# SPDX-License-Identifier: MIT include *.rst include *.toml diff --git a/README.rst b/README.rst index 8767c36..e8aa15e 100644 --- a/README.rst +++ b/README.rst @@ -1,10 +1,7 @@ .. - This file is part of base32-lib - Copyright (C) 2019 CERN. - Copyright (C) 2019 Northwestern University. - - base32-lib is free software; you can redistribute it and/or modify it - under the terms of the MIT License; see LICENSE file for more details. + SPDX-FileCopyrightText: 2019 CERN. + SPDX-FileCopyrightText: 2019 Northwestern University. + SPDX-License-Identifier: MIT ================= diff --git a/base32_lib/__init__.py b/base32_lib/__init__.py index 70cf8e3..6560a9d 100644 --- a/base32_lib/__init__.py +++ b/base32_lib/__init__.py @@ -1,13 +1,7 @@ -# -*- coding: utf-8 -*- -# -# This file is part of base32-lib -# Copyright (C) 2019 CERN. -# Copyright (C) 2019 Northwestern University, -# Galter Health Sciences Library & Learning Center. -# Copyright (C) 2025 Front Matter. - -# base32-lib is free software; you can redistribute it and/or modify it -# under the terms of the MIT License; see LICENSE file for more details. +# SPDX-FileCopyrightText: 2019 CERN. +# SPDX-FileCopyrightText: 2019 Northwestern University, +# SPDX-FileCopyrightText: 2025 Front Matter. +# SPDX-License-Identifier: MIT """Small library to generate, encode and decode random base32 identifiers.""" diff --git a/base32_lib/base32.py b/base32_lib/base32.py index 7362a53..d037dfd 100644 --- a/base32_lib/base32.py +++ b/base32_lib/base32.py @@ -1,12 +1,7 @@ -# -*- coding: utf-8 -*- -# -# This file is part of base32-lib -# Copyright (C) 2019 CERN. -# Copyright (C) 2019 Northwestern University. -# Copyright (C) 2025 Front Matter. - -# base32-lib is free software; you can redistribute it and/or modify it -# under the terms of the MIT License; see LICENSE file for more details. +# SPDX-FileCopyrightText: 2019 CERN. +# SPDX-FileCopyrightText: 2019 Northwestern University. +# SPDX-FileCopyrightText: 2025 Front Matter. +# SPDX-License-Identifier: MIT """Generate, encode and decode random base32 identifiers. diff --git a/docs/conf.py b/docs/conf.py index edab805..3f58bfe 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,12 +1,6 @@ -# -*- coding: utf-8 -*- -# -# This file is part of base32-lib -# Copyright (C) 2019 CERN. -# Copyright (C) 2019 Northwestern University, -# Galter Health Sciences Library & Learning Center. - -# base32-lib is free software; you can redistribute it and/or modify it -# under the terms of the MIT License; see LICENSE file for more details. +# SPDX-FileCopyrightText: 2019 CERN. +# SPDX-FileCopyrightText: 2019 Northwestern University, +# SPDX-License-Identifier: MIT """Sphinx configuration.""" diff --git a/docs/index.rst b/docs/index.rst index f6f7594..ecf00a2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,10 +1,7 @@ .. - This file is part of base32-lib - Copyright (C) 2019 CERN. - Copyright (C) 2019 Northwestern University. - - base32-lib is free software; you can redistribute it and/or modify it - under the terms of the MIT License; see LICENSE file for more details. + SPDX-FileCopyrightText: 2019 CERN. + SPDX-FileCopyrightText: 2019 Northwestern University. + SPDX-License-Identifier: MIT .. currentmodule:: base32-lib diff --git a/pyproject.toml b/pyproject.toml index 7be1359..76490d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,7 @@ -# -*- coding: utf-8 -*- -# -# This file is part of base32-lib -# Copyright (C) 2019 CERN. -# Copyright (C) 2019 Northwestern University. -# Copyright (C) 2025 Front Matter. - -# base32-lib is free software; you can redistribute it and/or modify it -# under the terms of the MIT License; see LICENSE file for more details. +# SPDX-FileCopyrightText: 2019 CERN. +# SPDX-FileCopyrightText: 2019 Northwestern University. +# SPDX-FileCopyrightText: 2025 Front Matter. +# SPDX-License-Identifier: MIT [build-system] requires = ["setuptools>=61", "wheel"] diff --git a/run-tests.sh b/run-tests.sh index 2cd1cba..2c603fa 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,11 +1,7 @@ #!/bin/sh -# -# This file is part of base32-lib -# Copyright (C) 2019 CERN. -# Copyright (C) 2019 Northwestern University. - -# base32-lib is free software; you can redistribute it and/or modify it -# under the terms of the MIT License; see LICENSE file for more details. +# SPDX-FileCopyrightText: 2019 CERN. +# SPDX-FileCopyrightText: 2019 Northwestern University. +# SPDX-License-Identifier: MIT pydocstyle base32-lib tests && \ isort --recursive --check-only --diff **/*.py && \ diff --git a/tests/test_base32.py b/tests/test_base32.py index d6425f1..5c12317 100644 --- a/tests/test_base32.py +++ b/tests/test_base32.py @@ -1,12 +1,6 @@ -# -*- coding: utf-8 -*- -# -# This file is part of base32-lib -# Copyright (C) 2019 CERN. -# Copyright (C) 2019 Northwestern University, -# Galter Health Sciences Library & Learning Center. - -# base32-lib is free software; you can redistribute it and/or modify it -# under the terms of the MIT License; see LICENSE file for more details. +# SPDX-FileCopyrightText: 2019 CERN. +# SPDX-FileCopyrightText: 2019 Northwestern University, +# SPDX-License-Identifier: MIT """Provider tests.""" From 15922e51d3b0a1dba78c7a15b1fa7f1467c902c6 Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Fri, 12 Jun 2026 18:26:45 +0600 Subject: [PATCH 2/9] chore(format): reformat with black --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 3f58bfe..fa6f889 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -8,7 +8,6 @@ import os - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. From 14ca00bee40ec966937fa45e9b2c4bbf0d4cb8df Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Fri, 12 Jun 2026 18:28:48 +0600 Subject: [PATCH 3/9] chore(distribution): exclude irrelevant files from distribution --- MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index b2b4183..ffe8c3e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,6 +2,8 @@ # SPDX-FileCopyrightText: 2019 Northwestern University. # SPDX-License-Identifier: MIT +exclude .git-blame-ignore-revs +exclude uv.lock include *.rst include *.toml include .coveragerc From cd6dd6235bf5808520565e9d2ca184e411d63d32 Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Fri, 12 Jun 2026 18:32:14 +0600 Subject: [PATCH 4/9] chore(setup): set minimum python version to 3.8 * requiring 3.10+ seems to have been a mistake, judging from commit 254311bba7aaa7e5b9e0e364adfdb7c057e252d2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 76490d4..b667189 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ name = "base32-lib" dynamic = ["version"] description = "Small library to generate, encode and decode random base32 strings." readme = "README.rst" -requires-python = ">=3.10" +requires-python = ">=3.8" license = { text = "MIT License" } authors = [{ name = "Invenio Software", email = "info@inveniosoftware.org" }] keywords = ["base32", "identifiers"] From 3fae786dc0ed7e775da9ec3515f745a3534955af Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Fri, 12 Jun 2026 18:36:59 +0600 Subject: [PATCH 5/9] chore(tests): add "docs" extra to the test run --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ee2acf5..3d3f135 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,3 +29,5 @@ on: jobs: Python: uses: inveniosoftware/workflows/.github/workflows/tests-python.yml@master + with: + extras: "tests,docs" From 87f4fd49beb0ee4fa6ae6b1f5369c80795b20b11 Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Fri, 12 Jun 2026 18:40:01 +0600 Subject: [PATCH 6/9] chore(docs): get release version like in other packages --- docs/conf.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index fa6f889..fcace63 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,7 +6,7 @@ from __future__ import print_function -import os +from base32_lib import __version__ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -57,14 +57,8 @@ # # The short X.Y version. -# Get the version string. Cannot be done with import! -g = {} -with open(os.path.join("..", "base32_lib", "version.py"), "rt") as fp: - exec(fp.read(), g) - version = g["__version__"] - # The full version, including alpha/beta/rc tags. -release = version +release = __version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 417680832f178cd70f3f5dce549c2163c32e8edd Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Fri, 12 Jun 2026 18:41:39 +0600 Subject: [PATCH 7/9] chore(docs): use intersphinx mappings like in other packages --- docs/conf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index fcace63..1de2fb1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -315,4 +315,6 @@ # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {"https://docs.python.org/": None} +intersphinx_mapping = { + "python": ("https://docs.python.org/", None), +} From a09f673205d6452b58b5beab6c773b7d61ffd2e1 Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Fri, 12 Jun 2026 18:43:55 +0600 Subject: [PATCH 8/9] chore(docs): set language like in other packages --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 1de2fb1..b603f94 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -65,7 +65,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: From bf1b3b188660eecb127031f6d5db1c877b6ab127 Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Fri, 12 Jun 2026 18:47:24 +0600 Subject: [PATCH 9/9] chore(tests): align run-tests.sh with other packages --- run-tests.sh | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index 2c603fa..8bdde4b 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,10 +1,37 @@ -#!/bin/sh -# SPDX-FileCopyrightText: 2019 CERN. -# SPDX-FileCopyrightText: 2019 Northwestern University. +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2019-2021 CERN. +# SPDX-FileCopyrightText: 2019-2020 Northwestern University. +# SPDX-FileCopyrightText: 2021-2026 TU Wien. +# SPDX-FileCopyrightText: 2022 Graz University of Technology. # SPDX-License-Identifier: MIT +# +# Usage: +# ./run-tests.sh [pytest options and args...] -pydocstyle base32-lib tests && \ -isort --recursive --check-only --diff **/*.py && \ -check-manifest --ignore ".travis-*" && \ -sphinx-build -qnNW docs docs/_build/html && \ -python setup.py test +# Quit on errors +set -o errexit + +# Quit on unbound symbols +set -o nounset + +# Check for arguments +# Note: "-k" would clash with "pytest" +pytest_args=() +for arg in $@; do + # from the CLI args, filter out some known values and forward the rest to "pytest" + # note: we don't use "getopts" here b/c of some limitations (e.g. long options), + # which means that we can't combine short options (e.g. "./run-tests -Kk pattern") + case ${arg} in + *) + pytest_args+=( ${arg} ) + ;; + esac +done + +python -m check_manifest +python -m sphinx.cmd.build -qnN docs docs/_build/html +# Note: expansion of pytest_args looks like below to not cause an unbound +# variable error when 1) "nounset" and 2) the array is empty. +python -m pytest ${pytest_args[@]+"${pytest_args[@]}"} +tests_exit_code=$? +exit "$tests_exit_code"