Skip to content

fix: drop dead tomli fallback (closes #330) - #337

Closed
robotrocketscience wants to merge 1 commit into
mainfrom
fix/issue-330-drop-tomli-fallback
Closed

fix: drop dead tomli fallback (closes #330)#337
robotrocketscience wants to merge 1 commit into
mainfrom
fix/issue-330-drop-tomli-fallback

Conversation

@robotrocketscience

@robotrocketscience robotrocketscience commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

pyproject.toml declares requires-python = ">=3.12". Stdlib tomllib arrived in 3.11. The try: import tomllib / except ImportError: import tomli fallback in src/aelfrice/deferred_feedback.py:46-49 is therefore unreachable code. Replace with the direct stdlib import and drop the matching DEP003 deptry ignore.

Verification

  • uv run pytest tests/ -q → 1982 passed, 18 skipped.
  • uvx deptry src → "Success! No dependency issues found."
  • git grep -n tomli → only the now-removed comment in the deptry config block; no remaining tomli references.

Closes #330.

Summary by Sourcery

Remove the obsolete tomli fallback now that the project targets Python 3.12+ and clean up the corresponding dependency tooling configuration.

Enhancements:

  • Simplify configuration loading by importing tomllib directly and removing the legacy tomli fallback path.

Build:

  • Remove the deptry DEP003 ignore entry for tomli now that it is no longer used or required.

Summary by CodeRabbit

  • Chores
    • Updated minimum Python version requirement to 3.11 or later. The application now uses only the built-in tomllib module, removing support for legacy Python compatibility fallbacks.

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 77b284f3-55c1-463f-afac-fa863b677955

📥 Commits

Reviewing files that changed from the base of the PR and between cbbbcf5 and cc2094f.

📒 Files selected for processing (2)
  • pyproject.toml
  • src/aelfrice/deferred_feedback.py
💤 Files with no reviewable changes (1)
  • pyproject.toml

📝 Walkthrough

Walkthrough

The changes implement Option A from issue #330 by replacing the conditional tomli fallback with unconditional use of Python's stdlib tomllib. The module now imports only tomllib (available in Python 3.11+), and the corresponding DEP003 ignore entry is removed from the project configuration.

Changes

Cohort / File(s) Summary
Configuration cleanup
pyproject.toml
Removed the DEP003 per-rule ignore entry that previously whitelisted the undeclared tomli dependency.
Import update
src/aelfrice/deferred_feedback.py
Replaced the conditional import fallback (tomllib with tomli fallback for Python <3.11) with unconditional tomllib import, effectively requiring Python 3.11+.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: removing the obsolete tomli fallback import now that Python 3.12+ is required.
Description check ✅ Passed The description provides a clear summary of why the change was made, links to the closed issue, and includes verification results demonstrating the change is correct.
Linked Issues check ✅ Passed The PR fully implements Option A of issue #330 by removing the tomli import fallback, updating the code to use stdlib tomllib directly, and removing the DEP003 deptry ignore entry.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective: removing dead tomli code, updating the import, and cleaning up the deptry configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-330-drop-tomli-fallback

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai

sourcery-ai Bot commented May 1, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR removes an obsolete fallback dependency on tomli now that the project targets Python 3.12+, switching to an unconditional stdlib tomllib import and cleaning up the corresponding deptry configuration.

File-Level Changes

Change Details Files
Unconditionally use stdlib tomllib instead of a tomli fallback.
  • Replace the try/except ImportError block importing tomllib with a single direct import of tomllib.
  • Remove any references to tomli in the deferred feedback implementation, relying solely on the stdlib module.
src/aelfrice/deferred_feedback.py
Remove obsolete deptry ignore entry for tomli.
  • Delete the DEP003 = ["tomli"] ignore entry from the deptry configuration.
  • Update project metadata so that tomli is no longer treated as an allowed but unused dependency.
pyproject.toml

Assessment against linked issues

Issue Objective Addressed Explanation
#330 Handle the tomli fallback correctly by either (A) removing the tomli import and using only stdlib tomllib (after dropping Python <3.11 support), or (B) declaring tomli as a conditional runtime dependency (tomli; python_version < "3.11").
#330 Remove the DEP003 deptry ignore for tomli from [tool.deptry.per_rule_ignores] in pyproject.toml.
#330 Ensure tests pass on all supported Python versions after the change.

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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

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

@robotrocketscience robotrocketscience added the author-Kulili PR coordination mutex label May 1, 2026
`requires-python = ">=3.12"` makes the `try: import tomllib /
except ImportError: import tomli` fallback unreachable. Replace with
the direct stdlib import and drop the matching DEP003 deptry ignore.

Closes #330.
@github-actions
github-actions Bot force-pushed the fix/issue-330-drop-tomli-fallback branch from 9650c1f to cc2094f Compare May 1, 2026 15:53

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


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.

@robotrocketscience

Copy link
Copy Markdown
Owner Author

Superseded by #339. Identical diff but the auto-rebase workflow re-wrote this PR's HEAD as github-actions[bot] (unsigned), and the branch ruleset requires signed commits, so this could not be merged. #339 re-applies the same change with a fresh signed commit.

github-actions Bot pushed a commit that referenced this pull request May 1, 2026
`requires-python = ">=3.12"` makes the `try: import tomllib / except ImportError: import tomli` fallback unreachable; stdlib tomllib ships in 3.11+. Drop the try/except and the matching DEP003 deptry ignore.

Resigned, signed-commit version: prior PRs #332 and #337 had identical diffs but were unsigned after the auto-rebase workflow rewrote them as github-actions[bot]; ruleset requires signatures, so neither was mergeable. Closing both as superseded.
robotrocketscience added a commit that referenced this pull request May 1, 2026
`requires-python = ">=3.12"` makes the `try: import tomllib / except ImportError: import tomli` fallback unreachable; stdlib tomllib ships in 3.11+. Drop the try/except and the matching DEP003 deptry ignore.

Resigned, signed-commit version: prior PRs #332 and #337 had identical diffs but were unsigned after the auto-rebase workflow rewrote them as github-actions[bot]; ruleset requires signatures, so neither was mergeable. Closing both as superseded.
@robotrocketscience
robotrocketscience deleted the fix/issue-330-drop-tomli-fallback branch May 5, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author-Kulili PR coordination mutex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: replace tomli fallback with stdlib tomllib (drop Py 3.10) or declare tomli

1 participant