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

Drop Python v3.7 support, upgrade deps, add Python v3.13 support #459

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

jherland
Copy link
Member

@jherland jherland commented Oct 23, 2024

Three themes in one PR:

  • Drop support for Python v3.7
  • Run poetry update to update our dependencies within existing constraints
    • ...and fix minor fallout from upgraded dependencies
  • Add support for Python v3.13

Happy to split this up into multiple PRs if that helps the review process.

Commits:

  • Update FAQ to better explain running FD outside of project env
  • Drop support for Python v3.7
  • Remove obsolete @calculated_once decorator
  • poetry update
  • Fixes after upgraded codespell
  • Reimplement Location._sort_key as a @cached_property
  • Update type annotations to appease Mypy
  • Fix new Ruff check by rephrasing logic and adding comments
  • Apply simple Ruff fixes after upgrade
  • Add support for Python v3.13

This decorator was a workaround for Python v3.7 missing
functools.cached_property. Now that we no longer support v3.7, we can
finally use the original from the standard library.
The "magic" ._sort_key attribute of a Location object (used to make
Location objects automatically orderable, even when some of their
attributes are None) can be more cleanly implemented as a cached
property, now that these are available in Python >=v3.8.
After upgrading Ruff, we got this new error:

  fawltydeps/gitignore_parser.py:214:13: SIM103 Return the negated condition directly
      |
  212 |           match = self.regex.search(rel_path)
  213 |           if match:
  214 |               if self.dir_only and not is_dir and match.end() == match.endpos:
      |  _____________^
  215 | |                 return False
  216 | |             return True
      | |_______________________^ SIM103
  217 |           return False
      |
      = help: Inline condition

Reshaping the condition resulted in this:

    if match:
        return not self.dir_only or is_dir or match.end() < match.endpos
    return False

But this logic is really cryptic when not already familiar with the
context and surrounding code, so I tried to add some helpful comments
and reshape it further, in order to attempt to better explain what's
going on here.
@jherland jherland self-assigned this Oct 23, 2024
@jherland jherland changed the title Drop Python v3.7 support and prepare for the future Drop Python v3.7 support, upgrade deps, add Python v3.13 support Oct 23, 2024
@jherland jherland marked this pull request as ready for review October 23, 2024 14:20
@jherland jherland added this to the FawltyDeps 1.0 milestone Oct 25, 2024
The investigations in issue #460 reveal that for now we are likely less
backwards-compatible than we'd like to be. Until that situation is
improved, let's tell users to open an issue if they encounter problems.
This should help us gauge how to prioritize this.
README.md Show resolved Hide resolved
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