Skip to content

Conversation

@brandonschabell
Copy link
Owner

Add python 3.13 support

Copilot AI review requested due to automatic review settings October 13, 2025 05:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Python 3.13 (and anticipates 3.14) by implementing compatibility fixes for pathlib changes introduced in Python 3.13. The main issue addressed is that Python 3.13 switched pathlib to a new implementation that delegates parsing to os.path, which breaks URLPath's custom URL handling logic.

Key changes:

  • Implements _parse_path() method to hook into Python 3.13's new pathlib extension point
  • Adds _combine_args() method to handle multi-argument URL construction for Python 3.12+
  • Updates compatibility layer with _bootstrap_legacy_parts() to populate missing pathlib attributes

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
urlpath/init.py Adds Python 3.13 compatibility methods and updates pathlib interaction logic
pyproject.toml Updates Python version classifiers and adds charset-normalizer dependency
README.md Updates supported Python version range documentation
.github/workflows/test.yml Adds Python 3.13 and 3.14 to CI test matrix
.github/copilot-instructions.md Updates CI documentation to reflect new Python version range

Comment on lines +584 to +589
tail_parts = list(value[1:]) if value and (self._drv or self._root) else list(value)

object.__setattr__(self, "_tail_cached", tail_parts)
tail_attr = getattr(type(self), "_tail", None)
if not isinstance(tail_attr, property):
object.__setattr__(self, "_tail", tail_parts)
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

The logic for setting _tail_cached and _tail is duplicated in lines 584-589 and 1718-1722. Consider extracting this into a helper method to reduce code duplication.

Copilot uses AI. Check for mistakes.
@brandonschabell brandonschabell merged commit b792aa6 into main Oct 13, 2025
7 checks passed
@brandonschabell brandonschabell deleted the py313-support branch October 13, 2025 05:09
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.

2 participants