Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: Drop support for Python 3.8 #244

Merged
merged 1 commit into from
Dec 3, 2024
Merged

Conversation

jmgate
Copy link
Collaborator

@jmgate jmgate commented Dec 2, 2024

Type: Task

Description

  • Use the type-hinting provided out of the box in 3.9.
  • Remove version guards around argparse.BooleanOptionalAction.
  • Update documentation and CI accordingly.

Related Issues/PRs

Motivation

Python 3.8 is no longer supported by the community.

Summary by Sourcery

Drop support for Python 3.8, leveraging Python 3.9 features such as built-in type hinting and removing version guards for BooleanOptionalAction. Update CI and documentation to align with the new minimum Python version requirement.

Enhancements:

  • Utilize Python 3.9's built-in type hinting capabilities.

CI:

  • Update CI configuration to remove testing for Python 3.8.

Documentation:

  • Update documentation to reflect the removal of Python 3.8 support.

Chores:

  • Drop support for Python 3.8 across the codebase.

@jmgate jmgate self-assigned this Dec 2, 2024
Copy link

sourcery-ai bot commented Dec 2, 2024

Reviewer's Guide by Sourcery

This PR removes Python 3.8 support from the project by leveraging Python 3.9+ features, particularly focusing on built-in type hints and the BooleanOptionalAction from argparse. The implementation involves removing version checks, updating type hints, and adjusting CI configuration and documentation.

Updated class diagram for ReverseArgumentParser

classDiagram
    class ReverseArgumentParser {
        - list[str] _args
        - int _indent
        - Namespace _namespace
        - list[ArgumentParser] _parsers
        - list[bool] _unparsed
        + _unparse_action(Action action) void
        + get_pretty_command_line_invocation() str
        + _get_long_option_strings(Sequence~str~ option_strings) list[str]
        + _get_short_option_strings(Sequence~str~ option_strings) list[str]
        + _append_list_of_list_of_args(list[list[str]] args) void
        + _append_list_of_args(list[str] args) void
    }
Loading

File-Level Changes

Change Details Files
Remove Python 3.8 version checks and directly use BooleanOptionalAction
  • Remove sys.version_info checks for BooleanOptionalAction
  • Remove BOOLEAN_OPTIONAL_ACTION_MINOR_VERSION constant
  • Simplify conditional logic in test assertions
  • Update argument parser implementation to use BooleanOptionalAction directly
test/test_reverse_argparse.py
reverse_argparse/reverse_argparse.py
Update type hints to use Python 3.9+ syntax
  • Replace List[] with list[] annotations
  • Remove typing imports for built-in containers
reverse_argparse/reverse_argparse.py
Update project metadata and CI configuration
  • Remove Python 3.8 from CI matrix
  • Update Python version badge in README
  • Remove Python 3.8 classifier from pyproject.toml
.github/workflows/continuous-integration.yml
README.md
pyproject.toml

Assessment against linked issues

Issue Objective Addressed Explanation
#15 Update configuration files (pyproject.toml, README.md, CI) to remove Python 3.8 support
#15 Remove version guards around BooleanOptionalAction and use Python 3.9+ features
#15 Update type hints to use Python 3.9+ syntax

Possibly linked issues


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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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

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 @jmgate - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.97%. Comparing base (65aa685) to head (5c448ec).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #244      +/-   ##
==========================================
- Coverage   94.04%   93.97%   -0.08%     
==========================================
  Files           2        2              
  Lines         168      166       -2     
  Branches       42       37       -5     
==========================================
- Hits          158      156       -2     
  Misses          4        4              
  Partials        6        6              

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

* Use the type-hinting provided out of the box in 3.9.
* Remove version guards around `argparse.BooleanOptionalAction`.
* Update documentation and CI accordingly.
@jmgate jmgate force-pushed the 15-drop-support-for-python-3.8 branch from 3962d91 to 5c448ec Compare December 2, 2024 17:18
@jmgate
Copy link
Collaborator Author

jmgate commented Dec 2, 2024

@jcox10, @GhostofGoes, @william76, anyone want to review and approve?

@jcox10 jcox10 self-requested a review December 3, 2024 18:52
@jmgate jmgate merged commit eb22039 into master Dec 3, 2024
13 checks passed
@jmgate jmgate deleted the 15-drop-support-for-python-3.8 branch December 3, 2024 19:16
@GhostofGoes
Copy link
Collaborator

LGTM

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.8
3 participants