From 0c298c642490f7b19b1c6f7e7a63d1c9182085b3 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 11:01:40 +0000 Subject: [PATCH] ci: test on Python 3.14, lint with ruff; fix CITATION.cff CI: - Add Python 3.14 to the test matrix (and its classifier) - Add a lint job with ruff (pinned to 0.16.9); the rules are set in pyproject.toml to errors only (E4, E7, E9, F), so new ruff versions do not change the result - Fix the three findings: replace a lambda with a def in a test, mark the intentional `== True` in Processing with noqa and a comment, and use the unused __version__ import in a new test that checks it matches the version in pyproject.toml CITATION.cff: - Make it valid for CFF 1.2.0 (the unknown "languages" key and the duplicate "repository" key are removed; license as SPDX "MIT"; ORCIDs as URLs) - Update version to 0.5.1 and add date-released - Update the e-mail address to match pyproject.toml - Add the documentation URL and the DOI to the preferred citation Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VCvw8haRnmyrVKrLkz5Yf8 --- .github/workflows/test.yml | 13 ++++++++++++- CITATION.cff | 32 +++++++++++++++++--------------- pyproject.toml | 6 ++++++ succulent/processing.py | 3 ++- tests/test_explore.py | 5 ++++- tests/test_succulent.py | 14 ++++++++++++++ 6 files changed, 55 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf618be..5006791 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,13 +14,24 @@ concurrency: cancel-in-progress: true jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - name: Lint with ruff + uses: astral-sh/ruff-action@v3 + with: + version: 0.16.9 + args: check --output-format github + build: timeout-minutes: 30 strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] runs-on: ${{ matrix.os }} defaults: run: diff --git a/CITATION.cff b/CITATION.cff index 5df6d9a..fa578ea 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,18 +1,19 @@ cff-version: 1.2.0 -message: "Please cite this repository if you use it in your work." +message: "Please cite this repository if you use it in your work." title: "succulent" abstract: "Do you ever find it challenging and tricky to send sensor measurements, data, or GPS positions from embedded devices, microcontrollers, and smartwatches to a central server? Setting up the primary data collection scripts can be a time-consuming process, involving selecting a protocol, framework, API, and testing them out. Moreover, these scripts are often tailored for specific tasks, making them difficult to adapt to different scenarios." doi: 10.5281/zenodo.10402365 authors: - family-names: Fister Jr. given-names: Iztok - email: iztok@iztok.space - orcid: 0000-0002-6418-1272 + email: iztok@iztok.dev + orcid: "https://orcid.org/0000-0002-6418-1272" - family-names: Lahovnik given-names: Tadej - orcid: 0009-0005-9689-2991 -license: "MIT License" + orcid: "https://orcid.org/0009-0005-9689-2991" +license: MIT repository-code: "https://github.com/firefly-cpp/succulent" +url: "https://succulent.readthedocs.io/en/latest/" keywords: - Raspberry Pi - Data Science @@ -20,21 +21,22 @@ keywords: - ESP32 - Data Collection - Data Preprocessing Pipelines -repository: "https://github.com/firefly-cpp/succulent" -version: 0.4.0 -languages: - - Python +version: 0.5.1 +date-released: 2026-11-09 preferred-citation: type: software title: "succulent" authors: - family-names: Fister Jr. given-names: Iztok - email: iztok@iztok.space - orcid: 0000-0002-6418-1272 + email: iztok@iztok.dev + orcid: "https://orcid.org/0000-0002-6418-1272" - family-names: Lahovnik given-names: Tadej - orcid: 0009-0005-9689-2991 - version: 0.4.0 - license: "MIT License" - repository-code: "https://github.com/firefly-cpp/succulent" \ No newline at end of file + orcid: "https://orcid.org/0009-0005-9689-2991" + doi: 10.5281/zenodo.10402365 + version: 0.5.1 + date-released: 2026-11-09 + license: MIT + repository-code: "https://github.com/firefly-cpp/succulent" + url: "https://succulent.readthedocs.io/en/latest/" diff --git a/pyproject.toml b/pyproject.toml index 1215b36..c3cacd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Scientific/Engineering", "Topic :: System :: Hardware", @@ -58,6 +59,11 @@ Sphinx = ">=7.0" sphinx-rtd-theme = ">=2.0" sphinxcontrib-bibtex = "^2.6" +[tool.ruff.lint] +# Errors only (syntax errors, undefined names, unused imports, ...), no style +# rules; listed explicitly so new ruff versions do not change the CI result +select = ["E4", "E7", "E9", "F"] + [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] build-backend = "poetry.core.masonry.api" diff --git a/succulent/processing.py b/succulent/processing.py index c37bfe4..d14ec29 100644 --- a/succulent/processing.py +++ b/succulent/processing.py @@ -92,7 +92,8 @@ def __init__(self, format, config, unittest=False): } for configuration in config['data'] if configuration.get('min') is not None or configuration.get('max') is not None] if 'timestamp' in config: - if config['timestamp'] == True: + # Only the YAML value true enables it (not e.g. the string 'false') + if config['timestamp'] == True: # noqa: E712 self.timestamp = True if 'results' in config: diff --git a/tests/test_explore.py b/tests/test_explore.py index 5d508e5..2960123 100644 --- a/tests/test_explore.py +++ b/tests/test_explore.py @@ -140,7 +140,10 @@ def test_summary(self): # /measure rejects values outside min/max, so the out-of-range row is # written directly (as for data stored before the limits were set) now = datetime.now() - stamp = lambda minutes: (now - timedelta(minutes=minutes)).strftime('%Y-%m-%d %H:%M:%S') + + def stamp(minutes): + return (now - timedelta(minutes=minutes)).strftime('%Y-%m-%d %H:%M:%S') + self.write_rows([ {'temperature': 20, 'humidity': 40, 'status': 'ok', 'timestamp': stamp(20)}, {'temperature': 35, 'humidity': 41, 'status': 'ok', 'timestamp': stamp(10)}, diff --git a/tests/test_succulent.py b/tests/test_succulent.py index dc37a15..d05112d 100644 --- a/tests/test_succulent.py +++ b/tests/test_succulent.py @@ -1,5 +1,6 @@ from succulent import __version__ import pandas as pd +import re import unittest import io import json @@ -804,6 +805,19 @@ def test_infinity_is_null(self): self.assertIsNone(data[0]['humidity']) +class TestVersion(unittest.TestCase): + """ + The package version must match the version in pyproject.toml. + """ + + def test_version_matches_pyproject(self): + pyproject = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'pyproject.toml') + with open(pyproject, encoding='utf-8') as f: + match = re.search(r'^version = "([^"]+)"', f.read(), flags=re.MULTILINE) + self.assertIsNotNone(match) + self.assertEqual(__version__, match.group(1)) + + class TestConfiguration(unittest.TestCase): """ Test case for the Configuration class.