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 #151

Merged
merged 3 commits into from
Dec 2, 2024
Merged

Conversation

jmgate
Copy link
Collaborator

@jmgate jmgate commented Dec 2, 2024

Type: Task

Description

  • Use type-hinting out of the box in 3.9.
  • Use new dictionary update syntax.
  • Update the CI and docs accordingly.

Motivation

The Python community no longer supports 3.8.

Summary by Sourcery

Drop support for Python 3.8 and update the codebase to leverage Python 3.9 features, including type hinting and dictionary update syntax. Adjust CI and documentation to align with the new Python version support.

Enhancements:

  • Utilize Python 3.9's new dictionary update syntax and type hinting features.

CI:

  • Update CI configuration to remove Python 3.8 from the testing matrix.

Documentation:

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

Chores:

  • Drop support for Python 3.8 across the codebase.

* Use type-hinting out of the box in 3.9.
* Use new dictionary update syntax.
* Update the CI and docs accordingly.
@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 codebase. The implementation focuses on two main aspects: updating type hints to use the new Python 3.9+ syntax (e.g., list[str] instead of List[str]) and adopting the new dictionary union operator (|=). The changes also include removing Python 3.8 from CI configurations and documentation.

Updated class diagram for type hinting changes

classDiagram
    class html_utilities {
        +nested_simplenamespace_to_dict()
        +parent_logger_card_html(name: str, *args: list[Iterator[str]])
        +child_logger_card_html(name: str, duration: str, *args: Union[Iterator[str], list[Iterator[str]]])
        +time_series_plot(cmd_id: str, data_tuples: list[tuple[float, float]], series_title: str)
        +disk_time_series_plot(cmd_id: str, data_tuples: tuple[float, float], volume_name: str)
        +stat_chart_card(labels: list[str], data: list[float], title: str, identifier: str)
        +split_template(template: str, split_at: str, **kwargs) -> tuple[str, str, str]
        +sgr_8bit_color_to_html(sgr_params: list[str]) -> str
        +sgr_24bit_color_to_html(sgr_params: list[str]) -> str
    }

    class shell_logger {
        +__init__(log: Optional[list[object]] = None)
        +to_html() -> Union[Iterator[str], list[Iterator[str]]]
        +log() -> None
    }

    class shell {
        +write(input_file: TextIO, output_files: list[TextIO]) -> None
        +auxiliary_command() -> tuple[Optional[str], Optional[str]]
    }

    class stats_collector {
        +stats_collectors(**kwargs) -> list[StatsCollector]
        +unproxied_stats() -> list[tuple[float, float]]
    }
Loading

File-Level Changes

Change Details Files
Update type hints to use native Python 3.9+ syntax
  • Replace typing.List with built-in list type annotation
  • Replace typing.Tuple with built-in tuple type annotation
  • Remove unnecessary imports from typing module
shell_logger/html_utilities.py
shell_logger/shell_logger.py
shell_logger/shell.py
shell_logger/stats_collector.py
Adopt Python 3.9+ dictionary union operator
  • Replace dict.update() calls with
= operator
  • Replace {**dict1, **dict2} syntax with dict1
  • Update CI configuration and documentation
    • Remove Python 3.8 from GitHub Actions workflow matrix
    • Update Python version badge in README
    • Remove Python 3.8 classifier from pyproject.toml
    .github/workflows/continuous-integration.yml
    README.md
    pyproject.toml
    doc/source/index.rst

    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: 2 issues found
    • 🟢 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.

    shell_logger/html_utilities.py Outdated Show resolved Hide resolved
    shell_logger/html_utilities.py Outdated Show resolved Hide resolved
    Copy link

    codecov bot commented Dec 2, 2024

    Codecov Report

    Attention: Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

    Project coverage is 77.84%. Comparing base (08719d1) to head (f9ec075).
    Report is 4 commits behind head on master.

    Files with missing lines Patch % Lines
    shell_logger/html_utilities.py 60.00% 2 Missing ⚠️
    Additional details and impacted files
    @@            Coverage Diff             @@
    ##           master     #151      +/-   ##
    ==========================================
    - Coverage   77.93%   77.84%   -0.10%     
    ==========================================
      Files           7        7              
      Lines         843      844       +1     
      Branches      168      145      -23     
    ==========================================
      Hits          657      657              
    - Misses        146      147       +1     
      Partials       40       40              

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

    Sourcery caught that this should be a sequence of tuples, and not just a
    single one.
    Sourcery suggested using an exception for this unreachable scenario.
    @jmgate jmgate merged commit 1dfd0b0 into master Dec 2, 2024
    14 checks passed
    @jmgate jmgate deleted the drop-support-for-python-3.8 branch December 2, 2024 19:14
    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