Skip to content

Conversation

@snejus
Copy link
Member

@snejus snejus commented Oct 26, 2025

Fixes #5575
Fixes #5822
Fixes #6082
Fixes #6026

TODO

  • Update confuse

Python 3.13 compatibility

  • Updated librosa dependency from ^0.10.2.post1 to >=0.11 where a bug with numpy types is fixed.
  • Updated transitive audioread dependency which now pulls in standard-aifc, standard-sunau, and audioop-lts packages for Python 3.13 and above.

Python 3.14 compatibility

  • Python 3.14 introduced stricter requirements for input type in low level fnctl.ioctl function which we used to detect the terminal width. I replaced it with high-level, cross-platform shutil.get_terminal_size().
  • I'm not adding official support yet, as I faced many issues trying to install librosa dependencies on Python 3.14. It should work fine for people that do not use autobpm, and it may even work for those that do - if they have the right set of system dependencies available. We can revise this once we drop Python 3.9 in a couple of days.

Dependency updates

image

@snejus snejus requested a review from a team as a code owner October 26, 2025 21:04
@github-actions
Copy link

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

Copy link
Contributor

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 3.14 by addressing compatibility issues with dependencies and platform-specific code. The changes ensure the codebase can run on newer Python versions while maintaining backward compatibility.

Key changes:

  • Updated librosa dependency to version >=0.11 to fix numpy type compatibility issues in Python 3.13+
  • Replaced low-level fcntl.ioctl terminal width detection with cross-platform shutil.get_terminal_size() to handle Python 3.14's stricter type requirements
  • Extended CI test matrix to include Python 3.13 and 3.14

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
pyproject.toml Updated librosa dependency constraint from ^0.10.2.post1 to >=0.11 for Python 3.13+ compatibility
beets/ui/init.py Refactored term_width() to use shutil.get_terminal_size() instead of platform-specific fcntl.ioctl, added type hint and caching decorator
.github/workflows/ci.yaml Added Python 3.13 and 3.14 to the CI test matrix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@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!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `beets/ui/__init__.py:706` </location>
<code_context>
    return columns if columns else config["ui"]["terminal_width"].get(int)

</code_context>

<issue_to_address>
**suggestion (code-quality):** Replace if-expression with `or` ([`or-if-exp-identity`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/or-if-exp-identity))

```suggestion
    return columns or config["ui"]["terminal_width"].get(int)
```

<br/><details><summary>Explanation</summary>Here we find ourselves setting a value if it evaluates to `True`, and otherwise
using a default.

The 'After' case is a bit easier to read and avoids the duplication of
`input_currency`.

It works because the left-hand side is evaluated first. If it evaluates to
true then `currency` will be set to this and the right-hand side will not be
evaluated. If it evaluates to false the right-hand side will be evaluated and
`currency` will be set to `DEFAULT_CURRENCY`.
</details>
</issue_to_address>

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.

@snejus snejus force-pushed the support-python-313-314 branch from f4854c5 to 454b1bf Compare October 26, 2025 21:55
@codecov
Copy link

codecov bot commented Oct 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.22%. Comparing base (201677a) to head (cbd74b3).
⚠️ Report is 9 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6132      +/-   ##
==========================================
+ Coverage   66.98%   67.22%   +0.23%     
==========================================
  Files         118      118              
  Lines       18192    18180      -12     
  Branches     3079     3079              
==========================================
+ Hits        12186    12221      +35     
+ Misses       5347     5299      -48     
- Partials      659      660       +1     
Files with missing lines Coverage Δ
beets/ui/__init__.py 80.05% <100.00%> (+0.64%) ⬆️
beetsplug/lyrics.py 86.61% <100.00%> (+8.11%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

semohr
semohr previously approved these changes Oct 26, 2025
@semohr semohr dismissed their stale review October 26, 2025 22:00

Wrong pr sorry

@snejus snejus force-pushed the support-python-313-314 branch 12 times, most recently from 5035cb2 to 28533fb Compare October 27, 2025 08:22
@snejus snejus force-pushed the support-python-313-314 branch 3 times, most recently from 6f36af0 to 686a897 Compare October 27, 2025 08:33
@snejus snejus force-pushed the support-python-313-314 branch 2 times, most recently from 4a7172a to e6aa791 Compare October 27, 2025 08:36
@snejus snejus force-pushed the support-python-313-314 branch from e6aa791 to e30f7fb Compare October 27, 2025 08:45
This reverts commit e30f7fb.
@snejus snejus force-pushed the support-python-313-314 branch 3 times, most recently from ab91cf7 to 24f9389 Compare October 27, 2025 09:30
@snejus snejus changed the title Add support for Python 3.13 and 3.14 Add support for Python 3.13 Oct 27, 2025
Copy link
Member

@henry-oberholtzer henry-oberholtzer left a comment

Choose a reason for hiding this comment

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

Looks great to me - and confuse looks to be all set now too!

Copy link
Contributor

@semohr semohr left a comment

Choose a reason for hiding this comment

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

I think for the 3.13 update we don't necessarily need to wait for confuse but it might still be a good idea to update it now, if just for the improved type hints.

@snejus snejus force-pushed the support-python-313-314 branch from 94e57b1 to cbd74b3 Compare October 28, 2025 10:26
@snejus
Copy link
Member Author

snejus commented Oct 28, 2025

if just for the improved type hints.

That's exactly why I updated it for now!

@snejus snejus enabled auto-merge October 28, 2025 10:31
@snejus snejus merged commit 52b102c into master Oct 28, 2025
21 checks passed
@snejus snejus deleted the support-python-313-314 branch October 28, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants