Skip to content

Conversation

@jmgate
Copy link
Collaborator

@jmgate jmgate commented Oct 20, 2025

Undo the last of 8d15f4a.

  • Use a match case statement in place of an if block.
  • Replace Union types with X | Y syntax.

Also introduce support for Python 3.14.

Closes #16.

Summary by Sourcery

Drop support for Python 3.9 and add compatibility with Python 3.14 while leveraging modern Python 3.10+ syntax throughout the codebase and updating CI, metadata, and docs accordingly.

New Features:

  • Add support for Python 3.14

Enhancements:

  • Replace lengthy if-elif chain in _unparse_action with match-case
  • Switch Union/Optional type hints to PEP 604 X | Y syntax

Build:

  • Raise minimum supported Python version to 3.10

CI:

  • Remove Python 3.9 and add Python 3.14 in the CI test matrix

Documentation:

  • Update Python version classifiers and badge to reflect support for 3.10–3.14

Tests:

  • Adjust test type hints to use X | Y syntax instead of Optional or Union

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 20, 2025

Reviewer's Guide

This PR removes support for Python 3.9 by raising the minimum Python version to 3.10, adds compatibility for Python 3.14, and modernizes code by replacing a long if-elif action dispatch chain with a match-case statement and updating Union type annotations to the newer | syntax.

Class diagram for updated _unparse_action method dispatch

classDiagram
    class ReverseArgparse {
        +_unparse_action(action: Action)
        +_unparse_append_action(action: Action)
        +_unparse_append_const_action(action: Action)
        +_unparse_count_action(action: Action)
        +_unparse_extend_action(action: Action)
        +_unparse_store_action(action: Action)
        +_unparse_store_const_action(action: Action)
        +_unparse_store_false_action(action: Action)
        +_unparse_store_true_action(action: Action)
        +_unparse_sub_parsers_action(action: Action)
        +_unparse_boolean_optional_action(action: Action)
    }
    ReverseArgparse : _unparse_action uses match-case for dispatch
Loading

File-Level Changes

Change Details Files
Replaced if-elif dispatch with match-case
  • Replaced long if/elif chain for action types with a match-case construct
  • Maintained pragma no-cover behaviors and default NotImplementedError in case _
reverse_argparse/reverse_argparse.py
Updated type annotations in tests to use syntax
  • Replaced Optional[T] with T
Bumped Python support and CI configurations
  • Removed Python 3.9 classifiers and CI jobs, added Python 3.14 entries
  • Updated poetry python requirement to >=3.10
  • Updated GitHub Actions matrix and README badge to reflect supported versions
pyproject.toml
.github/workflows/continuous-integration.yml
README.md

Assessment against linked issues

Issue Objective Addressed Explanation
#16 Update pyproject.toml to drop Python 3.9 support and add Python 3.14 support.
#16 Update the badge in README.md to remove Python 3.9 and add Python 3.14.
#16 Update the CI file to remove Python 3.9 and add Python 3.14.
#16 Use the match-case statement in _unparse_args().
#16 Use other Python 3.10+ features in the code where appropriate.

Possibly linked issues

  • Drop Support for Python 3.9 #16: The PR drops Python 3.9 support by updating pyproject.toml, CI, README, and uses match-case and X|Y syntax as outlined in the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@jmgate jmgate self-assigned this Oct 20, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.01%. Comparing base (5d7c9da) to head (b9e5ffb).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #343      +/-   ##
==========================================
+ Coverage   93.97%   94.01%   +0.03%     
==========================================
  Files           2        2              
  Lines         166      167       +1     
  Branches       37       37              
==========================================
+ Hits          156      157       +1     
  Misses          4        4              
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jmgate jmgate force-pushed the 16-drop-support-for-python-3.9 branch 3 times, most recently from e8cd4c1 to ae7d161 Compare October 20, 2025 22:28
Undo the last of 8d15f4a.

* Use a match case statement in place of an if block.
* Replace Union types with X | Y syntax.

Also introduce support for Python 3.14.

Closes #16.
@jmgate jmgate force-pushed the 16-drop-support-for-python-3.9 branch from ae7d161 to b9e5ffb Compare October 20, 2025 22:31
@jmgate jmgate merged commit 39fb940 into master Oct 20, 2025
15 checks passed
@jmgate jmgate deleted the 16-drop-support-for-python-3.9 branch October 20, 2025 22:47
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.

Drop Support for Python 3.9

2 participants