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/.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" 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..ffe8c3e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,12 +1,9 @@ -# -*- 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 +exclude .git-blame-ignore-revs +exclude uv.lock include *.rst include *.toml include .coveragerc 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..b603f94 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,19 +1,12 @@ -# -*- 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.""" 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 @@ -64,21 +57,15 @@ # # 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. # # 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: @@ -328,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), +} 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..b667189 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"] @@ -17,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"] diff --git a/run-tests.sh b/run-tests.sh index 2cd1cba..8bdde4b 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,14 +1,37 @@ -#!/bin/sh +#!/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 # -# 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. - -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 +# Usage: +# ./run-tests.sh [pytest options and args...] + +# 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" 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."""