Skip to content

Trim keywords and drop empty ones - #715

Open
simonvanlierde wants to merge 2 commits into
NLeSC:mainfrom
simonvanlierde:fix/keywords-whitespace
Open

simonvanlierde wants to merge 2 commits into
NLeSC:mainfrom
simonvanlierde:fix/keywords-whitespace

Conversation

@simonvanlierde

Copy link
Copy Markdown

Checklist before requesting a review

  • I have read the contribution guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • All user facing changes have been added to CHANGELOG.md

Type of change

  • Bug fix (non-breaking change which fixes an issue)

List of related issues or pull requests

Refs:

Describe the changes made in this pull request

Hi,

As discussed in #627: the keywords answer is split on , but not trimmed, so kw1, second kw gives keywords = ["kw1"," second kw"], and an empty answer gives keywords = [""].

  • pyproject.toml.jinja trims each keyword and drops empty ones, so an empty answer now gives keywords = [].
  • The CITATION.cff template does the same, and leaves out keywords: when nothing is left.
  • Two tests in tests/test_values.py, one per file. Both fail on main and pass with the change.
  • A CHANGELOG line under Changed.

Tests: the full suite passes on Python 3.12, 3.13 and 3.14 (Linux), apart from test_ruff_check, which fails on CPY001 as it does on main. #713 fixes that. I couldn't run macOS or Windows.

Instructions to review the pull request

copier copy --vcs-ref fix/keywords-whitespace https://github.com/simonvanlierde/python-template test_package

Answer kw1, second kw, for keywords, then check keywords in pyproject.toml and CITATION.cff.

Simon

- pyproject.toml: strip spaces after commas, skip empty entries
- CITATION.cff: same, and leave out keywords when none are left
- add tests for both cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant