Skip to content

Add --matrix-python/--no-matrix-python flag to opt out of CI matrices#1089

Merged
nathanjmcdougall merged 11 commits intomainfrom
copilot/add-flag-to-opt-out-ci-matrices
Nov 5, 2025
Merged

Add --matrix-python/--no-matrix-python flag to opt out of CI matrices#1089
nathanjmcdougall merged 11 commits intomainfrom
copilot/add-flag-to-opt-out-ci-matrices

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 5, 2025

Summary

Implements the feature requested in the issue to allow opting out of CI matrices for Bitbucket Pipelines.

Changes

  • Add --matrix-python/--no-matrix-python flag to usethis ci bitbucket command
  • Pass matrix_python parameter from CLI → use_ci_bitbucket()PytestTool
  • Update help text per feedback
  • Revert unauthorized changes to .gitignore, _config.py, and environ/python.py
  • Move logic to appropriate abstraction level (in use_ci_bitbucket and PytestTool)
  • Update base Tool class to accept explicit matrix_python parameter

Usage

Default behavior (matrix enabled):

$ usethis ci bitbucket
# Creates: Test on 3.11, Test on 3.12, Test on 3.13, Test on 3.14

Single version (matrix disabled):

$ usethis ci bitbucket --no-matrix-python
# Creates: Test on 3.10 (current development version only)

Implementation Details

  • Tool.update_bitbucket_steps(*, matrix_python: bool = True) uses explicit keyword-only parameter
  • Tool.get_bitbucket_steps(*, matrix_python: bool = True) accepts the parameter
  • All tool implementations updated to match base class signature (codespell, ruff, pre_commit, import_linter, pyproject_fmt, deptry)
  • PytestTool.update_bitbucket_steps() calls super().update_bitbucket_steps(matrix_python=matrix_python)
  • PytestTool.get_bitbucket_steps(matrix_python=...) uses parameter to decide version selection
  • When False, uses get_python_major_version() for single current version
  • When True (default), uses get_supported_major_python_versions() for full matrix

Testing

  • Updated existing tests to pass matrix_python parameter

  • CLI tests remain unchanged (use flags directly)

  • All changes follow existing code patterns

  • Fixes A way to opt out of CI matrices #178

Original prompt

This section details on the original issue you should resolve

<issue_title>A way to opt out of CI matrices</issue_title>
<issue_description>Motivation
For package dev, a matrix is good, but for a simple project, the .python-version file can just be the source of truth for the test.

Summary of desired enhancement
Provide a flag in usethis ci bitbucket which doesn't create a full test matrix, perhaps named --matrix-python/--no-matrix-python, so that later we could also have --matrix-os/--no-matrix-os and --matrix-dependencies/--no-matrix-dependencies.

If there's no Python matrix, then we will just use the current development version identified for the project.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 5, 2025 10:56
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
…ignore

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title [WIP] Add flag to opt out of CI matrices in usethis ci bitbucket Add --matrix-python/--no-matrix-python flag to opt out of CI matrices Nov 5, 2025
…onfig

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Nov 5, 2025

CodSpeed Performance Report

Merging #1089 will not alter performance

Comparing copilot/add-flag-to-opt-out-ci-matrices (ceeecdf) with main (ec22e41)

Summary

✅ 2 untouched

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review November 5, 2025 19:40
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
@nathanjmcdougall nathanjmcdougall merged commit 03d6a06 into main Nov 5, 2025
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/add-flag-to-opt-out-ci-matrices branch November 5, 2025 20:43
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.

A way to opt out of CI matrices

2 participants